From e091cb0eaed708b831fb001968db9bb2ba51015d Mon Sep 17 00:00:00 2001 From: srdusr Date: Mon, 25 Mar 2024 06:02:51 +0200 Subject: Fixed tmux vi-mode --- .vim/vimrc | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to '.vim') diff --git a/.vim/vimrc b/.vim/vimrc index eef6ac8..99a29ea 100644 --- a/.vim/vimrc +++ b/.vim/vimrc @@ -468,7 +468,8 @@ map r :call RenameFile() augroup END "------------------------------------------------------------------------------- - +" +" Function to update tmux status function! UpdateTmuxStatus() if &filetype == "man" return @@ -491,20 +492,16 @@ function! UpdateTmuxStatus() let VI_MODE = "" " Clear VI_MODE to show vim mode silent execute "!tmux refresh-client -S" endif - - " Force tmux to update the status - silent execute "!tmux refresh-client -S" + silent execute "!tmux refresh-client -S" endfunction -augroup TmuxStatus - autocmd! - autocmd InsertLeave,InsertEnter * call UpdateTmuxStatus() - autocmd VimEnter * call UpdateTmuxStatus() - autocmd BufEnter * call UpdateTmuxStatus() - autocmd ModeChanged * call UpdateTmuxStatus() - autocmd WinEnter,WinLeave * call UpdateTmuxStatus() -augroup END - +" Set up autocommands for tmux status update +if !empty($TMUX) && system('command -v tmux >/dev/null 2>&1') == 0 + augroup TmuxStatus + autocmd! + autocmd InsertLeave,InsertEnter,VimEnter,BufEnter,ModeChanged,WinEnter,WinLeave * call UpdateTmuxStatus() + augroup END +endif "------------------------------------------------------------------------------- -- cgit v1.2.3