Advertisement
Guest User

Untitled

a guest
Oct 28th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 0.61 KB | None | 0 0
  1. function! TryCode()
  2.   let l:message = system('./client', getline(0, line('$')))
  3.  
  4.   " if there's a message, post it
  5.   if l:message != ''
  6.     echohl WarningMsg | echomsg 'Client: ' . l:message | echohl None
  7.   else
  8.     " if there's no message, but there's an error...
  9.     if v:shell_error != 0
  10.       echohl Error | echomsg 'Client: CRASH!' | echohl None
  11.     endif
  12.   endif
  13. endfunction
  14.  
  15. " Notes:
  16. " Vim’s event model by Damian Conway (2010)
  17. "   https://developer.ibm.com/tutorials/l-vim-script-5/
  18. "
  19. " autocmd  EventName  filename_pattern   :command
  20. "
  21. autocmd TextChanged,TextChangedI *.c :call TryCode()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement