Skip to content

Commit f00e04a

Browse files
committed
adding vimux support
1 parent c1cc3e3 commit f00e04a

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

autoload/arduino.vim

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ function! arduino#InitializeConfig() abort
6161
if !exists('g:arduino_use_slime')
6262
let g:arduino_use_slime = 0
6363
endif
64+
if !exists('g:arduino_use_tmux') || !exists('$TMUX')
65+
let g:arduino_use_tmux = 0
66+
endif
6467

6568
if !exists('g:arduino_run_headless')
6669
let g:arduino_run_headless = executable('Xvfb') == 1
@@ -81,6 +84,16 @@ function! arduino#InitializeConfig() abort
8184
call arduino#ReloadBoards()
8285
endfunction
8386

87+
function! arduino#RunCmd(cmd) abort
88+
if g:arduino_use_slime
89+
call slime#send(a:cmd . "\r")
90+
elseif g:arduino_use_tmux
91+
call VimuxRunCommand(a:cmd)
92+
else
93+
exe s:TERM . a:cmd
94+
endif
95+
endfunction
96+
8497
" Boards and programmer definitions {{{1
8598
function! arduino#ReloadBoards() abort
8699
" TODO in the future if we're using arduino-cli we shouldn't have to do this,
@@ -517,11 +530,8 @@ function! arduino#Verify() abort
517530
else
518531
let cmd = arduino#GetArduinoCommand("--verify")
519532
endif
520-
if g:arduino_use_slime
521-
call slime#send(cmd."\r")
522-
else
523-
exe s:TERM . cmd
524-
endif
533+
534+
call arduino#RunCmd(cmd)
525535
return v:shell_error
526536
endfunction
527537

@@ -536,22 +546,16 @@ function! arduino#Upload() abort
536546
endif
537547
let cmd = arduino#GetArduinoCommand(cmd_options)
538548
endif
539-
if g:arduino_use_slime
540-
call slime#send(cmd."\r")
541-
else
542-
exe s:TERM . cmd
543-
endif
549+
550+
call arduino#RunCmd(cmd)
544551
return v:shell_error
545552
endfunction
546553

547554
function! arduino#Serial() abort
548555
let cmd = arduino#GetSerialCmd()
549556
if empty(cmd) | return | endif
550-
if g:arduino_use_slime
551-
call slime#send(cmd."\r")
552-
else
553-
exe s:TERM . cmd
554-
endif
557+
558+
call arduino#RunCmd(cmd)
555559
endfunction
556560

557561
function! arduino#UploadAndSerial() abort

0 commit comments

Comments
 (0)