From c4eb15e5b73a767d0a27001ce593ace740fb9c66 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 15 Mar 2019 16:26:57 +0100 Subject: [PATCH] integrate vim and tmux pane movement --- .config/nvim/init.vim | 11 ++++++++++- .config/tmux/tmux.conf | 3 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 00e6382..17cfa49 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -5,6 +5,7 @@ call plug#begin('~/.local/share/nvim/plugged') " Base Plug 'tpope/vim-sensible' Plug 'tpope/vim-commentary' +Plug 'christoomey/vim-tmux-navigator' " add seamless movement between vim and tmux " Ecosystem " Plug 'tpope/vim-fugitive' - Will have to take a closer look some other time @@ -44,6 +45,9 @@ let g:tmuxline_preset = { \'z' : '#H', \'options' : {}} +" automatically save the current buffer when navigating away from vim +let g:tmux_navigator_save_on_switch = 1 + " VIM SETTINGS " set truecolor (neovim) set termguicolors @@ -110,7 +114,12 @@ vnoremap nnoremap W :%s/\s\+$//:let @/='' " 'open new tab' with leader-t (opens new buffer and switches to it) -nnoremap t v +" open actual new tab with leader-T +nnoremap t v:NERDTreeToggle +nnoremap T :tabedit . + +" save current buffer with Ctrl-s +nnoremap :w " open NERDtree with leader-e nnoremap e :NERDTreeToggle diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index acd0ae6..81c450b 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -53,6 +53,7 @@ set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'tmux-plugins/tmux-yank' set -g @plugin 'tmux-plugins/tmux-prefix-highlight' set -g @plugin 'Morantron/tmux-fingers' +set -g @plugin 'christoomey/vim-tmux-navigator' run -b "${TMUX_PLUGIN_MANAGER_PATH}/tpm/tpm" @@ -156,6 +157,6 @@ setw -g window-status-activity-fg "#c8c8c8" setw -g window-status-separator "" setw -g window-status-bg "#2e2e2e" set -g status-left "#[fg=#c8c8c8,bg=#2e2e2e] #S #[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]#[fg=#c8c8c8,bg=#2e2e2e] #(whoami) #[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]#[fg=#c8c8c8,bg=#2e2e2e] #I:#P #[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]" -set -g status-right "#[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]#{prefix_highlight}#[fg=#c8c8c8,bg=#2e2e2e] %H:%M:%S #[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]#[fg=#c8c8c8,bg=#2e2e2e] %d-%b-%y #[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]#[fg=#c8c8c8,bg=#2e2e2e] #H " +set -g status-right "#[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]#{prefix_highlight} #[fg=#c8c8c8,bg=#2e2e2e] %H:%M:%S #[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]#[fg=#c8c8c8,bg=#2e2e2e] %d-%b-%y #[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]#[fg=#c8c8c8,bg=#2e2e2e] #H " setw -g window-status-format "#[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]#[default] #I #W #[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]" setw -g window-status-current-format "#[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]#[fg=#c8c8c8,bg=#2e2e2e]  #I #W #[fg=#2e2e2e,bg=#2e2e2e,nobold,nounderscore,noitalics]"