Skip to content

Instantly share code, notes, and snippets.

@imvaskii
Created April 16, 2020 10:23
Show Gist options
  • Save imvaskii/580e987063bd5bb3f752771f39f6c9ed to your computer and use it in GitHub Desktop.
Save imvaskii/580e987063bd5bb3f752771f39f6c9ed to your computer and use it in GitHub Desktop.
~/.tmux.conf
# tmux config file.
#
# Maintainer: Bhaskar K C <[email protected]>
unbind C-b
# edit configuration
bind e new-window -n "~/.tmux.conf" \
"sh -c '\${EDITOR:-vim} \
~.tmux.conf && \
tmux source ~/.tmux.conf && \
tmux display \"~/.tmux.conf sourced\"'"
# reload configuration
bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'
bind v split-window -h
bind s split-window -v
set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2)
setw -q -g utf8 on
set -g default-terminal "screen-256color" # colors!
setw -g xterm-keys on
set -s focus-events on
set -sg escape-time 0 # No delay for escape key press
# set -s escape-time 10 # faster command sequences
set -g status-position top # move status line to top
set -g status-keys vi # set vi keys
set -g mode-keys vi # set vi keys
set -sg repeat-time 600 # increase repeat timeout
set -g history-limit 10000 # increase history size
set -g mouse on # start with mouse mode enabled
set -g prefix C-a # set prefix
# activity
set -g monitor-activity on
set -g visual-activity off
# set -g status-right "#{tmux_mode_indicator}"
# ------------------------ Clipboard ------------------------ #
tmux_conf_copy_to_os_clipboard=true
if -b 'command -v xsel > /dev/null 2>&1' \
'bind y run -b "tmux save-buffer - |\
xsel -i -b"'
if -b '! command -v xsel > /dev/null 2>&1 && \
command -v xclip > /dev/null 2>&1' \
'bind y run -b "tmux save-buffer - | \
xclip -i -selection clipboard >/dev/null 2>&1"'
# ------------------------ Clipboard ------------------------ #
# -- navigation ----------------------------------------------------------------
# create session
bind C-c new-session
# find session
bind C-f command-prompt -p find-session 'switch-client -t %%'
# split current window horizontally
bind - split-window -v
# split current window vertically
bind _ split-window -h
# pane navigation
bind -r h select-pane -L # move left
bind -r j select-pane -D # move down
bind -r k select-pane -U # move up
bind -r l select-pane -R # move right
bind > swap-pane -D # swap current pane with the next one
bind < swap-pane -U # swap current pane with the previous one
# maximize current pane
bind + run 'cut -c3- ~/.tmux.conf | sh -s _maximize_pane "#{session_name}" #D'
# pane resizing
bind -r H resize-pane -L 2
bind -r J resize-pane -D 2
bind -r K resize-pane -U 2
bind -r L resize-pane -R 2
# window navigation
unbind n
unbind p
bind -r C-h previous-window # select previous window
bind -r C-l next-window # select next window
bind Tab last-window # move to last active window
# -- navigation ----------------------------------------------------------------
set -g pane-active-border-style bg=default,fg=yellow
set -g pane-border-style fg=black
# -- buffers -------------------------------------------------------------------
bind b list-buffers # list paste buffers
bind p paste-buffer # paste from the top paste buffer
bind P choose-buffer # choose which buffer to paste from
# -- buffers -------------------------------------------------------------------
# nvim cursor fix
#https://vi.stackexchange.com/questions/22224/change-neovim-cursor-in-insert-mode-under-st-simple-terminal-and-tmux
set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q'
# │ ├┘ ├────────┘ ├┘ ├────┘
# │ │ │ │ └ override with this control sequence;
# │ │ │ │ restore the cursor shape to a block
# │ │ │ │
# │ │ │ └ `Se` capability in the terminfo database
# │ │ │
# │ │ └ override the current value with this new one;
# │ │ set the cursor shape to the one specified by
# │ │ the digit `%d`
# │ │
# │ └ `Ss` capability in the terminfo database
# │
# └ for all terminals (no matter the value of `$TERM`)
# Tmux crashing on st terminal when opening vim.
# https://bugs.archlinux.org/task/57596
set -g @continuum-restore 'on'
# List of Plugins
set -g @tpm_plugins ' \
tmux-plugins/tpm \
tmux-plugins/tmux-resurrect \
tmux-plugins/tmux-continuum \
'
run '~/.tmux/plugins/tpm/tpm'
# for neovim
set -g @resurrect-strategy-nvim 'session'
set -g @resurrect-capture-pane-contents 'on'
# set -g default-command "reattach-to-user-namespace -l $SHELL"
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'tmux-plugins/tmux-net-speed'
set -g @plugin 'samoshkin/tmux-plugin-sysstat'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment