README
About
This package is a port of vim-tmux-navigator. It provide integration between emacs windows and tmux panes. Note those tmux panes need not to be created by this package. Tmux panes created in any approach are supported.
Usage
The package is named as tmux-pane
.
Seamlessly navigate between emacs window and tmux pane
A global minor mode tmux-pane-mode
(disabled by default) is provided.
Default key map:
C-k
: Up
C-j
: Down
C-h
: Left
C-l
: Right
For the default key map, the following codes should be added to ~/.tmux.conf
# Smart pane switching with awareness of vim splits
is_vim_emacs='echo "#{pane_current_command}" | \
grep -iqE "((^|\/)g?(view|n?vim?x?)(diff)?$)|emacs"'
# enable in root key table
bind -n C-h if-shell "$is_vim_emacs" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim_emacs" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim_emacs" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim_emacs" "send-keys C-l" "select-pane -R"
bind -n C-\ if-shell "$is_vim_emacs" "send-keys C-\\" "select-pane -l"
# enable in copy mode key table
bind -Tcopy-mode-vi C-h if-shell "$is_vim_emacs" "send-keys C-h" "select-pane -L"
bind -Tcopy-mode-vi C-j if-shell "$is_vim_emacs" "send-keys C-j" "select-pane -D"
bind -Tcopy-mode-vi C-k if-shell "$is_vim_emacs" "send-keys C-k" "select-pane -U"
bind -Tcopy-mode-vi C-l if-shell "$is_vim_emacs" "send-keys C-l" "select-pane -R"
bind -Tcopy-mode-vi C-\ if-shell "$is_vim_emacs" "send-keys C-\\" "select-pane -l"
Manipulate tmux side pane
Commands
tmux-pane-open-vertical
: Open a vertical tmux side pane at right
tmux-pane-open-horizontal
: Open a vertical tmux side pane at below
tmux-pane-close
: Close the lastest tmux side pane if possible
tmux-pane-rerun
: Rerun the latest command in the latest tmux pane
tmux-pane-toggle-vertical
: Open a vertical tmux side pane,
or close the latest tmux pane (not necessarily to be the vertial pane).
tmux-pane-toggle-horizontal
: Open a horizontal tmux side pane,
or close the latest tmux pane (not necessarily to be the horizontal pane).
Variables
The following two variable can be customized
tmux-pane-vertical-percent
(Default: 25): Width percentage of the vertical
side pane to the whole tmux window
tmux-pane-vertical-percent
(Default: 25): Height percentage of the horizontal
side pane to the whole tmux window