sainnhe / tmux-fzf

Use fzf to manage your tmux work environment!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to shortcut menu

maxigit opened this issue · comments

commented

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 ?

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.

commented

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!

@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

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

@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"

@zhengpd It works.
Thanks so much!

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.

I'm seeing exactly the same as @shihabdider.