Skip to content

Instantly share code, notes, and snippets.

@bubuzzz
Created February 9, 2017 21:49
Show Gist options
  • Save bubuzzz/4a6e975d23ce51be4fed76573af9696c to your computer and use it in GitHub Desktop.
Save bubuzzz/4a6e975d23ce51be4fed76573af9696c to your computer and use it in GitHub Desktop.

Revisions

  1. bubuzzz created this gist Feb 9, 2017.
    59 changes: 59 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,59 @@
    # List of plugins
    set -g @plugin 'tmux-plugins/tmux-sidebar'
    set -g @plugin 'tmux-plugins/tpm'
    set -g @plugin 'tmux-plugins/tmux-sensible'

    # Other examples:
    # set -g @plugin 'github_username/plugin_name'
    # set -g @plugin '[email protected]/user/plugin'
    # set -g @plugin '[email protected]/user/plugin'

    # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
    run '~/.tmux/plugins/tpm/tpm'

    bind Up select-pane -U
    bind k select-pane -U
    bind Down select-pane -D
    bind j select-pane -D
    bind Left select-pane -L
    bind h select-pane -L
    bind Right select-pane -R
    bind l select-pane -R

    # remap prefix from 'C-b' to 'C-x
    unbind C-b
    set -g prefix C-x
    bind C-x send-prefix

    # split panes using | and -
    bind \ split-window -h
    bind - split-window -v
    unbind '"'
    unbind %

    #
    # Set up tmux copy/paste
    # Copy-paste integration, need to install reattach-to-user-namespace first (brew install reattach-to-user-namespace)
    set-option -g default-shell /bin/zsh
    set-option -g default-command "reattach-to-user-namespace -l zsh"

    # set tmux to 256 colors
    set -g default-terminal "screen-256color"
    set-option -ga terminal-overrides ",screen-256color:Tc"

    # Use vim keybindings in copy mode
    setw -g mode-keys vi

    # Setup 'v' to begin selection as in Vim
    bind-key -t vi-copy v begin-selection
    bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"

    # Update default binding of `Enter` to also use copy-pipe
    unbind -t vi-copy Enter
    bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"

    # Bind ']' to use pbpaste
    bind ] run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer"

    # fix the delay esc of vim
    set -sg escape-time 0