Skip to content

Instantly share code, notes, and snippets.

@guimaluf
Last active November 20, 2019 21:19
Show Gist options
  • Save guimaluf/178fe91cdab3597a4b7495c0ab7c0077 to your computer and use it in GitHub Desktop.
Save guimaluf/178fe91cdab3597a4b7495c0ab7c0077 to your computer and use it in GitHub Desktop.
# prefix is Ctrl-q
set -g prefix C-q
bind C-q send-prefix
bind-key C-q last-window
unbind C-b
set -sg escape-time 0
set -g base-index 1
setw -g pane-base-index 1
set -g history-limit 999999
bind c neww -c '#{pane_current_path}'
# window reloading
bind r source-file ~/.tmux.conf
# mouse works as expected
set -g -q mouse on
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
set-option -ga terminal-overrides ",xterm-*:csr@"
set -g mode-keys vi
#set -g mode-keys emacs
# activity monitoring
setw -g monitor-activity on
set -g visual-activity on
# renumber after delete
set-option -g renumber-windows on
unbind p
bind Escape copy-mode
bind p paste-buffer
#
# move x clipboard into tmux paste buffer
bind C-p run "tmux set-buffer \"$(xclip -o)\"; tmux paste-buffer"
# move tmux copy buffer into x clipboard
bind y run "tmux save-buffer - | xclip -i > /dev/null"
# easy-to-remember split pane commands
bind | split-window -h -c '#{pane_current_path}'
bind \ split-window -h -c '#{pane_current_path}'
bind - split-window -v -c '#{pane_current_path}'
unbind '"'
unbind %
# moving between panes with vim movement keys
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# moving between windows with vim movement keys
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# resize panes with vim movement keys
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# move pane to new window
bind C-b break-pane
# Join windows: <prefix> s, <prefix> j
bind-key C-f command-prompt -p "join pane from:" "join-pane -s '%%'"
bind-key C-t command-prompt -p "send pane to:" "join-pane -t '%%'"
# killing stuff
bind-key x kill-pane
bind-key X kill-window
bind-key q confirm-before kill-session
bind-key Q confirm-before kill-server
# selecting windows
unbind ,
unbind .
bind , previous-window # <
bind . next-window # >
bind < swap-window -t :-
bind > swap-window -t :+
# renaming windows
bind n command-prompt 'rename-window %%'
bind N command-prompt 'rename-session %%'
# size correction
setw -g aggressive-resize on
# titles
set-option -g set-titles on
set-option -g set-titles-string '#H:#S.#I.#P #W #T'
# status bar
set-window-option -g window-status-current-style fg=cyan
set -g status-keys vi
#set -g status-utf8 on
set -g status-interval 1
set -g status-bg black
set -g status-fg white
set-option -g status-left-length 60
set -g status-left "#[fg=red,bright,bg=black]Session: #[fg=yellow,bright,bg=black]#S #[default]|"
set -g status-right '#[fg=green][#[fg=blue]%Y-%m-%d #[fg=white]%H:%M#[default]#[fg=green]]#[fg=red][#(hostname)]'
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -t= \; send-keys -M
bind -n C-WheelUpPane select-pane -t= \; copy-mode -e \; send-keys -M
bind s set-window-option synchronize-panes
#tmux-ressurect
#set -g @resurrect-processes 'ssh irb'
# List of plugins
# Supports `github_username/repo` or full git repo URLs
#set -g @tpm_plugins ' \
# tmux-plugins/tpm \
# tmux-plugins/tmux-resurrect \
# '
# Initializes TMUX plugin manager.
# Keep this line at the very bottom of tmux.conf.
run-shell '~/.tmux/plugins/tpm/tpm'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment