Last active
December 20, 2024 17:07
-
-
Save eduardoarandah/6ab9a5c58a3fc67ac7f88e31e8a91b59 to your computer and use it in GitHub Desktop.
Tmux configuration to work nicely with vim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reload tmux config | |
bind r source-file ~/.tmux.conf | |
# one of these should work: | |
# set -g default-terminal tmux-256color | |
# set -g default-terminal xterm-256color | |
# neovim :checkhealth suggests | |
set -g default-terminal screen-256color | |
set-option -sa terminal-overrides ',xterm-256color:RGB' | |
# Automatically set window title | |
set-window-option -g automatic-rename on | |
set-option -g set-titles on | |
# Miscelaneous options | |
set-option -g xterm-keys on | |
set -g status-keys vi | |
setw -g mode-keys vi | |
set -g history-limit 10000 | |
setw -g monitor-activity on | |
set-option -g focus-events on | |
# mouse support | |
set -g mouse on | |
# No delay for escape key press | |
set -sg escape-time 0 | |
# Set prefix to Alt-w | |
set-option -g prefix M-w | |
# Split with same keys as vim | |
bind-key v split-window -h -c "#{pane_current_path}" | |
bind-key s split-window -v -c "#{pane_current_path}" | |
# Split with alt-s alt-v | |
bind -n M-v split-window -h -c "#{pane_current_path}" | |
bind -n M-s split-window -v -c "#{pane_current_path}" | |
# hjkl to switch panes | |
bind h select-pane -L | |
bind j select-pane -D | |
bind k select-pane -U | |
bind l select-pane -R | |
# Alt + hjkl to switch panes | |
bind -n M-h select-pane -L | |
bind -n M-j select-pane -D | |
bind -n M-k select-pane -U | |
bind -n M-l select-pane -R | |
# Alt+n Alt+p to switch windows | |
bind -n M-n next-window | |
bind -n M-p previous-window | |
# Alt+z Zoom | |
bind -n M-z resize-pane -Z | |
# Alt+r Rotate | |
bind -n M-r rotate-window | |
# Alt+c Create window | |
bind -n M-c new-window -c "#{pane_current_path}" | |
# Alt+x Delete window | |
# Count windows and panes starting at 1, not 0 | |
set -g base-index 1 | |
setw -g pane-base-index 1 | |
# select with alt-number | |
bind -n M-0 select-window -t 0 | |
bind -n M-1 select-window -t 1 | |
bind -n M-2 select-window -t 2 | |
bind -n M-3 select-window -t 3 | |
bind -n M-4 select-window -t 4 | |
bind -n M-5 select-window -t 5 | |
bind -n M-6 select-window -t 6 | |
bind -n M-7 select-window -t 7 | |
bind -n M-8 select-window -t 8 | |
bind -n M-9 select-window -t 9 | |
# move windows | |
bind-key -n C-S-Left swap-window -t -1\; select-window -t -1 | |
bind-key -n C-S-Right swap-window -t +1\; select-window -t +1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment