Skip to content

Feat: Add caret mode for keyboard-driven navigation of the scrollback#12326

Open
brianc442 wants to merge 1 commit intoghostty-org:mainfrom
brianc442:caret-mode
Open

Feat: Add caret mode for keyboard-driven navigation of the scrollback#12326
brianc442 wants to merge 1 commit intoghostty-org:mainfrom
brianc442:caret-mode

Conversation

@brianc442
Copy link
Copy Markdown

Directly related discussions: #3708 #3488
Less directly related but still relevant discussions: #2394 #6916 #6917 #7672

The caret appears as a hollow block cursor. Vim hotkeys are used by default. The implementation is functionally the same as vim visual mode or the copy mode found in tmux & WezTerm. One notable deviation from vim visual mode is that pressing y to copy the selection does not exit caret mode - this was a deliberate design decision as exiting caret mode redraws the screen at the cursor which may not be desired if the user was copying something several pages up in the scrollback.

Written as an optional feature which is off by default. Requires a simple one line addition to the config file to create a keybind which activates caret mode:
e.g. keybind = alt+v=enter_caret_mode

The built in key table can be extended or overridden in ghostty/config (e.g. keybind = caret/w=...). All defaults can be cleared with keybind = caret/ if desired.

Default keybinds:
h/j/k/l or arrows: move caret
pg up/Ctrl+u/b: page up
pg dn/Ctrl+d/f: page down
gg/G: top/bottom of scrollback
0/$: beginning/end of line
/: search
n/N: search next/prev
v: toggle selection mode on/off (unlike vim, does not exit caret mode)
y: copy selection
Esc/q/i: exit caret mode

Code written with assistance from Claude Code. I reviewed, tested on Arch Linux, & ran the feature locally for ~1 month before submitting. It should work on macOS as well but I do not have a machine to test this.

Uses VIM hotkeys as the default. The implementation is functionally the same as vim visual mode or the copy mode found in tmux & WezTerm. Written as an optional feature which is off by default. Requires a simple one line addition to the config file to create a keybind which activates caret mode.
@brianc442 brianc442 marked this pull request as ready for review April 17, 2026 22:41
@brianc442 brianc442 requested review from a team as code owners April 17, 2026 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant