-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
feat(defaults): window navigation key maps #33696
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
base: master
Are you sure you want to change the base?
Conversation
vim.keymap.set({ 't', 'i' }, '<A-h>', '<C-\\><C-n><C-w>h', { desc = 'Move to left window' }) | ||
vim.keymap.set({ 't', 'i' }, '<A-j>', '<C-\\><C-n><C-w>j', { desc = 'Move to down window' }) | ||
vim.keymap.set({ 't', 'i' }, '<A-k>', '<C-\\><C-n><C-w>k', { desc = 'Move to up window' }) | ||
vim.keymap.set({ 't', 'i' }, '<A-l>', '<C-\\><C-n><C-w>l', { desc = 'Move to right window' }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think mapping these in Terminal mode is a good idea, as it'll prevent using these keys in applications running inside terminal buffers. Switching window in Insert mode probably shouldn't be encouraged either, so maybe only map these in Normal mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switching window in Insert mode probably shouldn't be encouraged either, so maybe only map these in Normal mode?
Probably shouldn't map in Normal mode as well, because it doesn't help with discoverability, since Nvim still doesn't have which-key
, and neither does folke/which-key.nvim
nor echasnovski/mini.clue
work with <A-
mapping, but they all work with normal mode <C-w>
commands
This comment was marked as resolved.
This comment was marked as resolved.
|
This comment was marked as resolved.
This comment was marked as resolved.
Not a core contributor so I dont know if my opinion counts for anything. I request to please not map things to Alt as default. Alt+[key] can and will conflict with many OS/desktop-environment/Window-manager defaults for many of us. Having to unmap new nvim defaults for just this reason is a bit much. Also, while its true that most people map the terminal mode keys to something of their choosing, why not just let it be example in docs and/or suggested minimal_init.lua, why enforce it? |
Why aren't you using super ("Windows" key) for that? It is a good choice for that. We need a common chord prefix for window-related commands. There are many more similar commands that could use this common chord, such as ALT-n for
To unblock this, I'm in favor of some sort of option like |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
I think that's only a problem if you run Zellij inside Nvim terminal? If you run Nvim inside Zellij, key sequences have to go through Zellij first, don't they?
What about vim.keymap.set({ 'n', 'i' }, '<M-w>', '<Plug>(nvim-window-prefix)') instead of setting |
Saying + HJKL is "not ergonomic" is like saying something is overrated. That key combo has been the standard since the dinosaurs use Vim. It’s part of the Vim tradition: consistent, easy to remember, and extremely well-documented. |
Your window manager, terminal emulator, and Zellij will all "see" the key presses before Neovim ever does, so you wouldn't need to unmap anything. The Alt prefixed key sequence would only reach Neovim if it wasn't first consumed by another application. |
Didn't think about this, so it isn’t a big deal then. |
It opens up an entire set of window/layout-related keymappings, like I already mentioned. There are 10-15 mappings that I will propose, probably more. |
So that objection is unblocked. And as @brianhuster mentioned, defining these with a |
Problem: default + HJKL is not an ergonomic way to navigate split windows
Solution: set default mappings to navigate with alt/option + HJKL
Context: Following this comment