Skip to content

Commit d8506d2

Browse files
committed
Fix #5: Commands not pausing in neovim
1 parent e6393a1 commit d8506d2

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Diff for: autoload/arduino.vim

+10-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ if (exists('g:loaded_arduino_autoload') && g:loaded_arduino_autoload)
33
endif
44
let g:loaded_arduino_autoload = 1
55
let s:HERE = resolve(expand('<sfile>:p:h:h'))
6+
" In neovim, run the shell commands using :terminal to preserve interactivity
7+
if has('nvim')
8+
let s:TERM = 'terminal! '
9+
else
10+
let s:TERM = '!'
11+
endif
612

713
" Initialization {{{1
814
" Set up all user configuration variables
@@ -262,15 +268,15 @@ endfunction
262268
function! arduino#Verify()
263269
let cmd = arduino#GetArduinoCommand("--verify")
264270
exe ":silent !echo " . cmd
265-
exe ":!" . cmd
271+
exe ":" . s:TERM . cmd
266272
redraw!
267273
return v:shell_error
268274
endfunction
269275

270276
function! arduino#Upload()
271277
let cmd = arduino#GetArduinoCommand("--upload")
272278
exe ":silent !echo " . cmd
273-
exe ":silent !" . cmd
279+
exe ":silent " . s:TERM . cmd
274280
redraw!
275281
return v:shell_error
276282
endfunction
@@ -280,9 +286,9 @@ function! arduino#Serial()
280286
if empty(cmd) | return | endif
281287
exe ":silent !echo " . cmd
282288
if !empty($TMUX) && !empty(g:arduino_serial_tmux)
283-
exe ":!tmux " . g:arduino_serial_tmux . " '" . cmd . "'"
289+
exe ":" . s:TERM . "tmux " . g:arduino_serial_tmux . " '" . cmd . "'"
284290
else
285-
exe ":!" . cmd
291+
exe ":" . s:TERM . cmd
286292
endif
287293
redraw!
288294
endfunction

0 commit comments

Comments
 (0)