laishulu / emacs-tmux-pane

Fuse emacs windows with tmux panes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

README

https://melpa.org/packages/tmux-pane-badge.svg

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.

./screenshots/tmux-pane.png

Install

Just install tmux-pane from melpa.

Tmux configuration

If you are using TPM, add the following codes to your ~/.tmux.conf

set -g @plugin 'laishulu/emacs-tmux-pane'

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 Doom Emacs

(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)))

About

Fuse emacs windows with tmux panes.

License:GNU General Public License v3.0


Languages

Language:Emacs Lisp 80.0%Language:Shell 20.0%