X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=.vimrc;h=052ace0c2411344db22847dbfc9cab5f661c1183;hb=ad1fd6dcf5ea7e44ddb3f1e912ffbfc6aa47581b;hp=bb97edbbe8e9e16a6bea41408283798516eede09;hpb=0bf6afa72ca190d7378752944ef901f8b84cea6f;p=dotfiles.git diff --git a/.vimrc b/.vimrc index bb97edb..052ace0 100644 --- a/.vimrc +++ b/.vimrc @@ -589,9 +589,8 @@ endif if executable('chmod') function! SetExecutableBit(x) checktime - let fname = expand("%:p") - let fx = executable(fname) - execute "au FileChangedShell " . fname . " :echo" + let fx = executable(expand("%:p")) + execute "au FileChangedShell call _BufChangedCB()" if a:x && !fx !chmod a+x % elseif !a:x && fx @@ -601,9 +600,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() + execute "au! FileChangedShell " + endfunction + command! ToggleXbit if executable(expand("%:p")) | call SetExecutableBit(0) | else | call SetExecutableBit(1) | endif endif