Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
141 lines (109 sloc) 5.09 KB
# Rebind action key to `
unbind-key C-b
set-option -g prefix `
bind-key ` send-prefix
# allow switching between two prefixes
bind-key C-q set-option -g prefix C-g \; unbind-key ` \; bind-key C-g send-prefix
bind-key C-w set-option -g prefix ` \; unbind-key C-g \; bind-key ` send-prefix
# Confirm before killing
bind-key k confirm kill-window
bind-key K confirm kill-server
# Refresh the screen, sometimes just needed
bind-key R refresh-client
# Make the escape key not delay so vim is more responsive
set -sg escape-time 0
# Make tmux control the xterm window title based on title of current pane
set -g set-titles on
set-window-option -g xterm-keys on
set-window-option -g alternate-screen on
set-window-option -g wrap-search off
# Move windows around
unbind-key .
bind-key m command "swap-window -t '%%'"
# Easy movement
bind-key -n M-Left prev
bind-key -n M-Right next
# Have a good history
set-option -g history-limit 10000
# Make tmux emit focus events
set -g focus-events on
# I almost never want to stop at - or _ in words
set-option -g word-separators ' @'
# Start window indexing at 1
set-option -g base-index 1
set-window-option -g pane-base-index 1
# Pause so I can read the dang message
set-option -g display-time 2500
# Don't notify on window activity
set-window-option -g monitor-activity off
set-option -g visual-bell off
set-option -g visual-activity off
# Style the tabs
set-option -g message-style 'fg=blue,bg=black'
set-window-option -g mode-style 'fg=colour236,bold,bg=colour230'
set-option -g status-left ''
set-option -g status-style 'fg=black,bg=colour0'
set-option -g status-interval 1
# set-option -g status-right '%b %d #[fg=cyan]%I:%M #[default]%p'
set-option -g status-right '#(LUAENV_VERSION=2.1.0 usage --rgb 1 --tmux --order fwcai)'
set-window-option -g window-status-format '#I:#W'
set-window-option -g window-status-current-format '#I:#W'
set-window-option -g window-status-current-style 'fg=black,bold,bg=colour10'
set-window-option -g window-status-style 'fg=colour10,bg=colour0'
# The command mode box
set-option -g message-style 'bg=default,fg=colour248'
# Let me know which pane is active
set-option -g pane-active-border-style 'fg=yellow,bg=default'
set-option -g pane-border-style 'fg=black,bg=default'
# split windows like vim
# vim's definition of a horizontal/vertical split is reversed from tmux's
unbind-key '"'
bind-key s split-window -v -c "#{?pane_current_path,#{pane_current_path},$HOME}"
unbind-key %
bind-key v split-window -h -c "#{?pane_current_path,#{pane_current_path},$HOME}"
bind-key c neww -c "#{?pane_current_path,#{pane_current_path},$HOME}"
# Make copy commands operate more like vim
unbind-key -t vi-copy ' '
# unbind-key -t vi-copy Enter
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-selection
bind-key -t vi-copy ^V rectangle-toggle
bind-key -t vi-copy V rectangle-toggle
bind-key -t vi-copy Escape cancel
# move around panes with j and k, a bit like vim
bind-key h select-pane -L
bind-key l select-pane -R
bind-key j select-pane -D
bind-key k select-pane -U
# The above are fallbacks for when the next set don't fullfil you movment needs,
# e.g. tmux on a remove server and your local tmux window has multiple panes
# These is inlined here instead of an external script to keep latency low
bind-key -n C-h run "[[ $(tmux display-message -p '#{pane_current_command} #{window_panes}') =~ ^vim | 1$ ]] && tmux send-keys C-h || tmux select-pane -L"
bind-key -n C-j run "[[ $(tmux display-message -p '#{pane_current_command} #{window_panes}') =~ ^vim | 1$ ]] && tmux send-keys C-j || tmux select-pane -D"
bind-key -n C-k run "[[ $(tmux display-message -p '#{pane_current_command} #{window_panes}') =~ ^vim | 1$ ]] && tmux send-keys C-k || tmux select-pane -U"
bind-key -n C-l run "[[ $(tmux display-message -p '#{pane_current_command} #{window_panes}') =~ ^vim | 1$ ]] && tmux send-keys C-l || tmux select-pane -R"
bind-key -n C-\ run "[[ $(tmux display-message -p '#{pane_current_command} #{window_panes}') =~ ^vim | 1$ ]] && tmux send-keys 'C-\\' || tmux select-pane -l"
# vi-style controls for copy mode
set-option -g status-keys vi
set-window-option -g mode-keys vi
# My default terminal has 180 columns so setup the max vertical window width
# to be half of that for ease of viewing and the max rows is 66 so half of that
set-window-option -g main-pane-width 90
set-window-option -g main-pane-height 33
set-window-option -g aggressive-resize on
# enable the mouse
set-option -g mouse on
set-option -g mouse-utf8 off
# Only enter copy-mode if the pane is not in alternate mode, e.g. vim
bind-key -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M"
bind-key -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"
set-option -g status-utf8 on
set-window-option -g utf8 on
new-session -d -s main 'exec sudo htop'
run-shell -b 'init-tmux'
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-sessionist'
set -g @continuum-restore 'on'
run '~/.tmux/plugins/tpm/tpm'
Jump to Line
Something went wrong with that request. Please try again.