Skip to content

Instantly share code, notes, and snippets.

@the-nerdery-dot-info
Created December 15, 2016 08:27
Show Gist options
  • Save the-nerdery-dot-info/843f4569de674f59e94a94674681d6b5 to your computer and use it in GitHub Desktop.
Save the-nerdery-dot-info/843f4569de674f59e94a94674681d6b5 to your computer and use it in GitHub Desktop.
Tmux Configuration
# 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"
or use tpm (tmux plugin manager)
set -g @plugin 'christoomey/vim-tmux-navigator'
run '~/.tmux/plugins/tpm/tpm'
#clear screen with control l
bind C-l send-keys 'C-l'
#see .vimrc additions below
let g:tmux_navigator_no_mappings = 1
nnoremap <silent> {Left-mapping} :TmuxNavigateLeft<cr>
nnoremap <silent> {Down-Mapping} :TmuxNavigateDown<cr>
nnoremap <silent> {Up-Mapping} :TmuxNavigateUp<cr>
nnoremap <silent> {Right-Mapping} :TmuxNavigateRight<cr>
nnoremap <silent> {Previous-Mapping} :TmuxNavigatePrevious<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment