Skip to content

Instantly share code, notes, and snippets.

@notmarkmiranda
Last active August 9, 2019 03:28
Show Gist options
  • Save notmarkmiranda/3583ee1236962d298c2f86bc98a76ab7 to your computer and use it in GitHub Desktop.
Save notmarkmiranda/3583ee1236962d298c2f86bc98a76ab7 to your computer and use it in GitHub Desktop.
.tmux.conf
# remap prefix from ctrl-b to ctrl-b
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# tmux split panes using T and t
bind T split-window -h
bind t split-window -v
unbind '"'
unbind %
# reload config file
bind r source-file ~/.tmux.conf
# navigate panes using ctrl-[h,j,k,l]
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
# mouse mode on!
set -g mouse on
# turn off rename windows automagically
set-option -g allow-rename off
# set default color of terminal
set -g default-terminal "screen-256color"
# status pane colors & styles
set-option -g status on
set-option -g status-interval 2
set-option -g status-justify "centre"
set-option -g status-left-length 100
set-option -g status-right-length 100
set-window-option -g window-status-style bg=black
set-window-option -g window-status-style fg=white
set-window-option -g window-status-current-bg brightred
set-window-option -g window-status-current-fg black
set-option -g status-style bg=black
# tmux-powerline (deprecated version)
set-option -g status-left "#(~/.tmux/plugins/tmux-powerline/powerline.sh left)"
set-option -g status-right "#(~/.tmux/plugins/tmux-powerline/powerline.sh right)"
# 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-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
bind-key -T copy-mode-vi C-h select-pane -L
bind-key -T copy-mode-vi C-j select-pane -D
bind-key -T copy-mode-vi C-k select-pane -U
bind-key -T copy-mode-vi C-l select-pane -R
bind-key -T copy-mode-vi C-\ select-pane -l
# zoom tmux panes
bind-key -n C-Space resize-pane -Z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment