Commit eabf99c4 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Make kodo#toggleterm#Terminal cmd argument optional

parent a956ce4d
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -2,14 +2,16 @@
" Toggle terminal buffers from hotkeys
""

function! kodo#toggleterm#Terminal(cmd)
function! kodo#toggleterm#Terminal(...)
	let term = {}
	let term.origin_buffer = v:null
	let term.window = v:null
	let term.was_new = v:null
	let term.cmd = type(a:cmd) == v:t_list ? a:cmd :
	             \      a:cmd  == v:null   ? [ &shell ] :
	             \                           [ &shell, '-c', string(a:cmd) ]

	let cmd = get(a:, 1, v:null)
	let term.cmd = type(cmd) == v:t_list ? cmd :
	\                   cmd  == v:null   ? [ &shell ] :
	\                                      [ &shell, '-c', string(cmd) ]

	" Expand (show) the terminal, optionally in a new window
	" If a new window is requested it is opened by spliting, which obeys the […] 
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ let s:hot_terms = {}

function s:toggle(num)
	if !has_key(s:hot_terms, a:num)
		let s:hot_terms[a:num] = kodo#toggleterm#Terminal(v:null) 
		let s:hot_terms[a:num] = kodo#toggleterm#Terminal()
	endif
	call s:hot_terms[a:num].toggle(g:TermToggleOpenNewWindow)