回答:
:executeVimのすべてのコマンド引数は、評価されるように設計されていない限り、文字どおりに解釈されます。コマンドを動的に作成するには、を使用できます:execute。への各引数:executeが評価され、それらはすべてスペースで結合され、最終的なコマンドを生成します。
function Compile_and_run(game, major, minor)
execute '!_compile' a:game a:major a:minor
endfunction
shellescape()を使用してシェルに渡される引数をエスケープすることをお勧めしますshellescape()。文字列を受け取り、シェルコマンドで使用するためにエスケープします。
function Compile_and_run(game, major, minor)
execute '!_compile' shellescape(a:game) shellescape(a:major) shellescape(a:minor)
endfunction
:executeの引数は、文字列として評価されるVimScript式です。複数の引数を渡すと、それらはスペースで結合されます。最初の引数は単なるリテラル文字列なので、引用符で囲みます。
''ために!_compile他の引数以外の?