thestinger / termite

Termite is obsoleted by Alacritty. Termite was a keyboard-centric VTE-based terminal, aimed at use within a window manager with tiling and/or tabbing support.
https://github.com/alacritty/alacritty
2.73k stars 240 forks source link

Feature Request: More regex patterns for hints #681

Closed shibumi closed 3 years ago

shibumi commented 5 years ago

Hi, I stumbled upon tmux-fingers. A really nice tmux plugin, that has a hint flag feature for several types of regexes. I thought about this a lot and I think it would be really cool if such features would be inside of termite: https://github.com/Morantron/tmux-fingers

What termite does already: It's possible to press [ctrl]+[shift]+[space] [x] to open the hint menu for URLs. Then it's possible to select an URL via hint and open it directly in the browser.

What I would like to have is: I type [ctrl]+[shift]+[space] [] and i get hints for more than just URLs:

File paths git SHAs numbers ( 4+ digits ) hex numbers IP addresses kubernetes resources UUIDs URLs

WloHu commented 4 years ago

I'm not termite dev. I will just throw some ideas how this can be done.

Beside using tmux in termite you can achieve this using search in selection mode and typing RegExp and then pressing n to move and y to copy. Obvious problem is that you don't have predefined RegExp to reuse in each search.

The easiest way to implement this idea is to add such RegExps into search completion through configuration file, which can be filtered by typing text in search input field.

Another approach would require to generalize how URLs are opened if you want to use hints for that; which IMO is less efficient because hints are limited to text which is visible in buffer. The general idea is to allow defining custom "hinting strategies" in triplets: trigger-key, regexp, action; which would be configurable through config. trigger-key would define either key binding (if you want to use it through shortcuts) or text (if it would be triggered by filtering defined hinting strategies). regexp would be predefined pattern used by strategy. action would be shell (?) command run on selected text like xdg-open {}.

Furthermore, 1st solution can be extended with triplet definition from 2nd solution to provide filter-able (in search input field) predefined RegExps which trigger action for example by using current o or new O key in selection mode. IMO this would be most convinient because it won't be limited to visible buffer text.

shibumi commented 4 years ago

@WloHu Can you specify how I add predefined RegExp to my termite config? Or is this just an idea? I am confused about what of your comment is already real and what is still fantasy :D

WloHu commented 4 years ago

Obvious problem is that you don't have predefined RegExp to reuse in each search.

My bad I should've written:

Obvious problem is that termite doesn't have predefined RegExp to reuse in each search.

shibumi commented 4 years ago

sad, would be cool to have them. Would be better than nothing :D

thestinger commented 3 years ago

Termite is obsolete. Please use Alacritty instead. See https://github.com/thestinger/termite#termite-is-obsoleted-by-alacritty for more details.