- there is the concept of a trigger in tmux; a key combo that allows you to follow up with other keys to do some tmux specific stuff
- the default trigger is ctrl+b; this is awkward for some people so they use ctrl+a (I do this)
- hitting ctrl+b followed by : will let you go into a mode similar to the vim command mode (where you can type out some commands)
- open a new tab
- trigger (ctrl+b) followed by c
- c stands for create
- go to next tab
- trigger (ctrl+b) followed by n (for next)
- go to previous tab
- trigger (ctrl+b) followed by p (for previous)
- idk how to do this without my mappings so here are some mappings you can put in your tmux.conf:
# opening new splits
bind-key v split-window -h
bind-key h split-window -v
This means that hitting the trigger (ctrl+b) followed by v will open a vertical split; ditto for h and horizontal split
- I use a plugin so that I can hit ctrl+vim direction to jump between vim panes and tmux splits seamlessly (would highly recommend)
- I assume you use a vim plugin manager like vundle or vim-plug so follow the instructions https://github.com/christoomey/vim-tmux-navigator from the vim side
- You also need to add this to your tmux.conf or use the TPM plugin (like in the link above)
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
bind-key -T copy-mode-vi C-h select-pane -L
bind-key -T copy-mode-vi C-j select-pane -D
bind-key -T copy-mode-vi C-k select-pane -U
bind-key -T copy-mode-vi C-l select-pane -R
bind-key -T copy-mode-vi C-\ select-pane -l