Created
April 25, 2017 16:49
-
-
Save jerrymarino/0e1b0d79419c9f0ce138f0fa1a07b052 to your computer and use it in GitHub Desktop.
Minimal vim inspired tmux conf for OSX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Use ctrl-a for prefix | |
| unbind C-b | |
| set-option -g prefix C-a | |
| bind C-a send-prefix | |
| # OSX Fix copy and paste. If on ZSH replace bash with ZSH | |
| set-option -g default-command "reattach-to-user-namespace -l bash" | |
| # improve colors | |
| set -g default-terminal "screen-256color" | |
| # soften status bar color from harsh green to light gray | |
| set -g status-bg '#666666' | |
| set -g status-fg '#aaaaaa' | |
| # remove administrative debris (session name, hostname, time) in status bar | |
| set -g status-left '' | |
| set -g status-right | |
| # Vim like navigation | |
| setw -g mode-keys vi | |
| bind h select-pane -L | |
| bind j select-pane -D | |
| bind k select-pane -U | |
| bind l select-pane -R | |
| bind-key -r C-h select-window -t :- | |
| bind-key -r C-l select-window -t :+ | |
| bind P paste-buffer | |
| #bind-key -t vi-copy 'y' copy-selection | |
| #bind-key -t vi-copy 'r' rectangle-toggle | |
| # Visual mode entering | |
| bind-key -Tcopy-mode-vi 'v' send -X begin-selection | |
| # Yanking with reattach to user namespace to pbcopy | |
| bind-key -Tcopy-mode-vi 'y' send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" | |
| # Open files in vim | |
| # DANGERZONE! tmux-open seems to be a nicer version of this | |
| # but it didn't work for me and seems complex to setup. | |
| bind -Tcopy-mode-vi 'o' send -X copy-pipe-and-cancel "xargs -I{} tmux new-window 'vim {}'" | |
| # This seems unnecessary | |
| #bind-key -t vi-copy 'j' page-up | |
| #bind-key -t vi-copy 'k' page-down | |
| #bind-key -t vi-copy 'v' begin-selection | |
| #bind-key -t vi-copy 'y' copy-selection | |
| # 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" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment