Skip to content

Instantly share code, notes, and snippets.

@deibit
Last active October 25, 2023 11:50
Show Gist options
  • Save deibit/ad5b3d878dbfe7fd75e57847cb9d4b88 to your computer and use it in GitHub Desktop.
Save deibit/ad5b3d878dbfe7fd75e57847cb9d4b88 to your computer and use it in GitHub Desktop.
tmux configuration
# Rebind prefix
set -g prefix C-Space
# Rebind copy-mode to a better Spanish keyboard setup
bind-key y copy-mode
set -g base-index 1
setw -g pane-base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
# Terminal options
set-option -ga terminal-overrides ",xterm-256color:Tc"
set -g default-shell ${SHELL}
setw -g mouse on
setw -g monitor-activity on
# Pane resizing
bind -n M-h resize-pane -L 5
bind -n M-j resize-pane -D 5
bind -n M-k resize-pane -U 5
bind -n M-l resize-pane -R 5
# Use Alt-arrow keys without prefix key to switch panes
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window
# Copy mode
bind -T copy-mode-vi v send-keys -X begin-selection
# statusbar
set-window-option -g window-status-activity-style fg=blue
# default statusbar colors
set-option -g status-bg colour235
set-option -g status-fg grey
# clock
set-window-option -g clock-mode-colour colour64 #green
# bell
set-window-option -g window-status-bell-style fg=colour235,bg=colour160 #base02, red
# statusline
set -g status-left '#[fg=red]#(whoami)#[fg=blue]@#[fg=orange]#(hostname -s)'
set -g status-left-length 35
set -g status-right '#[fg=cyan,bold]#[default]#[fg=blue]#[fg=red]%H:%M %d-%b-%y#[default]'
# Highlight active window
setw -g window-status-current-style fg=orange
# Center window list
set -g status-justify centre
# Neovim
set-option -g focus-events on
# Open panes in the same directory
bind c new-window -c "#{pane_current_path}"
bind-key v split-window -h -c "#{pane_current_path}"
bind-key s split-window -v -c "#{pane_current_path}"
bind '%' split-window -c "#{pane_current_path}"
bind '"' split-window -h -c "#{pane_current_path}"
# Synchronize panes
unbind C-S
bind C-Y set-window-option synchronize-panes
# List of plugins
set -g @plugin "tmux-plugins/tpm"
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
run '~/.tmux/plugins/tpm/tpm'
# for vim
set -g @resurrect-strategy-vim 'session'
# for neovim
set -g @resurrect-strategy-nvim 'session'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment