feat(vim): optional vim-style modal editing in the compose entry#543
Open
sypianski wants to merge 7 commits into
Open
feat(vim): optional vim-style modal editing in the compose entry#543sypianski wants to merge 7 commits into
sypianski wants to merge 7 commits into
Conversation
Add an optional vim mode to the message compose entry, toggled with
`vim_mode=1` in ui.conf. Implements a composable operator+motion engine
rather than hardcoding key combinations.
Engine (uimodel.cpp):
- Motions: h l 0 ^ $ w e b W E B, ( ) sentences, { } paragraphs,
j k gg G, f F t T find-char. Counts (3w, d3w, 2dd).
- Operators d c y composed with any motion; dd cc yy linewise; D C.
- Edit: x X, s S substitute, o O open-line, p P paste register.
- Visual mode (v) with reverse-video selection highlight, operators
act on [anchor, cursor].
- Insert/Normal/Visual modes; starts in insert; ESC to normal.
UI feedback:
- Status-bar badge NORMAL/INSERT/VISUAL with configurable colors
(vim_*_color_bg/fg, vim_*_attr in color.conf).
- DECSCUSR cursor shape: bar in insert, block in normal.
- Visual selection highlighted via second WordWrap pass for anchor
screen coords (reflow-correct).
- set_escdelay(25) to minimize bare-ESC lag on mode switch.
Config defaults added: vim_mode (ui.conf), vim_*_color/attr (color.conf).
Zero overhead when vim_mode=0 (VimKeyHandler early-returns to the
existing EntryKeyHandler).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add ui.conf option send_on_double_enter (default 0): when enabled, Enter inserts a newline and a second consecutive Enter sends the message (dropping the just-typed trailing newline). send_msg key binding is unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The status bar is now tinted by protocol (blue/green/magenta), so the vim mode badges (previously blue/green/magenta) blended in — INSERT on a Telegram (blue) chat was invisible. Switch badge defaults to white/yellow/red which contrast with all protocol hues. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Switch vim mode badges to the standard vim/airline scheme — NORMAL blue, INSERT green, VISUAL yellow — using bright variants so they stay distinct over the protocol-tinted status bar. Drop the protocol-colored INSERT badge. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds replace (r<char>), text-objects iw/aw/iW/aW/is/as/ip/ap and
quote/bracket variants (i"/a", i'/a', i\`/a\`, i(/a(/ib, i[/a[, i{/a{/iB,
i</a<) for c/d/y operators, ;/, to repeat last f/F/t/T, Y/J/~ commands,
linewise visual V, and . to repeat the last normal-mode mutation
(excludes change-class commands, which would require insert-mode replay).
- viw/vi"/vi( etc: i/a now works in visual mode to expand selection to text object (previously only worked after d/c/y operator) - ciw/ci"/ci( . repeat: c text-objects now record m_VimLast (was only d/y); VimRepeatLast gains case L'c' alongside d/y - C command now repeatable (sets m_VimLast, case L'C' in repeat) - p/P sync with system clipboard: yank writes to Clipboard::SetText, paste reads Clipboard::GetText() and updates m_VimRegister so text copied outside nchat is immediately available via p Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
New `describe` Python script calls OpenAI/Gemini/Ollama vision API with the selected message's attachment. Result is injected as an ephemeral local message directly below the image in the conversation history. Key binding: alt-u (describe_image). Configurable via describe_image_command in ui.conf. Supports same services as compose: openai (gpt-4o-mini), gemini (gemini-2.0-flash), ollama (llava), or any OpenAI-compatible endpoint. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
10 tasks
|
It seems to be working great. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #535.
What this adds
An optional vim modal editing mode for the message compose entry, enabled by setting
vim_mode=1in~/.config/nchat/ui.conf. Default is0— zero overhead, existing behaviour unchanged.Commands (normal mode)
h l 0 ^ $,w e b W E B,( )sentence,{ }paragraph,j k,gg G,f F t Td c y+ any motion;dd cc yy(linewise);D C Yiw aw is as ip ap i" a" i' a' i\a` i( a( i[ a[ i{ a{ i< a<`v→ character-wise selection;d c y x; visual text objects (viw,vi",vi(…)x X s S o O p P r ~ J3w,d3w,2dd, ….repeats last mutating op (including text-object changes:ciw.)p/Psync with system clipboard (X11/Wayland/macOS)Mode is shown as a colored badge in the status bar and the cursor changes shape (bar in insert, block in normal). Badge colors configurable via
color.conf(vim_normal_*/vim_insert_*/vim_visual_*).Other additions in this branch
send_on_double_enter=1inui.conf(default0): single Enter inserts newline, second consecutive Enter sendsTest plan
vim_mode=0(default): no behavioral change, no overheadvim_mode=1: ESC enters normal mode,i/a/A/Ireturns to insertd/c/y+ motion operates on correct range; register available viapciw,di",ya(operate correctlyvstarts selection,d/y/cacts on it;viwexpands to word.repeats last changeppastes text copied from outside nchat (clipboard sync)send_on_double_enter=1: double Enter sends, single Enter inserts newline