Skip to content

Instantly share code, notes, and snippets.

@syui
Created December 5, 2014 10:55
Show Gist options
  • Save syui/3111779be36f32ba7313 to your computer and use it in GitHub Desktop.
Save syui/3111779be36f32ba7313 to your computer and use it in GitHub Desktop.
### default {{{
set -s escape-time 0
set-window-option -g utf8 on
set-window-option -g mode-keys vi
set-window-option -g automatic-rename on
set-option -g set-titles on
set-option -g base-index 1
set-option -g pane-base-index 1
set-option -g renumber-windows on
set-option -g history-limit 10000
set-option -g bell-action none
set-option -g bell-on-alert on
set-option -g visual-bell on
set-option -g display-panes-time 1500
set-option -g display-time 1500
set-option -g monitor-activity on
set-option -g visual-activity on
set-option -g mouse-utf8 on
set-option -g default-terminal "screen-256color"
### }}}
### tmux-powerline {{{
TMUX_POWERLINE_SEPARATOR_LEFT_BOLD="◀"
TMUX_POWERLINE_SEPARATOR_LEFT_THIN="❮"
TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD="▶"
TMUX_POWERLINE_SEPARATOR_RIGHT_THIN="❯"
TMUX_POWERLINE_GIT="ⓦ"
set -g status on
set -g status-utf8 on
set-option -g status on
set-option -g status-interval 2
set-option -g status-utf8 on
set-option -g status-justify "centre"
set-option -g status-left-length 60
set-option -g status-right-length 90
set-option -g status-left "#(~/dotfiles/.tmux/tmux-powerline/powerline.sh left)"
set-option -g status-right "#(~/dotfiles/.tmux/tmux-powerline/powerline.sh right)"
### }}}
### color {{{
set -g status-fg white
set -g status-bg black
set-option -g pane-border-fg colour235
set-option -g pane-active-border-fg colour240
### }}}
### keybind {{{
unbind C-b
set -g prefix ^T
bind t send-prefix
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind r source-file ~/.tmux.conf\; display-message "~/.tmux.conf"
bind K kill-pane
bind C-t run "tmux last-pane || tmux last-window || tmux new-window"
bind / list-keys -t vi-copy
bind ^r refresh-client
bind * list-clients
bind d detach
bind c new-window
bind w choose-window
bind C-o run "tmux last-pane || tmux last-window"
bind ^a last-window
bind s split-window -v
bind v split-window -h
bind A command-prompt -I "#W" "rename-window %%"
bind ^q confirm-before -p "kill-window #W? (y/n)" kill-window
bind \ confirm-before -p "kill-server? (y/n)" kill-server
bind ^y copy-mode
bind -r ^"[" copy-mode
bind p paste-buffer
bind -r ^] paste-buffer
# suspend client
unbind ^z
# break-pane
unbind !
# split-window
unbind "\""
# split-window -h
unbind %
# kill-window
unbind &
### }}}
## peco {{{
bind b split-window "tmux lsw | peco --initial-index $(tmux lsw | awk '/active.$/ {print NR-1}') | cut -d':' -f 1 | xargs tmux select-window -t"
bind B split-window "tmux ls | peco --initial-index $(tmux ls | awk '/attached.$/ {print NR-1}') | cut -d':' -f 1 | xargs tmux switch-client -t"
## }}}
### clipboard {{{
bind C-c run "tmux choose-buffer | xclip -i -selection clipboard"
bind-key -t vi-copy Enter copy-pipe "xclip -i -selection clipboard"
## mac
if-shell 'test "$(uname -s)" = Darwin && which reattach-to-user-namespace > /dev/null 2>&1' 'source-file ~/dotfiles/.tmux/.tmux.conf.mac'
### }}}
### copy-mode {{{
bind -t vi-copy Y select-line
bind y run 'tmux copy-mode\; send-keys Y Enter'
bind -t vi-copy V begin-selection
bind a run 'tmux copy-mode\; send-keys ggVG Enter'
### }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment