Standard TMUX is set to use ctrl-b + [up, down, left, right] when navigating between panes.
I would like to make it so that I can use ctrl-b (or the prefix of my choice) + [h,j,k,l].
I thought I had done this with the following vi key in my ~/.tmux.conf
settings:
set -g status-keys vi setw -g mode-keys vi
Yet this didn't seem to change anything (at least not what I was looking for). How can I get this to work. And yes my .tmux.conf
is working properly. I can provide more info if needed.
Update:
Here is my full .tmux.conf after trying to get it to work:
set -g status-keys vi setw -g mode-keys vi set -g prefix C-a unbind C-b bind C-a send-prefix # smart pane switching with awareness of vim splits bind h select-pane -L bind j select-pane -D bind k select-pane -U bind l select-pane -R
Alternatively, I have tried using this w/ vim-tmux-navigator Vim plugin:
# smart pane switching with awareness of vim splits bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L" bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D" bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U" bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R" bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l"
source
Which also doesn't work either. I am a bit stumped.
Tmux uses the keybinding 'Prefix' followed by 'Ctrl+o' to cycle around the panes. When you use this key-binding for the first time, it moves the pane in one position clockwise.
Ctrl+b, let go of Ctrl, Letf / Right / Up / Down will switch active panes.
A tmux pane is the entity that we actually use to run commands, scripts, and processes, such as ssh, backup, vim, htop, and what have you. Technically, they are pseudoterminals encapsulating shells, like Zsh or Bash. In other words, they are terminals within a terminal.
In order to resize tmux panes, you first hit your tmux prefix ( ctrl + b is the default one. Mine is ctrl + a .), and then the colon key : . This brings up a tmux command mode prompt at the bottom of your screen. All done!
You can do this as follows:
bind h select-pane -L bind j select-pane -D bind k select-pane -U bind l select-pane -R
Note that mode-keys
refers to using vi-like navigation within a buffer and status-keys
refers to using vi-like editing within the status bar, but neither refers to switching between panes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With