LunarVim / Neovim-from-scratch

📚 A Neovim config designed from scratch to be understandable
https://www.chrisatmachine.com/
GNU General Public License v3.0
5.42k stars 1.17k forks source link

I can not understand terminal navigations keymaps #324

Open mohamadiarch opened 12 months ago

mohamadiarch commented 12 months ago

The file keymaps.lua contains these codes:

keymap("t", "<C-h>", "<C-\\><C-N><C-w>h", term_opts)
keymap("t", "<C-j>", "<C-\\><C-N><C-w>j", term_opts)
keymap("t", "<C-k>", "<C-\\><C-N><C-w>k", term_opts)
keymap("t", "<C-l>", "<C-\\><C-N><C-w>l", term_opts)

I am using neovim-qt in Windows and I think these keymaps are the same and just take me to normal mode and nothing more. Are they related to terminal navigation? I`m confused....

FrostyNick commented 11 months ago

I'm on Linux with nvim v0.9.0 and tried it in my own config.

What is supposed to be happening is while in terminal, you exit to normal mode <C-\\><C-N>. Then, switch a window in hjkl direction <C-w>l which doesn't seem to do anything.

In my config I was able to add a sleep in between both actions to fix this issue in a similar scenario. Haven't had luck doing that here (I haven't tried with [[ ]] maybe that would fix this; written differently since [[ ]] strings work differently.)

Notes for example below:

Window change doesn't work:

vim.keymap.set("n", "<leader>zo", [[:SymbolsOutline<CR><C-w><C-w><CR>]])

Window change works:

vim.keymap.set("n", "<leader>zo", [[:SymbolsOutline<CR>:sl! 100m<CR><C-w><C-w><CR>]])