Skip to content

Instantly share code, notes, and snippets.

@tastywheat
Last active October 14, 2022 23:37
Show Gist options
  • Save tastywheat/e56093d3bec35c0f342cd11cd6e0da55 to your computer and use it in GitHub Desktop.
Save tastywheat/e56093d3bec35c0f342cd11cd6e0da55 to your computer and use it in GitHub Desktop.
tmux conf
# First remove *all* keybindings
unbind-key -a
# Now reinsert all the regular tmux keys
# set-option -g prefix `
# bind-key ` send-prefix
# set-option -g prefix C-b
# bind-key C-b send-prefix
# bind-key C-o rotate-window
# bind-key C-z suspend-client
# bind-key Space next-layout
# bind-key ! break-pane
# bind-key '"' split-window
# bind-key '#' list-buffers
# bind-key '$' command-prompt -I "#S" "rename-session '%%'"
# bind-key % split-window -h
# bind-key & confirm-before -p "kill-window #W? (y/n)" kill-window
# bind-key "'" command-prompt -p index "select-window -t ':%%'"
# bind-key ( switch-client -p
# bind-key ) switch-client -n
# bind-key , command-prompt -I "#W" "rename-window '%%'"
# bind-key - delete-buffer
# bind-key . command-prompt "move-window -t '%%'"
# bind-key 0 select-window -t :0
# bind-key 1 select-window -t :1
# bind-key 2 select-window -t :2
# bind-key 3 select-window -t :3
# bind-key 4 select-window -t :4
# bind-key 5 select-window -t :5
# bind-key 6 select-window -t :6
# bind-key 7 select-window -t :7
# bind-key 8 select-window -t :8
# bind-key 9 select-window -t :9
# bind-key : command-prompt
# bind-key \; last-pane
# bind-key = choose-buffer
# bind-key ? list-keys
# bind-key D choose-client
# bind-key L switch-client -l
# bind-key [ copy-mode
# bind-key ] paste-buffer
# bind-key c new-window
# bind-key d detach-client
# bind-key f command-prompt "find-window '%%'"
# bind-key i display-message
# bind-key l last-window
# bind-key n next-window
# bind-key o select-pane -t :.+
# bind-key p previous-window
# bind-key q display-panes
# reload config file (change file location to your the tmux.conf you want to use)
# bind-key r source-file ~/.tmux.conf \; display-message "Config reloaded..."
# bind-key r refresh-client
# bind-key s choose-tree
# bind-key t clock-mode
# bind-key w choose-window
# bind-key x confirm-before -p "kill-pane #P? (y/n)" kill-pane
# bind-key z resize-pane -Z
# bind-key { swap-pane -U
# bind-key } swap-pane -D
# bind-key '~' show-messages
# bind-key PPage copy-mode -u
# bind-key -r Up select-pane -U
# bind-key -r Down select-pane -D
# bind-key -r Left select-pane -L
# bind-key -r Right select-pane -R
# bind-key M-1 select-layout even-horizontal
# bind-key M-2 select-layout even-vertical
# bind-key M-3 select-layout main-horizontal
# bind-key M-4 select-layout main-vertical
# bind-key M-5 select-layout tiled
# bind-key M-n next-window -a
# bind-key M-o rotate-window -D
# bind-key M-p previous-window -a
# bind-key -r M-Up resize-pane -U 5
# bind-key -r M-Down resize-pane -D 5
# bind-key -r M-Left resize-pane -L 5
# bind-key -r M-Right resize-pane -R 5
# bind-key -r C-Up resize-pane -U
# bind-key -r C-Down resize-pane -D
# bind-key -r C-Left resize-pane -L
# bind-key -r C-Right resize-pane -R
#print colors
#for i in {0..255}; do
# printf "\x1b[38;5;${i}mcolour${i}\x1b[0m\n"
#done
# Remove escape press delay
set -s escape-time 0
# set inactive/active window styles
# set -g window-style 'fg=default,bg=default'
# set -g window-active-style 'fg=default,bg=default'
set -g window-style "fg=default,bg=colour236"
set -g window-active-style "fg=default,bg=colour0" # https://www.ditig.com/256-colors-cheat-sheet
#pane border
set -g pane-border-style 'bg=colour236,fg=white'
set -g pane-active-border-style 'bg=colour236,fg=white'
#set -g status-bg green
#set -g status-fg black
#set -g window-status-current-bg default
#set -g window-status-current-fg default
set -g status-bg black
set -g status-fg white
set -g window-status-current-style 'bg=white,fg=black'
set -g status-right "#[fg=cyan]%A, %d %b %Y %I:%M %p"
set -g default-terminal "screen-256color"
set -ga terminal-overrides ",xterm-256color:Tc"
set -g allow-rename off
# Fix copy/paste register when vim is inside tmux
# Enable for macos - install dep reattach-to-user-namespace
# set -g default-command "reattach-to-user-namespace -l zsh"
set -g prefix C-f
bind C-f send-prefix
bind , command-prompt -I "#W" "rename-window '%%'"
bind \; command-prompt
bind c new-window
bind r source-file ~/.tmux.conf \; display-message "Config reloaded..."
bind z resize-pane -Z
bind n split-window
bind m split-window -h
bind -r Left resize-pane -L 5
bind -r Down resize-pane -D 5
bind -r Up resize-pane -U 5
bind -r Right resize-pane -R 5
bind -r h last-window
bind PPage copy-mode -u
bind Space next-layout
bind y select-window -t :0
bind u select-window -t :1
bind j select-window -t :2
bind i select-window -t :3
bind k select-window -t :4
bind o select-window -t :5
bind l select-window -t :6
bind s set-window-option synchronize-panes
# bind q kill-session
# 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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment