Skip to content

Instantly share code, notes, and snippets.

@mechanicker
Last active October 25, 2025 05:20
Show Gist options
  • Select an option

  • Save mechanicker/db64b7e29bc54857919951cd98d1a3d6 to your computer and use it in GitHub Desktop.

Select an option

Save mechanicker/db64b7e29bc54857919951cd98d1a3d6 to your computer and use it in GitHub Desktop.

Note

Darwin specific, uses pbcopy and pbpaste, try xclip on GNU/Linux

Missing Ghostty terminal (https://ghostty.org) scroll buffer search by mapping CTRL-f to search in terminal.

Assuming you use bash (might work with zsh too)

  • Put the following in ~/.bashrc to handle CTRL-f and invoke a script (helper)
# Ghostty does not offer scroll search
# Use CTRF-f to search via helper script
if [ -n "${GHOSTTY_RESOURCES_DIR}" ]; then
    bind -x '"\C-f": "ghostty.search"'
fi
  • CTRL-f key binding in Ghostty config in ~/.config/ghostty/config
keybind = unconsumed:ctrl+f=write_scrollback_file:copy
  • Copy the helper script as ghostty.search such that is in your PATH (mine is in ~/bin)
#!/bin/sh
# Helper to open history in 'less' on CTRL-f
#
# Symlink this script to somewhere in your PATH
# Ghostty config: keybind = unconsumed:ctrl+f=write_scrollback_file:copy
# Add in ~/.bashrc: bind -x '"\C-f": "ghostty.search"'

history=$(pbpaste)
echo | pbcopy

if [ -s "${history}" ]; then
    trap "rm \"${history}\"" EXIT
    less -+F "${history}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment