laktak / extrakto

extrakto for tmux - quickly select, copy/insert/complete text without a mouse
MIT License
878 stars 45 forks source link

Added `Ctrl-S` to search for selected text #24

Closed IngoMeyer441 closed 6 years ago

IngoMeyer441 commented 6 years ago

With this feature extrakto can be used to search for a first word of sentence (for example a commit message) and to quickly select the rest of this sentence in copy-mode afterwards.

laktak commented 6 years ago

Hi and thanks for your PR!

I'm not sure how useful this would be - but when I wanted to test it, it doesn't quite work for me.

For example I have this output (from git diff) at the bottom:

     ctrl-l)
       # cycle between options like this: recent -> full -> custom (if any)-> recent ...
       if [[ $grab_area == "recent" ]]; then

but when I select recent and then press ctrl-s the cursor is already above the three matches on a line without a match.

IngoMeyer441 commented 6 years ago

Ah, I can reproduce the problem you describe. The tmux cursor is placed on screen before fzf exits but afterwards the cursor position is not updated. You can only press n (vi-bindings) to position the cursor correctly (on the next match however). Currently I don't know how to fix that. 😞

laktak commented 6 years ago

I guess you would have to run it in the background with a small delay (see tmux run-shell -b ...) so it can execute your commands after the extrakto pane is closed. You'd also need to substitute -t ! with a real id.

Or report this as a bug to tmux ...?

maximbaz commented 6 years ago

I have a personal feeling that this doesn't fit into extrakto... You open a fzf window, type something, and then ignore whatever you had filtered in fzf and just trigger a search in the pane? Why did extrakto even bother capturing the pane contents and filtering it based on your input then? Having fzf window is just a waste of space.

In short, with this ctrl-s you are not extracting anything 😉

I recommend to keep using tmux-copycat for searching functionality, it has recently been fixed and works great with the latest tmux, it serves exactly this purpose, and besides all I mentioned it has one more important functionality - n/N buttons to jump to next/previous match!

laktak commented 6 years ago

I agree that it wouldn't make a lot of sense to add this here when it is better handled by another plugin. But thank you for your input @IngoHeimbach!