From a8b2f8cb1f1db95c24f038d5e3e6343c79dacc29 Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Tue, 24 May 2022 10:59:24 -0500 Subject: [PATCH] initial vim config --- vim/.vimrc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 vim/.vimrc diff --git a/vim/.vimrc b/vim/.vimrc new file mode 100644 index 0000000..bb8de90 --- /dev/null +++ b/vim/.vimrc @@ -0,0 +1,25 @@ +" Tmux integration to switch panes with Ctrl+{hjkl} +if exists('$TMUX') + function! TmuxOrSplitSwitch(wincmd, tmuxdir) + let previous_winnr = winnr() + silent! execute "wincmd " . a:wincmd + if previous_winnr == winnr() + call system("tmux select-pane -" . a:tmuxdir) + redraw! + endif + endfunction + + let previous_title = substitute(system("tmux display-message -p '#{pane_title}'"), '\n', '', '') + let &t_ti = "\2;vim\\\" . &t_ti + let &t_te = "\2;". previous_title . "\\\" . &t_te + + nnoremap :call TmuxOrSplitSwitch('h', 'L') + nnoremap :call TmuxOrSplitSwitch('j', 'D') + nnoremap :call TmuxOrSplitSwitch('k', 'U') + nnoremap :call TmuxOrSplitSwitch('l', 'R') +else + map h + map j + map k + map l +endif \ No newline at end of file