diff --git a/.tmux.conf b/.tmux.conf index 19a31e9..236612f 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -63,6 +63,21 @@ setw -g monitor-activity on bind C-j previous-window bind C-k next-window +#bind -n M-Left select-pane -L +#bind -n M-Right select-pane -R +#bind -n M-Up select-pane -U +#bind -n M-Down select-pane -D + +# Smart pane switching with awareness of Vim splits. +# See: https://github.com/christoomey/vim-tmux-navigator +bind -n M-Up if "[ $(tmux display -p '#{pane_current_command}') = vim ]" "send-keys M-Up" "select-pane -U" +bind -n M-Down if "[ $(tmux display -p '#{pane_current_command}') = vim ]" "send-keys M-Down" "select-pane -D" +bind -n M-Left if "[ $(tmux display -p '#{pane_current_command}') = vim ]" "send-keys M-Left" "select-pane -L" +bind -n M-Right if "[ $(tmux display -p '#{pane_current_command}') = vim ]" "send-keys M-Right" "select-pane -R" + +bind -n C-Right if "[ $(tmux display -p '#{pane_current_command}') = vim ]" "send-keys C-Right" "next-window" +bind -n C-Left if "[ $(tmux display -p '#{pane_current_command}') = vim ]" "send-keys C-Right" "previous-window" + #set-option -g status-utf8 on set-option -g status-justify left set-option -g status-bg black diff --git a/.vimrc b/.vimrc index adea215..1719a30 100644 --- a/.vimrc +++ b/.vimrc @@ -289,15 +289,15 @@ set splitright " if multiple windows if bufwinnr(1) " vertically increase/decrease window size with alt+up/alt+down - map + - map - - imap a - imap a - " horizontally increase/decrease window size with alt+right/alt+left - map > - map < - imap a - imap a + nnoremap :TmuxNavigateUp + nnoremap :TmuxNavigateRight + imap :TmuxNavigateUp + imap :TmuxNavigateRight + " " horizontally increase/decrease window size with alt+right/alt+left + nnoremap :TmuxNavigateLeft + nnoremap :TmuxNavigateDown + imap :TmuxNavigateLeft + imap :TmuxNavigateDown " switch to next/previous tab with ctrl+right/ctrl+left map gt map gT @@ -636,4 +636,7 @@ let g:polyglot_disabled = ['latex'] " Visual incrementation. increment in block with ctrl-A Plugin 'triglav/vim-visual-increment' set nrformats=alpha,octal,hex + +Plugin 'christoomey/vim-tmux-navigator' +let g:tmux_navigator_no_mappings=1 call vundle#end()