-
Notifications
You must be signed in to change notification settings - Fork 4
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
Allow setting of keybindings for moving between visual lines in soft wrapped mode. #24
Comments
@NiamhFerns thanks for your feedback. So that's not quite right - currently I'm not sure of the best practices for using Colemak with Vim/NeoVim, so happy to take some advice on that, but I don't think Also, I'm not sure I 100% understand your reference to visual mode? |
That makes sense. If it just remaps the up down keys then that doesn't really need to be corrected for colemak (or any keyboard for that matter). As for whether it should rebind movement keys, it's something that would be nice but probably not worth the additional effort to add if it's not something that was already implemented. The visual mode reference was just a clumsy description of the lines on screen. Actual lines being the lines that are created by including a newline character and 'visual' lines being the lines you can see on your screen. 1. # This is a heading
2.
3. te ian ini enari i ie ni n iaresn n iten inaer i in iarns ne nairest n
ie i enair i earnisen nntieari isi airste earnst e narni seti earsitea
airestna nan erntnanriestenn iear. So the above would be 3 actual lines but 5 visual lines. For now I just have a function to toggle soft-wrap and then rebind the keys appropriately. That works for me for now. function SetWrapped()
vim.cmd([[
set wrap
set linebreak
]])
keymap("n", "n", "gj", noremap)
keymap("n", "e", "gk", noremap)
vim.opt.number = false
vim.opt.rnu = false
end
function UnsetWrapped()
vim.cmd([[
set nowrap
]])
keymap("n", "n", "j", noremap)
keymap("n", "e", "k", noremap)
vim.opt.number = true
vim.opt.rnu = true
end I'm happy to close for now and if someone else wants have this functionality as well they can reopen. |
@NiamhFerns I'm actually going to re-open this, as I think there are actually several useful capabilities you've highlighted which I could potentially add to
Incidentally, for your awareness, I think Vim calls what you are calling 'actual lines' just 'lines' and what you are calling 'visual lines' display lines. See |
Current Behaviour:
My current understanding is that when you set soft-wrapped mode, the keybindings for moving up and down lines (j, k) and moving between visual lines (gj, gk) are swapped so that (j, k) do visual lines and visa versa.
This doesn't work for if a user has rebound the H, J, K, L keybindings.
I use colemak for example, and these rebindings don't take place (or I'm somehow fundamentally misunderstanding that part of the plugin) because my movement keys are now on M, N, E, I.
Desired Behaviour:
I'd like it to default to switching (j, k) and (gj, gk) as normal, but allow an option in the settings for the plugin to say that I'd like my up and down keys in visual mode to be (n, e) instead of (j, k).
Then when enabling soft-mode wrapping those would be the bindings for moving visual lines and when disabling soft-mode wrapping, it would revert to what the bindings were before.
The text was updated successfully, but these errors were encountered: