voldikss / vim-floaterm

:computer: Terminal manager for (neo)vim
MIT License
2.5k stars 80 forks source link

how to focus non-popup window when a floaterm instance has been opend? #286

Open D0ot opened 3 years ago

D0ot commented 3 years ago

Just like the effect in README: Alt text

alacine commented 3 years ago

You can use <C-\><C-n> to go to normal mode, and then use <C-w>w to focus on different windows. This will work for both vim and neovim.

I have tried <C-w>N in default :terminal in vim, this could also bring you back to normal mode, but it's not work in neovim.

The instruction of keymap is also mentioned what are <Fn>s mapping for.

shaeinst commented 3 years ago

map <Esc> with <c-\><c-n> like below

tmap <Esc> <c-\><c-n>                            --for vim
vim.cmd([[ tmap <Esc> <c-\><c-n> ]])             --for neovim

now you can press ESC and do things as you do in normal mode, for example, you can press <C-w><C-w> and it will do what you asked in question

9mm commented 1 year ago

Is there a way to get a window to not ever lose focus?

For example in lazygit, i never want the cursor to leave the window. that way i dont press the wrong key on accident and have to do C-wC-w

9mm commented 1 year ago

I found out its from moving the mouse simply OUTSIDE the window. I made an issue about it

https://github.com/voldikss/vim-floaterm/issues/417

Do you know if theres a way to turn this off?

lemusthelroy commented 7 months ago

I went a step further in my Neovim setup to close my window each time I hit escape:

vim.cmd([[ tmap <Esc> <c-\><c-n> :FloatermToggle<CR> ]])