emacs-tmux-pane icon indicating copy to clipboard operation
emacs-tmux-pane copied to clipboard

Fuse emacs windows with tmux panes.

#+TITLE: README

[[https://melpa.org/#/tmux-pane][file:https://melpa.org/packages/tmux-pane-badge.svg]]

  • About

This package is a port of [[https://github.com/christoomey/vim-tmux-navigator][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.

#+CAPTION: Tmux pane integration [[./screenshots/tmux-pane.png]]

  • Install Just install ~tmux-pane~ from ~melpa~.

  • Tmux configuration If you are using [[https://github.com/tmux-plugins/tpm][TPM]], add the following codes to your =~/.tmux.conf= #+BEGIN_SRC tmux set -g @plugin 'laishulu/emacs-tmux-pane' #+END_SRC

Without TPM, you can manually copy the content of file =tmux-pane.tmux= to your file =~/.tmux.conf=.

  • Usage 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
  • ~C-~: Last

** 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 latest 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 vertical pane).
  • ~tmux-pane-toggle-horizontal~: Open a horizontal tmux side pane, or close the latest tmux pane (not necessarily to be the horizontal pane).
  • ~tmux-pane-omni-window-up~ : Navigate to the up window of Emacs or tmux.
  • ~tmux-pane-omni-window-down~ : Navigate to the down window of Emacs or tmux.
  • ~tmux-pane-omni-window-left~ : Navigate to the left window of Emacs or tmux.
  • ~tmux-pane-omni-window-right~ : Navigate to the right window of Emacs or tmux.
  • ~tmux-pane-omni-window-last~ : Navigate to the last window of Emacs or tmux.

** 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

** Hooks

  • ~tmux-pane-before-leave-hook~ (Default: 25): Hook to run before leaving emacs to tmux.
  • ~tmux-pane-after-leave-hook~ (Default: 25): Hook to run after leaving emacs to tmux.
  • Example configuration for [[https://github.com/hlissner/doom-emacs][Doom Emacs]] #+BEGIN_SRC lisp (use-package! tmux-pane :config (tmux-pane-mode) (map! :leader (:prefix ("v" . "tmux pane") :desc "Open vpane" :nv "o" #'tmux-pane-open-vertical :desc "Open hpane" :nv "h" #'tmux-pane-open-horizontal :desc "Open hpane" :nv "s" #'tmux-pane-open-horizontal :desc "Open vpane" :nv "v" #'tmux-pane-open-vertical :desc "Close pane" :nv "c" #'tmux-pane-close :desc "Rerun last command" :nv "r" #'tmux-pane-rerun)) (map! :leader (:prefix "t" :desc "vpane" :nv "v" #'tmux-pane-toggle-vertical :desc "hpane" :nv "h" #'tmux-pane-toggle-horizontal))) #+END_SRC