ソースを参照

Fix misuse of `|` in bash script autocmd

`endif` was getting interpreted as an argument to `!chmod`.
Weiyi Lou 9 年 前
コミット
e6af3af3a7
1 ファイル変更1 行追加1 行削除
  1. 1 1
      vim/settings/templates.vim

+ 1 - 1
vim/settings/templates.vim

@@ -2,7 +2,7 @@
 " Removes comments, places cursor at end of file.
 autocmd BufNewFile *.sh silent 0r ~/dotfiles/vim/templates/bashscript | silent 2,$ g/^#/d | normal G
 " Make shell scripts executable on save.
-autocmd BufWritePost *.sh if getline(1) =~ "^#!/" | silent !chmod +x <afile> | endif
+autocmd BufWritePost *.sh if getline(1) =~ "^#!/" | execute 'silent !chmod +x <afile>' | endif
 
 " Template for makefiles.
 autocmd BufNewFile [Mm]akefile silent 0r ~/dotfiles/vim/templates/makefile | silent 4,$ g/^#/d | normal G