Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: "Hints" mode to select and act on arbitrary text patterns visible in the terminal #2012

Closed
rmacklin opened this issue Jul 29, 2024 · 1 comment

Comments

@rmacklin
Copy link

rmacklin commented Jul 29, 2024

This feature has previously been mentioned in #189 - one of the comments there figured that issue would be a prerequisite, but Mitchell confirmed on Discord that it's not. Thus, I'm opening this separate issue for it (encouraged by Mitchell's desire to "hear more use cases/requests"). I personally don't have much need for the search scrollback feature, but I would have a hard time giving up kitty's hints feature.

For those who aren't familiar with kitty's hints feature, the corresponding documentation is at https://sw.kovidgoyal.net/kitty/kittens/hints/ (which also links to its source code). From the intro:

kitty has a hints mode to select and act on arbitrary text snippets currently visible on the screen. For example, you can press ctrl+shift+e to choose any URL visible on the screen and then open it using your default web browser.

Similarly, you can press ctrl+shift+p>f to select anything that looks like a path or filename and then insert it into the terminal, very useful for picking files from the output of a git or ls command and adding them to the command line for the next command.

Those are just a couple examples, but through its flexible options you can go further. I don't leverage all the options, but I do use that second example practically on a daily basis, along with the similar kitty_mod+p>h shortcut to select a hash, which is very useful when working with git commands. I also use kitty_mod+p>w to select words, though not quite as often. In addition to the shortcuts for inserting the selection into the terminal at my current cursor position, I also have mappings to copy each of these types of text to the clipboard (so I can paste them in e.g. a GitHub comment, Slack message, etc.).


FWIW, here are the relevant quotes from the comments in #189:

@ferdinandyb:

But why I actually wanted to comment is related to generic search, but a bit more specific: sometimes you actually see what you need on screen, but want to quickly copy/paste/execute it without a mouse. Back when I was using kitty I used hints a lot

@sluongng:

I wanted to file a feature request for something like Kitty Hints

@rmacklin
Copy link
Author

rmacklin commented Aug 4, 2024

On Discord someone mentioned WezTerm also has a "quick select mode" and said:

I tend to have to copy a lot of ips or hostnames to ssh into from output from scripts so if i could quickly copy those to use

I figured it would be useful to add a link the corresponding WezTerm docs in this issue - here they are: https://wezfurlong.org/wezterm/quickselect.html

I haven't used it myself, but it seems pretty similar to kitty's hints mode. One difference appears to be that the default action is to copy the selection to the clipboard while the action to insert it at the current terminal cursor (i.e. copy and paste the selection, as described in the docs) is achieved by typing the uppercase form of the prefix. In kitty, the --program flag can be configured in more general/flexible ways: in addition to inserting the selection, it can also copy to the clipboard or to a specified buffer, or run the default open program, or launch a specific program in a new kitty tab, window, overlay, etc. That said, I do think WezTerm has the two most common use cases covered.

Edit: It also seems like WezTerm matches all of the configured quick_select_patterns, whereas in kitty you usually filter to a specific kind of pattern like a hash or a file path, since you typically only want to insert a specific type of string at a particular time. But maybe this is possible in WezTerm despite my reading of their docs. Anyway, for Ghostty, I'd vote for making it possible to select a specific type. (If you know you want to select a hash and there are only a few hashes displayed but lots of other matches like file paths, highlighting only hash strings will result in fewer matches/less noise on the screen/shorter prefixes to type.)

@ghostty-org ghostty-org locked and limited conversation to collaborators Oct 6, 2024
@mitchellh mitchellh converted this issue into discussion #2394 Oct 6, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants