laktak / extrakto

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

Idea: one key binding to rule them all (well, two) #2

Closed maximbaz closed 7 years ago

maximbaz commented 7 years ago

Instead of having type Prefix, Shift+X, u/U/p/P, how about the following:

Typing just Prefix, Shift+X opens a fzf with all potential candidates: files, urls, paths, whatever. It is so easy to filter in fzf, that I think it is an overkill to have different modes.

We could have just two shortcuts:

No need to write one single super-complex regex, let's have multiple regexes (one for urls, one for paths, etc.) and just run them all one by one, and combine their results in fzf window.

laktak commented 7 years ago

That's a great idea! I'm all for reducing the keystrokes I have to type ;)

Only x is already used: bind-key -T prefix x confirm-before -p "kill-pane #P? (y/n)" kill-pane

maximbaz commented 7 years ago

That's true. Prefix, e/E don't seem to be used, how about these for defaults? Can be remembered for Extrakto 🙂

Long term you could make these two shortcuts configurable, see here for an example.

laktak commented 7 years ago

I implemented your idea and also added extract for everything with prefix + tab. Thanks again! I've been using it all day as it works like command completion on remote ssh sessions without having to install anything. Let me know if you find it useful.

maximbaz commented 7 years ago

Looking good, thanks! I'm a little surprised to find that Prefix, Tab and Prefix, e discover different results now - I'm curious why did you do it like this?

laktak commented 7 years ago

I use Prefix+Tab like complete to insert everything from the buffer (like docker container names etc). With Prefix+e I usually want to copy something specific like an url.

If that is unintuitive I should probably make tab and e behave the same way.

maximbaz commented 7 years ago

I wouldn't mind being able to copy everything from the buffer, the first example that comes to mind is copying a git branch name to share with someone, and today I can find the branch name with Prefix, Tab but not with Prefix, e.

But maybe that is even better, the regex that you have for Prefix, Tab is simpler, maybe that is the only regex that we need?

laktak commented 7 years ago

I've made tab and e the same. If it turns out subotimal we can think of alternatives later.

maximbaz commented 7 years ago

Thanks! I tested, everything seem to work perfectly. I'll close the issue, and I'll be using the plugin over the next days to see how I like it, and like you said, if anyone feels it is suboptimal, lets discuss in a new thread!

laktak commented 7 years ago

@maximbaz I've added options as well.

laktak commented 7 years ago

@maximbaz @ivanalejandro0 I now managed to put all the options behind a single keybinding. Please let me know if it works for you.

maximbaz commented 7 years ago

This is really awesome! I have one tiny comment for you, and there's a bug with Ctrl+f toggling. When the pane has no URLs or file path, the toggling exits fzf. Better see a video, this is me pressing Ctrl+f twice, after the second press fzf exits. It doesn't reproduce when there is at least one URL or file path in the pane though.

extrakto_double_ctrl_f

laktak commented 7 years ago

Thanks for the video! Not sure why fzf didn't return 0 in that case - I only handle the selected keys now so that should fix it.

maximbaz commented 7 years ago

Confirmed, the bug is fixed - I guess you can close this ticket again 😄 I didn't even know that fzf allows to handle multiple selection keys differently, really useful - great finding!

Looking forward to #8 now, one last item to make this plugin absolutely perfect 🙏

laktak commented 7 years ago

Right! ;)

ivanalejandro0 commented 7 years ago

I'm late to the party... this is really cool! I like the changes :smile: