Created
January 26, 2013 22:30
-
-
Save xcoderzach/4645082 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func! MoveWithTmux(keypressed,direction) | |
let k = a:keypressed | |
let d = a:direction | |
" get the old window number | |
let oldw = winnr() | |
exec "wincmd " . k | |
let neww = winnr() | |
" If we are in the same split, we must be at a boundary so tell tmux to switch split | |
if oldw == neww | |
" silent so it doesn't show the command. | |
" call system vs ! so that the screen doesn't flash | |
exe "call system('tmux select-pane " . d . "')" | |
end | |
endfunction | |
nnoremap <silent><c-j> :call MoveWithTmux('j', '-D')<cr> | |
nnoremap <silent><c-k> :call MoveWithTmux('k', '-U')<cr> | |
nnoremap <silent><c-h> :call MoveWithTmux('h', '-L')<cr> | |
nnoremap <silent><c-l> :call MoveWithTmux('l', '-R')<cr> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment