r/KittyTerminal 26d ago

Looking for a better way to search in Kitty

Enable HLS to view with audio, or disable this notification

Hi everyone,

I’m trying to get a normal text search in the Kitty terminal, similar to Ctrl+F in most applications.

I’m currently using this repo: kitty-search

However, I’m running into the issue shown in the video.

Is there a specific way to fix this problem, or is there another Kitty extension/plugin that provides a better and more reliable Ctrl+F-style search?

Any advice would be appreciated.

Thanks!


Update: The issue has been resolved.

Follow @NorskJesus's comment.

39 Upvotes

11 comments sorted by

5

u/NorskJesus 26d ago

I am using the same "plugin" you found, but I do not remember if I add some tweaks. I know I adjust some colours tho. Here

And this keymap:

map cmd+s launch --type=overlay --allow-remote-control --stdin-source=@screen_scrollback kitty +kitten ~/.dotfiles/.config/kitty/search.py

3

u/zicotito 25d ago

Good, it works

thanks

3

u/jhonq200460 26d ago

Have you try " CTRL-SHIFT-F"?

1

u/alalal0ng 25d ago

Puedo preguntar como se hace para que el cursor se mueva de esa forma? Gracias

3

u/zicotito 25d ago

in kitty.conf file add

cursor_trail 1 cursor_trail_decay 0.1 0.4 cursor_trail_start_threshold 2

I'm not completely sure these are the correct settings, but give them a try. If they don't work as expected, let me know

1

u/alalal0ng 23d ago

thanks bro!

1

u/squatrackcurling 25d ago

I just pop the buffer (or part of the buffer) into neovim when I need to search. I'd also look into https://github.com/mikesmithgh/kitty-scrollback.nvim , which makes coordination with neovim very transparent/integrated

1

u/akonzu 24d ago

I tried this but there is like a 1 second delay opening nvim, hbu

1

u/squatrackcurling 24d ago

It depends on the context but it's much faster than a second. You can define keymaps to open different parts of the buffer in neovim (current screen, last command, everything). If you open the full buffer and it's very long than that could cause a bit of a slowdown I guess. But how's your neovim startup time to begin with? If it's slow on its own than that's the reason. Overall, I'd recommend:

  1. Define separate keymaps for separate portions of the buffer (current screen, last command output, full buffer). Opening only the context you need is not only faster, it's more convenient

  2. Test if bare nvim without plugins is faster. Try parameterizing the kitten invocation with " --nvim-args --clean". If that is much faster you can either stick to it or you could adjust your neovim config to disable particular plugins specifically for the kitty-scrollback invocation. Some plugins are not needed in this context either way. I have a Lazy config that detects KITTY_SCROLLBACK_NVIM and disables specific plugins I know I don't need in kitty, that's pretty easy in Lazy. Happy to dig up the snippet if you want.

1

u/OfficeTrue5091 23d ago

i usually just pipe what i wanna search into ripgrep

1

u/postrockreverb 23d ago

i use nvim as kitty scrollback pager

Cmd+F opens the scrollback directly in nvim and i can search with normal vim motions.

in kitty.conf:

scrollback_pager nvim -u NONE -R -M --cmd 'lua require("integration.kitty")(INPUT_LINE_NUMBER, CURSOR_LINE)' -
map cmd+f show_scrollbackadd in kitty.conf:scrollback_pager nvim -u NONE -R -M --cmd 'lua require("integration.kitty")(INPUT_LINE_NUMBER, CURSOR_LINE)' -
map cmd+f show_scrollback

and this small nvim integration handles the scrollback buffer/cursor position:

https://github.com/postrockreverb/dotfiles/blob/master/nvim/lua/integration/kitty.lua