Skip to content

graemedavidson/tmux-pane-focus

Repository files navigation

tmux pane focus

codecov

Tmux plugin to auto resize panes on focus similar to nvim Focus.

Utilises tmux hooks to react to the creation and selection of panes.

  • Size: >=50, <100.
  • Direction:
    • +: both
    • |: width changes only
    • -: height changes only

Plugin still in an alpha stage. Currently testing locally to confirm features and find bugs. A refactor is coming as currently not in a DRY state with a lack of naming clarity and commenting hindering contributing. Feel free to use though and open an issue or start a discussion.

Installation

Tmux Plugin Manager

Add plugin GitHub url to list of tpm plugins. Specify tag/branch for specific version.

set -g @plugin 'graemedavidson/tmux-pane-focus'
# set -g @plugin 'graemedavidson/tmux-pane-focus#tag'

Manual

Clone repo into tmux plugins dir.

Add run shell command to end of .tmux.conf file to activate plugin.

run-shell '~/.tmux/plugins/tmux-pane-focus/focus.tmux'

Configuration

Enable/Disable plugin:

set -g @pane-focus-size on

Add configuration to the .tmux.conf file to override the following defaults:

  • focus size: 50%
  • focus direction: +
set -g @pane-focus-size '50'
set -g @pane-focus-direction '+'

Settings Menu

The default and global settings can be overridden at the window level through an options menu.

tmux shortcut: ctrl-a T.

Status bar

Add current active size and direction to status bar:

set -g status-right '#[fg=colour255,bg=colour237][#{@pane-focus-direction}][#{@pane-focus-size}]#[fg=default,bg=default]'