Kitty: Quickly open partial filenames in an editor

Created on 9 Jan 2020  路  7Comments  路  Source: kovidgoyal/kitty

I see there is a kitten Hints which helps in selecting the filenames that are in terminal.

Would it also be possible to quickly open those files in an editor.. something like what iterm3 supports Quickly open files

Most helpful comment

That change means only files with extensions will be matched, if you want to match the first number after a colon, rather than the last, the correct change is to put a ? after the first +

All 7 comments

Thanks for such a quick fix! One more request would be, instead of restricting the opening to only vim, could vim be the default and an option to configure the editor itself. For e.g. I use Sublime Text 3, instead of vim and I would like to open it using that.

There already is, read the docs accompanying the code.

My compilation errors also contains columns. For e.g.

./test.go:247:52: undefined: setPath

The {path} comes out as 247 and {line} as 52. Probably column field needs to be handled too.

Just to add, I see go shows the column number in case of compilation error. In case of run time crash or so, it shows only the file path and line number (the column is not available).

Then write your own matching code that does whatever you need, the hints
kitten is completely customizable: https://sw.kovidgoyal.net/kitty/kittens/hints.html#completely-customizing-the-matching-and-actions-of-the-kitten

Hi @kovidgoyal I found that if the regex in kitty commit is changed from

((?:\S*/\S+)|(?:\S+[.][a-zA-Z0-9]{2,7})):(\d+) regexr link showing the matches

to

(?:\S+[.][a-zA-Z0-9]{2,7}):(\d+) regexr link showing the matches

Then the jumping to the correct line is working.

The first one is using the last : as the line number. Instead the second option is using the entry after the first : as the line number. You can see it in the regexr links.

Do you think that is acceptable to change?

That change means only files with extensions will be matched, if you want to match the first number after a colon, rather than the last, the correct change is to put a ? after the first +

Was this page helpful?
0 / 5 - 0 ratings