Use tmux window option for pane change detection
Improve tmux integration when changing buffers or panes when vim was invoked by another process so that seamless navigation works when the `vim$TMUX_PANE` window option has been set, not only when the pane's command matches a simple regex.
This commit is contained in:
parent
10eb5fffea
commit
1f07473b57
@ -1,6 +1,13 @@
|
|||||||
augroup benieAugroup
|
augroup benieAugroup
|
||||||
autocmd!
|
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)
|
||||||
|
endif
|
||||||
|
|
||||||
" Reopening a file at last curson position
|
" Reopening a file at last curson position
|
||||||
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
|
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
|
||||||
\ | exe "normal! g'\"" | endif
|
\ | exe "normal! g'\"" | endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user