mirror of
https://github.com/jbowdre/dotfiles.git
synced 2024-11-22 09:22:19 +00:00
initial vim config
This commit is contained in:
parent
e6dde75ef7
commit
a8b2f8cb1f
1 changed files with 25 additions and 0 deletions
25
vim/.vimrc
Normal file
25
vim/.vimrc
Normal file
|
@ -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 = "\<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
|
Loading…
Reference in a new issue