Skip to content

Commit

Permalink
Merge pull request #13 from fruzsinaagocs/multiterm-fixes
Browse files Browse the repository at this point in the history
Setting default value for bufname
  • Loading branch information
williamjameshandley authored Sep 11, 2019
2 parents 72e4362 + cc71fbb commit ce77368
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Vimteractive
============
:vimteractive: send commands from text files to interactive programs via vim
:Author: Will Handley
:Version: 2.0.1
:Version: 2.0.2
:Homepage: https://github.com/williamjameshandley/vimteractive
:Documentation: ``:help vimteractive``

Expand Down
14 changes: 11 additions & 3 deletions autoload/vimteractive.vim
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,23 @@ endfunction


" Connect to vimteractive terminal
function! vimteractive#connect(bufname)
function! vimteractive#connect(...)
" Check that there are buffers to connect to
if len(s:vimteractive_buffers) == 0
echoerr "No vimteractive terminal buffers present"
echoerr "call :Iterm to start a new one"
return
endif

let l:bufname = a:bufname
if strlen(a:bufname) ==# 0
" Check if there was an argument passed to this function
if a:0 == 0
let l:bufname = ''
else
let l:bufname = a:1
endif

" Check if bufname isn't just ''
if l:bufname == ''
if len(s:vimteractive_buffers) ==# 1
let l:bufname = vimteractive#buffer_list()[0]
else
Expand Down

0 comments on commit ce77368

Please sign in to comment.