nunOS/config/tmux/tmux.conf
2023-11-14 16:32:26 +00:00

71 lines
1.9 KiB
Plaintext

# Shortcuts
## See: https://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# No delay for escape key press
set -sg escape-time 0
## vim mode
setw -g mode-keys vi
# selection
## https://www.rockyourcode.com/copy-and-paste-in-tmux/
set-option -g mouse on
set-option -s set-clipboard off
bind P paste-buffer
bind-key -T copy-mode-vi v send-keys -X begin-selection
unbind -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel 'xclip -se c -i'
bind-key -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel 'xclip -se c -i'
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'xclip -se c -i'
## a long, long history
set-option -g history-limit 5000
# don't rename windows automatically
set-option -g allow-rename off
setw -g automatic-rename off
# split panes using / and -, into the same directory
bind / split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
# open new window into Documents directory with Ctrl+A+c
bind c new-window -c "~/Documents" # "bash -i -c 'lf && exec bash'"
# switch panes using Alt-arrow without prefix
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
# Use Alt-vim keys without prefix key 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
# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window
## Get HOME and END keys to work in nvim.
## <https://github.com/neovim/neovim/issues/6134>
bind-key -n Home send Escape "OH"
bind-key -n End send Escape "OF"
# Reload config
bind r source-file ~/config/.tmux.conf
## Disable status bar
bind-key b set -g status off
# Terminal config
set -g default-terminal "xterm-256color"