Skip to content
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

How to shortcut menu #6

Closed
maxigit opened this issue Jan 27, 2020 · 11 comments
Closed

How to shortcut menu #6

maxigit opened this issue Jan 27, 2020 · 11 comments

Comments

@maxigit
Copy link

maxigit commented Jan 27, 2020

I've just installed this plugin and it looks great.
However, I was wondering, is there a way to do preselect options so I can create a key binding which for example allow me to attach a session without having to select session and then attach ?

@sainnhe
Copy link
Owner

sainnhe commented Jan 27, 2020

This is a good idea, this feature is supported via 09e5e0b.

Preselect session, window or pane

Simply bind a key to execute the shell script

bind-key "C-l" run-shell -b "/home/sainnhe/.tmux/plugins/tmux-fzf/scripts/session.sh"

All available shell scripts can be found in /path/to/tmux-fzf/scripts.

Preselect action

Pass a parameter to the shell script:

bind-key "C-l" run-shell -b "/home/sainnhe/.tmux/plugins/tmux-fzf/scripts/session.sh attach"

Will execute attach session.

Available actions:

  • scripts/session.sh: attach, detach, rename, kill
  • scripts/window.sh: switch, link, move, swap, rename, kill
  • scripts/pane.sh: switch, break, join, swap, layout, kill, resize
  • scripts/clipboard.sh: system, buffer
  • scripts/process.sh: display, tree, terminate, kill, interrupt, continue, stop, quit, hangup

Add frequently used actions to the user menu

For example, in ~/.tmux.conf:

TMUX_FZF_MENU=\
"attach session\n/home/sainnhe/.tmux/plugins/tmux-fzf/scripts/session.sh attach\n"\
"rename window\n/home/sainnhe/.tmux/plugins/tmux-fzf/scripts/window.sh rename\n"

will add attach session and rename window to the user menu.

@maxigit
Copy link
Author

maxigit commented Jan 27, 2020

Brilliant!
I add a binding to switch to any window (which is great because it allows to change session if needed) and it works perfectly. Many thanks!

@you-n-g
Copy link

you-n-g commented Aug 3, 2021

@sainnhe It looks great!
I think it would be better if we could strip the time of the session list (Rarely people will select a session by time).
image

Thanks

@zhengpd
Copy link

zhengpd commented Aug 19, 2021

I think this should be added to the README. It's really helpful.

@zhengpd
Copy link

zhengpd commented Aug 19, 2021

@sainnhe It looks great!
I think it would be better if we could strip the time of the session list (Rarely people will select a session by time).

Thanks

@you-n-g You could hide the time with custom TMUX_FZF_SESSION_FORMAT="#{session_windows} windows"

@you-n-g
Copy link

you-n-g commented Aug 19, 2021

@zhengpd It works.
Thanks so much!

@shihabdider
Copy link

shihabdider commented Feb 1, 2024

I'm getting a weird error where the tmux-fzf menu will come up (to attach to a new session) but hitting on any of the entries doesn't actually switch to that session.

I put the following in my .tmux.conf:

bind-key "f" run-shell -b "~/.tmux/plugins/tmux-fzf/scripts/session.sh attach"

Hitting Prefix + f will bring up the menu and I can filter it, but it won't actually switch to the selected session once I hit enter. This is true even if I run the script manually on the command line (bash ~/.tmux/plugins/tmux-fzf/scripts/session.sh attach). Using the plugin normally via F and navigate to session -> switch, still works.

@SpyMachine
Copy link

I'm seeing exactly the same as @shihabdider.

@ramytanios
Copy link

@shihabdider I also have the same issue. Any solutions?

@shihabdider
Copy link

@ramytanios I just gave up on this plugin altogether because of this. I now use (the simpler, but working) https://github.com/siadat/session-finder

@tkamat
Copy link

tkamat commented Sep 23, 2024

@ramytanios use the new "switch" option instead of "attach" in the bind-key config:

bind-key "C-l" run-shell -b "/home/sainnhe/.tmux/plugins/tmux-fzf/scripts/session.sh attach"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants