If you close terminal buffer with :q or other commands, then next <C-t> execution will failed:
Error detected while processing function <SNR>38_NewTerminal:
line 3:
function!s:NewTerminal()
ifhas('nvim')
ifexists('t:terminal_buffer')
exe"bd! " . t:terminal_buffer" <-----unlett:terminal_buffer
elsebotrightsplitresize10terminallett:terminal_buffer =bufnr()
normaliendifelseecho"Sorry, you are not a 'NeoVim' user ;("endifendfunction
If you use <C-hjkl> to navigate Tmux splits, then you might stuck inside Vim pane. <C-hjkl> inside Vim will create new splits, instead of navigating to different terminals.
Need to implement global variable to disable split creation inside function and set different mappings for this behaviour:
If you create a few splits after hitting <C-t> (create new terminal bottom split), the next shortcut execution will close different split, instead of terminal.
Steps to Reproduce
Create new terminal split <C-t>
Hit <C-\><C-n> to quit terminal insert mode
Create new empty split
Hit <C-t> again
Expected Results
It will close terminal split.
Actual Results
It will close different split, instead of terminal one.
Workaround
This feature uses winnr() function, which saves current split ID number.
ID number changes after each :split command.
This implementation must be changed: