Also set tmux navigation flag on FocusGained
Make using the `@vim$TMUX_PANE` window flag much more robust by unsetting it every time the zsh prompt is drawn and setting it again using a `FocusGained` `autocmd` in vim. This removes the need for the hacky check for zsh in the conditional defined in the `in_vim` variable.
This commit is contained in:
parent
1f07473b57
commit
7af8660355
9
autoload/tmux.vim
Normal file
9
autoload/tmux.vim
Normal file
@ -0,0 +1,9 @@
|
||||
let s:tmux_option = '@vim'.substitute($TMUX_PANE, '%', '\\%', 'g')
|
||||
|
||||
function! tmux#setNavigationFlag() abort
|
||||
call system('tmux set-window-option '.s:tmux_option.' 1')
|
||||
endfunction
|
||||
|
||||
function! tmux#unsetNavigationFlag() abort
|
||||
call system('tmux set-window-option -u '.s:tmux_option)
|
||||
endfunction
|
@ -2,10 +2,10 @@ augroup benieAugroup
|
||||
autocmd!
|
||||
|
||||
if $TMUX !=# ''
|
||||
" Set tmux window option to detect when to change pane.
|
||||
let s:tmux_option = '@vim'.substitute($TMUX_PANE, '%', '\\%', 'g')
|
||||
call system('tmux set-window-option '.s:tmux_option.' 1')
|
||||
au VimLeave * call system('tmux set-window-option -u '.s:tmux_option)
|
||||
" [Un]set tmux window option to detect when to change pane.
|
||||
call tmux#setNavigationFlag()
|
||||
au FocusGained * call tmux#setNavigationFlag()
|
||||
au VimLeave * call tmux#unsetNavigationFlag()
|
||||
endif
|
||||
|
||||
" Reopening a file at last curson position
|
||||
|
Loading…
x
Reference in New Issue
Block a user