Skip to content

Instantly share code, notes, and snippets.

@timsuchanek
Created September 28, 2018 08:52
Show Gist options
  • Save timsuchanek/b706db0b4d8ad3729b85f00cafcd8826 to your computer and use it in GitHub Desktop.
Save timsuchanek/b706db0b4d8ad3729b85f00cafcd8826 to your computer and use it in GitHub Desktop.
# Ring the bell if any background window rang a bell
set -g bell-action any
# Default termtype. If the rcfile sets $TERM, that overrides this value.
set -sa terminal-overrides ",*:dim=\\E[2m"
set -g default-terminal "screen-256color"
# Keep your finger on ctrl, or don't
bind ^D detach-client
# Create splits and vertical splits
bind v split-window -h -c '#{pane_current_path}'
bind s split-window -c '#{pane_current_path}'
# Pane resize in all four directions using vi bindings.
# Can use these raw but I map them to shift-ctrl-<h,j,k,l> in iTerm.
bind J resize-pane -D
bind K resize-pane -U
bind H resize-pane -L
bind L resize-pane -R
# Use vi keybindings for tmux commandline input.
# Note that to get command mode you need to hit ESC twice...
set -g status-keys vi
# Use vi keybindings in copy and choice modes
setw -g mode-keys vi
# easily toggle synchronization (mnemonic: e is for echo)
# sends input to all panes in a given window.
bind e setw synchronize-panes on
bind E setw synchronize-panes off
# set first window to index 1 (not 0) to map more to the keyboard layout...
set-option -g base-index 1
set-window-option -g pane-base-index 1
# Screen like binding
unbind C-b
set -g prefix C-s
#bind s send-prefix
# No escape time for vi mode
set -sg escape-time 0
# Screen like binding for last window
unbind l
bind ^S last-window
# Bigger history
set -g history-limit 10000
# navigate
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# clear buffer
bind -n C-g send-keys C-l
# Patch for OS X pbpaste and pbcopy under tmux.
#set-option -g default-command "which reattach-to-user-namespace > /dev/null && reattach-to-user-namespace -l $SHELL || $SHELL"
set -g default-command "reattach-to-user-namespace -l fish"
#setw -g mode-keys vi
bind ` copy-mode
#unbind [
unbind p
bind ] run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer"
bind p paste-buffer
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
bind-key -Tcopy-mode-vi 'y' send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
bind-key -Tcopy-mode-vi Escape send -X cancel
bind-key -Tcopy-mode-vi V send -X select-line
# smart pane switching with awareness of vim splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
# clear scroll session
bind r clear-history
# remap new pane / window with current path
bind c new-window -c '#{pane_current_path}'
bind Left prev
bind Right next
#set -g mouse-select-pane on
#set -g mouse-resize-pane on
#setw -g mouse-select-window on
#set -g mode-mouse on
set-option -g mouse on
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"
bind = kill-session
set -g status-interval 1
# This tmux statusbar config was created by tmuxline.vim
# on Tue, 28 Oct 2014
set -g status-bg "colour0"
set -g message-command-fg "colour15"
set -g status-justify "centre"
set -g status-left-length "100"
set -g status "on"
set -g pane-active-border-fg "colour4"
set -g message-bg "colour10"
set -g status-right-length "100"
set -g status-right-attr "none"
set -g message-fg "colour15"
set -g message-command-bg "colour10"
set -g status-attr "none"
#set -g status-utf8 "on"
set -g pane-border-fg "colour10"
set -g status-left-attr "none"
setw -g window-status-fg "colour14"
setw -g window-status-attr "none"
setw -g window-status-activity-bg "colour0"
setw -g window-status-activity-attr "none"
setw -g window-status-activity-fg "colour4"
setw -g window-status-separator ""
setw -g window-status-bg "colour0"
set -g status-left "#[fg=colour15,bg=colour4] #S #[fg=colour4,bg=colour10,nobold,nounderscore,noitalics]#[fg=colour15,bg=colour10] #F #[fg=colour10,bg=colour0,nobold,nounderscore,noitalics]#[fg=colour14,bg=colour0] #W #[fg=colour0,bg=colour0,nobold,nounderscore,noitalics]"
set -g status-right " #[fg=colour10,bg=colour0,nobold,nounderscore,noitalics]#[fg=colour14,bg=colour10] %b %d | %H:%M:%S #[fg=colour12,bg=colour10,nobold,nounderscore,noitalics]"
setw -g window-status-format "#[fg=colour0,bg=colour0,nobold,nounderscore,noitalics]#[default] #I | #W #[fg=colour0,bg=colour0,nobold,nounderscore,noitalics]"
setw -g window-status-current-format "#[fg=colour0,bg=colour10,nobold,nounderscore,noitalics]#[fg=colour15,bg=colour10] #I | #W #[fg=colour10,bg=colour0,nobold,nounderscore,noitalics]"
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-yank'
run '~/.dotfiles/tmux/plugins/tpm'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment