Skip to content

Instantly share code, notes, and snippets.

@sebastianvera
Created May 10, 2019 08:57
Show Gist options
  • Save sebastianvera/c75ea9c490cd551cfa5d6b849d76e70e to your computer and use it in GitHub Desktop.
Save sebastianvera/c75ea9c490cd551cfa5d6b849d76e70e to your computer and use it in GitHub Desktop.
###########################
# Configuration
###########################
# increase scroll-back history
set -g history-limit 5000
# use vim key bindings
setw -g mode-keys vi
# decrease command delay (increases vim responsiveness)
set -sg escape-time 0
# increase repeat time for repeatable commands
set -g repeat-time 1000
# highlight window when it has new activity
setw -g monitor-activity on
set -g visual-activity on
# start windows numbering at 1 and renumber on window close
setw -g pane-base-index 1
set -g base-index 1
set -g renumber-windows on
# enable pbcopy and pbpaste
# https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard/blob/master/README.md
set-option -g default-command "reattach-to-user-namespace -l zsh"
# Don't rename the window's name
set-option -g allow-rename off
# enable mouse for scroll
set -g mouse on
###########################
# Key Bindings
###########################
# tmux prefix
unbind C-b
set -g prefix C-a
# Go to beginning of line
bind a send-prefix
# copy with 'enter' or 'y' and send to mac os clipboard: http://goo.gl/2Bfn8
unbind-key -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
# resize panes
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
# Enable screen-like C-a C-a moving to last window
bind-key C-a last-window
# force a reload of the config kile
unbind r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
bind c new-window -c "#{pane_current_path}"
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# Smart pane switching with awareness of vim splits
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
# Restore clear screen
bind C-l send-keys 'C-l'
# ctrl+] => cmd+k (iTerm, send keys: cmd+k => 0x1d)
bind -n C-] send-keys -R \; send-keys C-l \; clear-history
#--------------------------------------------
# Color and style settings
#--------------------------------------------
# tmux display things in 256 colors
# set -g default-terminal "screen-256color"
# set -ga terminal-overrides ",xterm-256color:Tc"
set -g default-terminal "tmux-256color"
# tell Tmux that outside terminal supports true color
set -ga terminal-overrides ",xterm-256color*:Tc"
# tm_icon="⇨☁♬☃♟♧ツ☀"
tm_icon="☃"
tm_color_gray=colour241
tm_color_blue=colour4
tm_color_yellow=colour3
tm_color_red=colour203
set -g status-left-length 32
set -g status-right-length 150
set -g status-interval 5
# window title colors
set -g window-status-format "#[bg=default]#[fg=$tm_color_blue]#I #W"
set-option -g status-style bg=default
set -g window-status-current-format "#[bold]#I #W"
set -g window-status-current-style "underscore"
# set -g window-status-current-style fg=$tm_color_gray bg=$tm_color_yellow
# pane border
set-option -g pane-border-style fg=$tm_color_gray
set-option -g pane-active-border-style fg=$tm_color_blue
# message text
set-option -g message-style fg=$tm_color_red
# pane number display
set-option -g display-panes-active-colour $tm_color_blue
# clock
set -g clock-mode-colour $tm_color_yellow
tm_date="#[fg=$tm_color_gray] %R %d %b"
tm_session_name="#[fg=$tm_color_blue]$tm_icon#[fg=$tm_color_red] #S"
set -g status-left $tm_session_name' '
set -g status-right $tm_date
@cagodoy
Copy link

cagodoy commented Jun 29, 2019

🔥

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment