X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=.vimrc;h=e315350eb6cc3e85d321f99a6aedda7ed793948a;hb=25be40cec6d307441a371e9a796dc29e87e32cf3;hp=bb97edbbe8e9e16a6bea41408283798516eede09;hpb=0bf6afa72ca190d7378752944ef901f8b84cea6f;p=dotfiles.git diff --git a/.vimrc b/.vimrc index bb97edb..e315350 100644 --- a/.vimrc +++ b/.vimrc @@ -589,9 +589,9 @@ endif if executable('chmod') function! SetExecutableBit(x) checktime - let fname = expand("%:p") - let fx = executable(fname) - execute "au FileChangedShell " . fname . " :echo" + " Avoid 'Reload Y/N?' question + autocmd FileChangedShell call _BufChangedCB() + let fx = executable(expand("%:p")) if a:x && !fx !chmod a+x % elseif !a:x && fx @@ -601,9 +601,11 @@ if executable('chmod') echoerr 'Error running chmod: ' . v:shell_error endif checktime - execute "au! FileChangedShell " . fname endfunction - command! Xbit if executable(expand("%:p")) | call SetExecutableBit(0) | else | call SetExecutableBit(1) | endif + function! _BufChangedCB() + autocmd! FileChangedShell + endfunction + command! ToggleXbit if executable(expand("%:p")) | call SetExecutableBit(0) | else | call SetExecutableBit(1) | endif endif