feat(search): highlight and navigate scrollback matches in place

Searching the scrollback used to replace the whole screen with an external pager, losing the surrounding context. Highlight every match with a marker instead, show the [current/total] counter and provide temporary n/N/Escape bindings, restoring the previous marker and title when the search ends.
This commit is contained in:
BlackAngelTV authored and BlackAngelTV committed 2026-11-25 20:25:36 +01:00
1 parent 1d6911c476
commit 5f232ff99c
5 files changed
+342

No files matched your search

+15
View File
@@ -4157,6 +4157,21 @@ For more sophisticated control, such as using the current selection, use :ac:`re
map('Search the scrollback within a pager', 'search_scrollback --allow-fallback=shifted,ascii cmd+f search_scrollback', only='macos')
map(
'Search and highlight the scrollback in place',
'search_scrollback_prompt kitty_mod+shift+f search_scrollback_prompt',
long_text="""
Search the scrollback without opening a pager. Every match is highlighted in
the scrollback and the ``[current/total]`` counter is shown in the window title.
Prefix the query with ``\\c`` to match case sensitively and with ``\\r`` to use
a regular expression. While a search is active, :kbd:`n` and :kbd:`N` jump to
the next and previous match and :kbd:`Escape` ends the search.
The :ac:`scrollback_search_next`, :ac:`scrollback_search_prev` and
:ac:`clear_scrollback_search` actions can be mapped to other keys.
""",
)
egr() # }}}
+2
View File
@@ -936,6 +936,8 @@ defaults.map = [
KeyDefinition(trigger=SingleKey(mods=256, key=103), options=KeyMapOptions(when_focus_on='', new_mode='', mode='', on_unknown='beep', on_action='keep', timeout=None, allow_fallback=(KeyFallbackType.shifted, KeyFallbackType.alternate)), definition='show_last_command_output'),
# search_scrollback
KeyDefinition(trigger=SingleKey(mods=256, key=47), definition='search_scrollback'),
# search_scrollback_prompt
KeyDefinition(trigger=SingleKey(mods=257, key=102), definition='search_scrollback_prompt'),
# new_window
KeyDefinition(trigger=SingleKey(mods=256, key=57345), definition='new_window'),
# new_os_window