again, split movement

master
Daniel Nägele 11 years ago
parent d48e630648
commit d4c48bcf83
  1. 30
      vimrc

30
vimrc

@ -159,36 +159,6 @@ if iCanHazVundle == 0
endif endif
"" }}} "" }}}
"####################################################################
" switch vim splits with the same keys as tmux panes. {{{
" Credit to https://github.com/aaronjensen
"####################################################################
if exists('$TMUX')
function! TmuxOrSplitSwitch(wincmd, tmuxdir)
let previous_winnr = winnr()
execute "wincmd " . a:wincmd
if previous_winnr == winnr()
" The sleep and & gives time to get back to vim so tmux's focus tracking
" can kick in and send us our ^[[O
execute "silent !sh -c 'sleep 0.01; tmux select-pane -" . a:tmuxdir . "' &"
redraw!
endif
endfunction
let previous_title = substitute(system("tmux display-message -p '#{pane_title}'"), '\n', '', '')
let &t_ti = "\<Esc>]2;vim\<Esc>\\" . &t_ti
let &t_te = "\<Esc>]2;". previous_title . "\<Esc>\\" . &t_te
nnoremap <silent> <C-h> :call TmuxOrSplitSwitch('h', 'L')<cr>
nnoremap <silent> <C-j> :call TmuxOrSplitSwitch('j', 'D')<cr>
nnoremap <silent> <C-k> :call TmuxOrSplitSwitch('k', 'U')<cr>
nnoremap <silent> <C-l> :call TmuxOrSplitSwitch('l', 'R')<cr>
else
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
endif
"" }}}
"#################################################################### "####################################################################
" bundles and their options {{{ " bundles and their options {{{
"#################################################################### "####################################################################

Loading…
Cancel
Save