Closed Kryan90 closed 7 years ago
I'm not sure if I understood, can you expand this explanation, maybe a gif/video would help too. 😃
So here is one of the issues which could possibly be fixed by having neoterm remember which buffer was selected before hand
The second issue is if I leave neoterm open, go to different split to edit text, the easiest way I can find to get back neoterm is to hit my :ttoggle key twice to close and reopen it. I thought :topen might be able to refocus neoterm if it is already open, but that doesn't seem to work.
Ideally I would like to be able to have a key binding that does the following (possibly with a neoterm_keep_open flag)
No neoterm open -> Open neoterm and focus Neoterm open -> Neoterm in focus -> If flag set to keep neoterm open -> return to previously focused split leaving neoterm in place Neoterm open -> other split in focus -> jump back into neoterm
I hope that makes some more sense, I'm not great at explaining my thoughts. I can try and make more gifs if that is helpful.
Which version of neovim are you using? This is fixed on more recent versions of neovim. Please, check if your neovim has the function :h win_getid
, if it doesn't have I'm not able to know which window the cursor were before opening the neoterm window.
My neovim is recent (NVIM v0.2.0-849-g297e8d0) and has an entry for :h win_getid.
Here is my setup for Neoterm:
let g:neoterm_position = 'horizontal'
let g:neoterm_automap_keys = ',tt'
let g:neoterm_autoinsert = 1
let g:neoterm_size = 15
nnoremap <F12> :Ttoggle<CR>
inoremap <F12> <esc>:Ttoggle<CR>
tnoremap <F12> <C-\><C-n>:Ttoggle<CR>
tnoremap <esc> <C-\><C-n>
I still have the same issue with having my cursor in the right split, toggling term on & off, then my cursor moves to the left split
Currently I have F-12 mapped to :Ttoggle which is great for being able to jump back and forth, but sometimes I want to leave my terminal open and switch back to a buffer to edit. To get back to the term I either have to manually navigate to the term or hit F-12 twice to close and reopen the term. Am I missing something that should allow me to return to that term? I thought :Topen might jump back into the term if it is already open but that doesn't seem to be the case either
Is it possible to set a flag to have :Ttoggle check for an open term and if one is open switch back to it?