Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can not understand terminal navigations keymaps #324

Open
mohamadiarch opened this issue Nov 2, 2023 · 1 comment
Open

I can not understand terminal navigations keymaps #324

mohamadiarch opened this issue Nov 2, 2023 · 1 comment

Comments

@mohamadiarch
Copy link

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
Copy link

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:

  • Replace ":SymbolsOutline" with a plugin of your choice or a vim function, like :Vex (Vertical explorer). In this case, the window switches back to the previous window.
  • Must have at least v0.8.0 for vim.keymap to exist and work.

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>]])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants