私が使用しているバージョン管理システム (Perforce) の .vimrc にいくつかのマクロを作成しました (vim の perforce プラグインを提案しないでください。試してみましたが、気に入りません)。それらはすべて正常に動作しますが、確認プロンプトが原因で壊れる元に戻すマクロを除きます (変更を誤ってファットフィンガーで削除しないようにするために必要です)。現在、次のようになっています。
map <F8> :if confirm('Revert to original?', "&Yes\n&No", 1)==1 | !p4 revert <C-R>=expand("%:p")<CR><CR><CR>:edit<CR> | endif
これにより、vim がファイルをロードしようとすると、bash がエラーを出します。
bin/bash: -c: line 0: syntax error near unexpected token `('
bashが見ているバッファを見ると、vimがbash用の部分だけでなく、最初のパイプの後にすべてを送信するというエラーがあるようです。いくつかの代替案を試しましたが、うまくいかないようです。パイプとendifを削除したときに確認ダイアログを正しく表示するようにしましたが(省略形のifを使用)、ユーザーが応答した後にvimが文句を言います。