You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
4.4 KiB
Cheetah

# Core options (https://github.com/tmux-plugins/tmux-sensible)
#
# address vim mode switching delay (http://superuser.com/a/252717/65504)
set -s escape-time 50
# increase scrollback buffer size
set -g history-limit 50000
# tmux messages are displayed for 4 seconds
set -g display-time 4000
# screen-256 true color
set -g default-terminal "screen-256color"
set -ga terminal-overrides ",xterm-256color:Tc"
# focus events enabled for terminals that support them
set -g focus-events on
# super useful when using "grouped sessions" and multi-monitor setup
setw -g aggressive-resize on
# ===========================================================================
# Other options
set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2)
setw -q -g utf8 on
set -g status on
# refresh 'status-left' and 'status-right' more often
set -g status-interval 5
set -g status-justify left
set -g status-position bottom
set -g status-keys vi
# C-b is not acceptable -- Vim uses it
set-option -g prefix C-a
bind-key C-a last-window
unbind-key C-b
set -g base-index 1 # start windows numbering at 1
setw -g pane-base-index 1 # make pane numbering consistent with windows
set -g renumber-windows on # renumber windows when a window is closed
set -g set-titles on # set terminal title
set -g set-titles-string '❐ #S #I #W'
set -g display-panes-time 500 # slightly longer pane indicators display time
# Notifications
setw -g monitor-activity on
setw -g visual-activity on
# Auto rename
set-option -g automatic-rename on
set-option -g automatic-rename-format '#{b;s/{{ .username }}/~/:pane_current_path}'
# Allows us to use C-a a <command> to send commands to a TMUX session inside
# another TMUX session
bind-key a send-prefix
# Activity monitoring
setw -g monitor-activity on
set -g visual-activity on
# Split windows into panes: CTRL-A + h or v
bind-key h split-window -v -c '#{pane_current_path}'
bind-key v split-window -h -c '#{pane_current_path}'
# Set up resize-pane keys: ALT + left - right - down - up
bind-key -n M-Left resize-pane -L 1
bind-key -n M-Right resize-pane -R 1
bind-key -n M-Down resize-pane -D 1
bind-key -n M-Up resize-pane -U 1
# Switch windows: CTRL-ALT + left or right arrows
bind-key -n C-M-Left previous-window
bind-key -n C-M-Right next-window
set-window-option -g mode-keys vi
# -- copy mode -----------------------------------------------------------------
bind Enter copy-mode # enter copy mode
run -b 'tmux bind -t vi-copy v begin-selection 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi v send -X begin-selection 2> /dev/null || true'
run -b 'tmux bind -t vi-copy C-v rectangle-toggle 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi C-v send -X rectangle-toggle 2> /dev/null || true'
run -b 'tmux bind -t vi-copy y copy-selection 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi y send -X copy-selection-and-cancel 2> /dev/null || true'
run -b 'tmux bind -t vi-copy Escape cancel 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi Escape send -X cancel 2> /dev/null || true'
run -b 'tmux bind -t vi-copy H start-of-line 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi L send -X end-of-line 2> /dev/null || true'
# copy to Mac OSX clipboard
if -b 'command -v reattach-to-user-namespace > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | reattach-to-user-namespace pbcopy"'
# copy to X11 clipboard
if -b 'command -v xsel > /dev/null 2>&1' 'bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xsel -i -p && xsel -o -p | xsel -i -b"'
# copy to Ms Windows clipboard
if -b '[ -c /dev/clipboard ]' 'bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "tmux save-buffer - > /dev/clipboard"'
# Move windows on the left (/) or on the right (*)
bind-key / swap-window -t -1
bind-key * swap-window -t +1
# define keystrokes to send favorite commands defined as env var
# ALT-SHIFT-<number>
bind-key M-1 send-keys "$FAVORITE_COMMAND1"
bind-key M-2 send-keys "$FAVORITE_COMMAND2"
bind-key M-3 send-keys "$FAVORITE_COMMAND3"
bind-key M-4 send-keys "$FAVORITE_COMMAND4"
# Reload tmux config
unbind r
bind r source-file ~/.tmux.conf \; display-message "config reloaded!"
# plugin fzf-session-switch
set -g @fzf-goto-session 's'
# Plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin "arcticicestudio/nord-tmux"
set -g @plugin "brokenricefilms/tmux-fzf-session-switch"
# run tpm
run -b '~/.tmux/plugins/tpm/tpm'
# =========================== END OF FILE ===================================