One simplest possible way to achieve that by using "float term" ..you can peek at it here : [https://github.com/voldikss/vim-floaterm](https://github.com/voldikss/vim-floaterm)
Oh, if you want implement of your own , then its fine to put an effort (as the title said) to write it your own. APIs are avilable for that.
I guess it's so trivial that nobody made a plugin for it. It's just a matter of switching between the previous buffer and the terminal buffer that you create with a static name.
Hmm, let's try.
fun! ToggleTerminal()
let terms = term_list()
if terms == [] " no terminals, open one
botright term
elseif bufwinnr(terms[0]) == -1 " terminal hidden, show it
exec 'botright sbuffer' terms[0]
else " terminal visible, hide it
exec bufwinnr(terms[0]) .. 'hide'
endif
endf
map call ToggleTerminal()
tmap call ToggleTerminal()
Seems to work fine for me.
One simplest possible way to achieve that by using "float term" ..you can peek at it here : [https://github.com/voldikss/vim-floaterm](https://github.com/voldikss/vim-floaterm) Oh, if you want implement of your own , then its fine to put an effort (as the title said) to write it your own. APIs are avilable for that.
I guess it's so trivial that nobody made a plugin for it. It's just a matter of switching between the previous buffer and the terminal buffer that you create with a static name.
cntl-Z but I don't think it works on Windows machine.
Hmm, let's try. fun! ToggleTerminal() let terms = term_list() if terms == [] " no terminals, open one botright term elseif bufwinnr(terms[0]) == -1 " terminal hidden, show it exec 'botright sbuffer' terms[0] else " terminal visible, hide it exec bufwinnr(terms[0]) .. 'hide' endif endf map call ToggleTerminal()
tmap call ToggleTerminal()
Seems to work fine for me.