]> git.phdru.name Git - dotfiles.git/commitdiff
.vimrc: Don't use `execute` for fixed autocommands
authorOleg Broytman <phd@phdru.name>
Fri, 20 Apr 2018 13:30:08 +0000 (16:30 +0300)
committerOleg Broytman <phd@phdru.name>
Fri, 20 Apr 2018 13:30:08 +0000 (16:30 +0300)
.vimrc

diff --git a/.vimrc b/.vimrc
index 052ace0c2411344db22847dbfc9cab5f661c1183..e315350eb6cc3e85d321f99a6aedda7ed793948a 100644 (file)
--- a/.vimrc
+++ b/.vimrc
@@ -589,8 +589,9 @@ endif
 if executable('chmod')
    function! SetExecutableBit(x)
       checktime
+      " Avoid 'Reload Y/N?' question
+      autocmd FileChangedShell <buffer> call _BufChangedCB()
       let fx = executable(expand("%:p"))
-      execute "au FileChangedShell <buffer> call _BufChangedCB()"
       if a:x && !fx
          !chmod a+x %
       elseif !a:x && fx
@@ -602,7 +603,7 @@ if executable('chmod')
       checktime
    endfunction
    function! _BufChangedCB()
-      execute "au! FileChangedShell <buffer>"
+      autocmd! FileChangedShell <buffer>
    endfunction
    command! ToggleXbit if executable(expand("%:p")) | call SetExecutableBit(0) | else | call SetExecutableBit(1) | endif
 endif