I was trying to set up my key binding in tmux so that I can resize my panes without having to type the whole command. Currently I have it set up as:
bind-key -n S-Left resize-pane -L 1
bind-key -n S-Right resize-pane -R 1
bind-key -n S-Up resize-pane -U 1
bind-key -n S-Down resize-pane -D 1
however, that does not work for some reason. When I press shift left with not prefix it does not work (since thats what -n and S do). Does someone know what might be going wrong? My whole .tmux.conf
file is as follows:
# Force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf
#set-window-option -g mode-keys vi
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
#unbind %
bind | split-window -h
bind - split-window -v
# remap prefix to Control + a
unbind C-b
set -g prefix C-a
bind a send-prefix
# copy mode using vi
set-window-option mode-keys vi
bind-key -n S-Left resize-pane -L 1
bind-key -n S-Right resize-pane -R 1
bind-key -n S-Up resize-pane -U 1
bind-key -n S-Down resize-pane -D 1
I actually tried a new thing and I tried executing one of those commands sperately on the tmux command line. To get there I pressed prefix and then :
. Then I typed the command:
bind-key -n S-Up resize-pane -U 1
which did work. Now Shift up with no prefix resizes the pane. But for some reason the tmux config file is not being sourced...right? Not sure what might it be.
It seems it works now after I added:
source ~/.tmux.conf
at the end of the file. However, it feels like a super hacky solution. Anyone know why I need to do such a silly command in the tmux config file?