Repository navigation
Feature proposal: vim-style j/k navigation mode (vim-nav)
#2279
jaehho
started this conversation in
Ideas/Feature Requests
Replies: 1 comment
|
I am not sure how we can make a good vim mode. As an avid vim user, the above solution to me feels confusing. how 'in vim style' do I navigate columns in list view, as jk does rows (so hl should be columns).. But then how do I move the cursor in the entry box? (also hl? in the weird combined mode we have now?).. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Rofi version: 2.0.0-dev (next branch, wayland backend)
Context
Vim-style
j/klist navigation has come up a few times — #972, a comment on #73 requested hjkl over Ctrl+n/Ctrl+p, and #1324 tried remapping Ctrl+j/Ctrl+k. I tried a workaround by bindingj/ktokb-row-up/kb-row-downbut that permanently captures those keys, making them unusable in the filter input. I can't find a way to have them do both depending on context without changing the source code.Proposed solution
A new boolean config option
vim-nav(defaultfalse) that makesj/kcontext-sensitive:j/knavigate the listj/ktype normally into the filter/keybind → enters insert mode (j/k type even with empty input, for searches starting with j or k)Implementation
The change is ~60 lines across 5 files, gated entirely behind the config flag. It works by conditionally rejecting
j/kbindings inbinding_check_action— when rejected,nk_bindingsfalls through to normal text output. No changes to the binding library or input pipeline.include/keyb.h— addVIM_NAV_INSERTaction + getter/setterinclude/settings.h— addvim_navbooleansource/keyb.c— conditional check inbinding_check_action,/binding, insert mode flagsource/view.c— handleVIM_NAV_INSERTaction, reset insert mode on empty inputsource/xrmoptions.c— register config optionWorking implementation: https://github.com/jaehho/rofi/commit/f9a019b
All reactions