Bạn có thể sử dụng argslệnh thay thế:
command G execute ":args `git diff --name-only`"
Tập tin đầu tiên sẽ được mở và nếu bạn chạy :lssau khi thực hiện điều này, bạn cũng sẽ thấy các tập tin khác được liệt kê. Hoặc, như ghi chú romainl, bạn hoàn toàn không cần execute:
command G :args `git diff --name-only`
Các argaddlệnh có thể hữu ích quá. Từ :h args:
:ar[gs] [++opt] [+cmd] {arglist} :args_f
Define {arglist} as the new argument list and edit
the first one. This fails when changes have been made
and Vim does not want to abandon the current buffer.
Also see ++opt and +cmd.
{Vi: no ++opt}
:ar[gs]! [++opt] [+cmd] {arglist} :args_f!
Define {arglist} as the new argument list and edit
the first one. Discard any changes to the current
buffer.
Also see ++opt and +cmd.
{Vi: no ++opt}
:[count]arga[dd] {name} .. :arga :argadd E479
:[count]arga[dd]
Add the {name}s to the argument list. When {name} is
omitted add the current buffer name to the argument
list.
:nextlà một khả năng khác. Ngoài ra,:executekhông cần thiết, ở đây, vì vậy lệnh có thể được rút ngắncommand! G args `git diff --name-only`. AArgh, backticks là khó khăn.