Summary
Per CONTRIBUTING ("suggest your change in an issue first"), I'd like to gauge whether an optional vim-style modal editing mode for the message compose entry fits the project scope before proposing it for merge.
Motivation
Users with vim muscle memory (and keyboard layouts that reserve Alt for diacritics, making the default Alt-based entry shortcuts unusable) would benefit from modal editing in the compose box.
Proposal
A single ui.conf option vim_mode (default 0 → no behavioral change, zero overhead). When enabled:
- Modes: insert / normal / visual; entry starts in insert,
Esc → normal.
- Composable operator + motion engine (not hardcoded combos):
- Motions:
h l 0 ^ $, w e b W E B, ( ) sentence, { } paragraph, j k, gg G, f F t T.
- Operators
d c y × any motion; dd cc yy; D C.
- Edit:
x X, s S, o O, p P; counts (3w, d3w, 2dd).
- Visual mode with reverse-video selection highlight.
- Feedback: status-bar mode badge (colors configurable in
color.conf) + DECSCUSR cursor shape (bar/block). set_escdelay(25) to keep ESC snappy.
When vim_mode=0, the new key handler early-returns to the existing EntryKeyHandler — no change for existing users.
Implementation
A working implementation is on a branch (touches uimodel, uientryview, uistatusview, uiconfig, uicolorconfig, ui; ~850 lines, formatted with make.sh src/uncrustify, builds clean):
https://github.com/sypianski/nchat/tree/feature/vim-mode
Happy to open a PR if this fits the project scope, or to adjust the surface (e.g. command subset, config naming) per your preference.
Known limitations (v1)
- Visual mode has no named registers; single unnamed register only.
W/E/B currently alias w/e/b (no separate WORD class yet).
- Motions index raw wstring positions; wide-emoji (
EMOJI_PAD) edge cases not specially handled.
- No
. repeat / r replace yet.
Summary
Per CONTRIBUTING ("suggest your change in an issue first"), I'd like to gauge whether an optional vim-style modal editing mode for the message compose entry fits the project scope before proposing it for merge.
Motivation
Users with vim muscle memory (and keyboard layouts that reserve
Altfor diacritics, making the defaultAlt-based entry shortcuts unusable) would benefit from modal editing in the compose box.Proposal
A single
ui.confoptionvim_mode(default0→ no behavioral change, zero overhead). When enabled:Esc→ normal.h l 0 ^ $,w e b W E B,( )sentence,{ }paragraph,j k,gg G,f F t T.d c y× any motion;dd cc yy;D C.x X,s S,o O,p P; counts (3w,d3w,2dd).color.conf) +DECSCUSRcursor shape (bar/block).set_escdelay(25)to keep ESC snappy.When
vim_mode=0, the new key handler early-returns to the existingEntryKeyHandler— no change for existing users.Implementation
A working implementation is on a branch (touches
uimodel,uientryview,uistatusview,uiconfig,uicolorconfig,ui; ~850 lines, formatted withmake.sh src/uncrustify, builds clean):https://github.com/sypianski/nchat/tree/feature/vim-mode
Happy to open a PR if this fits the project scope, or to adjust the surface (e.g. command subset, config naming) per your preference.
Known limitations (v1)
W/E/Bcurrently aliasw/e/b(no separate WORD class yet).EMOJI_PAD) edge cases not specially handled..repeat /rreplace yet.