From fefb347090ff343f13ad354b9472e68d6a36e4a8 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Mon, 26 Mar 2018 07:03:51 +0300 Subject: [PATCH] .vimrc: Fix checktime/FileChangedShell When `checktime` is called in an autocommand it doesn't trigger FileChangedShell immediately. Instead it waits until the end of the autocommand. So we have to remove FileChangedShell autocommand when it's triggered, not inside SetExecutableBit function called from an autocommand. --- .vimrc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.vimrc b/.vimrc index 1620a5d..ab3609e 100644 --- a/.vimrc +++ b/.vimrc @@ -591,7 +591,7 @@ if executable('chmod') checktime let fname = expand("%:p") let fx = executable(fname) - execute "au FileChangedShell " . fname . " :echo" + execute "au FileChangedShell call _BufChangedCB()" if a:x && !fx !chmod a+x % elseif !a:x && fx @@ -601,7 +601,9 @@ if executable('chmod') echoerr 'Error running chmod: ' . v:shell_error endif checktime - execute "au! FileChangedShell " . fname + endfunction + function! _BufChangedCB() + execute "au! FileChangedShell " endfunction command! ToggleXbit if executable(expand("%:p")) | call SetExecutableBit(0) | else | call SetExecutableBit(1) | endif endif -- 2.39.2