This commit is contained in:
Christian Nieves
2022-10-20 12:01:05 -05:00
parent b178f8c58f
commit 10714e9258
56 changed files with 811 additions and 266 deletions

View File

@ -16,11 +16,11 @@ function! s:VimNavigate(direction)
endfunction
if !get(g:, 'tmux_navigator_no_mappings', 0)
nnoremap <silent> <c-h> :TmuxNavigateLeft<cr>
nnoremap <silent> <c-j> :TmuxNavigateDown<cr>
nnoremap <silent> <c-k> :TmuxNavigateUp<cr>
nnoremap <silent> <c-l> :TmuxNavigateRight<cr>
nnoremap <silent> <c-\> :TmuxNavigatePrevious<cr>
noremap <silent> <c-h> :<C-U>TmuxNavigateLeft<cr>
noremap <silent> <c-j> :<C-U>TmuxNavigateDown<cr>
noremap <silent> <c-k> :<C-U>TmuxNavigateUp<cr>
noremap <silent> <c-l> :<C-U>TmuxNavigateRight<cr>
noremap <silent> <c-\> :<C-U>TmuxNavigatePrevious<cr>
endif
if empty($TMUX)
@ -50,6 +50,12 @@ if !exists("g:tmux_navigator_preserve_zoom")
let g:tmux_navigator_preserve_zoom = 0
endif
if !exists("g:tmux_navigator_no_wrap")
let g:tmux_navigator_no_wrap = 0
endif
let s:pane_position_from_direction = {'h': 'left', 'j': 'bottom', 'k': 'top', 'l': 'right'}
function! s:TmuxOrTmateExecutable()
return (match($TMUX, 'tmate') != -1 ? 'tmate' : 'tmux')
endfunction
@ -120,6 +126,9 @@ function! s:TmuxAwareNavigate(direction)
if g:tmux_navigator_preserve_zoom == 1
let l:args .= ' -Z'
endif
if g:tmux_navigator_no_wrap == 1
let args = 'if -F "#{pane_at_' . s:pane_position_from_direction[a:direction] . '}" "" "' . args . '"'
endif
silent call s:TmuxCommand(args)
if s:NeedsVitalityRedraw()
redraw!