martanne / vis

A vi-like editor based on Plan 9's structural regular expressions
Other
4.25k stars 258 forks source link

Some VIS_ACTION_* may not depend on other keybindings #906

Closed andreafeletto closed 3 years ago

andreafeletto commented 3 years ago

When I disabled the arrow keys in NORMAL and INSERT mode (for self training purposes) I found out that in NORMAL mode <O> stopped working correctly. Looking at the code I saw that the function openline (to which <O> is bounded by default) relies on <Up> actually moving the cursor to the line above. Shouldn't basic commands like this be independent of keybindings, or is it intentional?

For reference, to disable the arrow keys I added the following to the INIT event in visrc.lua:

keys = {'<Left>', '<Right>', '<Up>', '<Down>'}
for _, key in ipairs(keys) do
    vis:map(vis.modes.NORMAL, key, '')
    vis:map(vis.modes.INSERT, key, '')
end
martanne commented 3 years ago

Hi, thanks for the report. This particular case should be fixed in 8c5205ad56f0bd76d3f9cd4a85eba9e01d071228. For now we still depend on <Escape> and <Enter>.