###前提・実現したいこと
vimの保存時にtagsファイルをアップデートする処理をしたいです.
ctagsの実行はgitのhooksを使用しています.
環境は,
Mac OS X
iTerm2
fishシェル
を使用しています.
###発生している問題・エラーメッセージ
保存時にシェルスクリプトを実行する処理をinit.vimに記述していますが、その実行時にエラーが起きています.
alias: Expected at most 2 args, got 3 - (line 1): Unsupported use of '&&'. In fish, please use 'COMMAND; and COMMAND'. begin; [ -f ".git/hooks/ctags" ] && .git/hooks/ctags ^ from sourcing file - called on line 60 of file /usr/local/Cellar/fish/2.7.0/share/fish/functions/eval.fish in function 'eval' called on standard input source: Error while reading file '-'
###該当のソースコード
vim
1au BufWritePost *.php silent! !eval '[ -f ".git/hooks/ctags" ] and .git/hooks/ctags'
.git/hooks/ctagsに以下のように記述しています.
#!/bin/sh set -e PATH="/usr/local/bin:$PATH" dir="`git rev-parse --git-dir`" trap 'rm -f "$dir/$$.tags"' EXIT ctags --tag-relative=yes -R -f "$dir/$$.tags" --fields=+aimlS --languages=php --PHP-kinds=+cdfint-av --exclude=composer.phar --exclude=*Test.php --exclude=*phpunit* --exclude=".git" mv "$dir/$$.tags" "$dir/tags"
init.vimに記述したevalで実行する処理で、.git/hooks/ctagsを実行しようとしているのはわかるのですが、
[-f ".git/hooks/ctags"]
の部分が何をしているのかよくわかりません.
###補足情報(言語/FW/ツール等のバージョンなど)
このサイトを参考にして実装しました.
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/01/01 14:35
2018/01/01 15:23
2018/01/02 07:43
2018/01/27 04:41