X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=.vimrc;h=0ff6ea1ec534ac8bde907caba3e627d601bb0d86;hb=9222c7dedad1e481a5d6e8cbf9aa0605ad5696dc;hp=1620a5d40ad0b78cd52e498f9a6807d38dbfce5e;hpb=684ab1c2680bcbf04f41a5dc6be809f93376bd2c;p=dotfiles.git diff --git a/.vimrc b/.vimrc index 1620a5d..0ff6ea1 100644 --- a/.vimrc +++ b/.vimrc @@ -589,19 +589,21 @@ 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 % + silent !chmod a+x % elseif !a:x && fx - !chmod a-x % + silent !chmod a-x % endif if v:shell_error echoerr 'Error running chmod: ' . v:shell_error endif checktime - execute "au! FileChangedShell " . fname + endfunction + function! _BufChangedCB() + autocmd! FileChangedShell endfunction command! ToggleXbit if executable(expand("%:p")) | call SetExecutableBit(0) | else | call SetExecutableBit(1) | endif endif