Skip to content

Latest commit

 

History

History

panes

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

fzf-tmux-pane

Using fzf to select the panes of tmux, like selecting buffer by using fzf in vim.

It's a alternative for choose-tree which is a native command of tmux.

Table of contents

Requirements

  1. bash
  2. fzf (at least 0.19.0 version)
  3. tmux (at least 3.0 version)

Features

  • Show resources of every pane's process
  • Combine multiple panes into a window
  • Order by Most Recently Used (MRU) panes
  • Join the current pane and the target pane
  • Swap the current pane and the target pane
  • Kill the target pane
  • Display the path of the current buffer of vim dynamically in fzf field of cmd
  • Display the current path of shell in fzf field of cmd
  • Select last pane across windows and sessions

Installation

  1. Install fzf-panes.tmux under the path where you like.
  2. Put these code inside your .tmux.conf.
set -s focus-events on

# replace ~/.local/bin/fzf-panes.tmux with fzf-panes.tmux under your PATH
if-shell '[ -f ~/.local/bin/fzf-panes.tmux ]' {
#   if you want to exclude specified session, please set @fzf_panes_ex_session_pat
#   for example, value equal to '^(floating)$', will exclude panes in session named 'floating':
#   set -g '@fzf_panes_ex_session_pat' '^(floating)$'
    set-hook -g pane-focus-in[10] \
    "run -b 'bash ~/.local/bin/fzf-panes.tmux update_mru_pane_ids'"
    bind w run -b 'bash ~/.local/bin/fzf-panes.tmux new_window'
    bind \; run -b 'bash ~/.local/bin/fzf-panes.tmux select_last_pane'
} {
    set-hook -ug pane-focus-in[10]
    bind w choose-tree -Z
}
  1. If you want to display the path of the current buffer of vim dynamically in fzf's cmd field, you should set the vim option titlestring like this:
set title
set titlestring=%(%m%)%(%{expand(\"%:~\")}%)

The ps command only record startup command of vim, so I use title of vim to replace the argument of vim's cmd in ps.

Usage

  1. Using prefix+w to call the script in new window of tmux.
  2. Using prefix+; to select last pane across windows and sessions

Keymap for fzf

  • alt-p: toggle the preview for detail of the pane
  • alt-n: create new window
  • ctrl-r: reload the source of fzf
  • ctrl-x: kill the target pane
  • ctrl-v: join the current pane and the the target pane vertically
  • ctrl-s: join the current pane and the the target pane horizontally
  • ctrl-t: swap the current pane and the target pane

Limitation