Last Updated: June 24, 2016
·
172
· ryrych

Calling external command via Vim system command

Suppose that you want to call external git commit command and pass commit message from Vim register. If register contains ‘hello world’ string, system will treat each word as a separate command. To fix that issue I dug into Vim docs and found that this works as expected:

echo system("git ci ". '-m ' . string(@t))