Skip to content

Instantly share code, notes, and snippets.

@nquangit
Created August 31, 2025 07:14
Show Gist options
  • Save nquangit/4e7ebddfecce6245c89f0a3f20469225 to your computer and use it in GitHub Desktop.
Save nquangit/4e7ebddfecce6245c89f0a3f20469225 to your computer and use it in GitHub Desktop.
My tmux config
#
# Install TPM
# https://github.com/tmux-plugins/tpm
# git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
#
# Set the Prefix key to Ctrl + Space
unbind C-b
set -g prefix C-Space
# Set the reload profile key
unbind C-r
bind C-r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf"
# Set status bar on top or bottom
set-option -g status-position bottom
# Mouse mode
# set -g mouse on
# v and h are not bound by default, but we never know in the next versions...
unbind v
unbind h
unbind % # Split vertically
unbind '"' # Split horizontally
bind v split-window -h -c "#{pane_current_path}"
bind h split-window -v -c "#{pane_current_path}"
# Navigating pane
bind -n C-h select-pane -L
bind -n C-j select-pane -D
bind -n C-k select-pane -U
bind -n C-l select-pane -R
# History limit
set -g history-limit 100000
# Open Windows
unbind n #DEFAULT KEY: Move to next window
unbind w #DEFAULT KEY: change current window interactively
bind n command-prompt "rename-window '%%'"
bind w new-window -c "#{pane_current_path}"
# Windows number index
set -g base-index 1
set-window-option -g pane-base-index 1
# Windows Navigating
# alt + k and alt + j
bind -n M-j previous-window
bind -n M-k next-window
# Copy mode key binding
# prefix key -> [ to switch between copy & default mode or use `q` to bring back the default mode
set-window-option -g mode-keys vi
# Copy keybind
unbind -T copy-mode-vi Space; #Default for begin-selection
# unbind -T copy-mode-vi Enter; #Default for copy-selection
# bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mod-vi y send-keys -X copy-selection
# bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xsel --clipboard"
# Try to make compatible between tmux and nvim
set -g -a terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q'
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind -n C-\\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
# Clipboard WSL
# alt + w
bind -n M-w run -b "tmux show-buffer | clip.exe"
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'laktak/extrakto'
# Theme
## Nord theme
# set -g @plugin "nordtheme/tmux"
# set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
# set -g status-right '#{prefix_highlight} | %a %Y-%m-%d %H:%M'
## Nord Theme
## tmux2k Theme
set -g @plugin '2kabhishek/tmux2k'
set -g @tmux2k-theme 'onedark'
# to show icons only
set -g @tmux2k-icons-only false
# to customize duo bg and fg
set -g @tmux2k-duo-fg "#1688f0" # this will get you duo blue shown above
set -g @tmux1k-duo-bg "#000000" # this will set the bg for duo theme
# to set powerline symbols
# set -g @tmux2k-right-sep  # alternate right status bar sep
# set -g @tmux2k-window-list-right-sep  # alternate window list right sep
# to not show powerline
set -g @tmux2k-show-powerline true
# set session icon, accpets: `session`, 'window`, or any string
set -g @tmux2k-session-icon " #S" # `#W` for window name
## tmux2k Theme
# Theme
# Must to add this line to the end of this file
run -b '~/.tmux/plugins/tpm/tpm'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment