您可以将命令与| 组合使用,请参阅:bar 的帮助:
command! C update | silent make | redraw!
但是,有一种更简洁的方法可以实现您想要的。
只需启用'autowrite' 选项即可自动写入
:make之前修改过的文件:
'autowrite' 'aw' 'noautowrite' 'noaw'
'autowrite' 'aw' boolean (default off)
global
Write the contents of the file, if it has been modified, on each
:next, :rewind, :last, :first, :previous, :stop, :suspend, :tag, :!,
:make, CTRL-] and CTRL-^ command; and when a :buffer, CTRL-O, CTRL-I,
'{A-Z0-9}, or `{A-Z0-9} command takes one to another file.
Note that for some commands the 'autowrite' option is not used, see
'autowriteall' for that.
:make 的帮助中提到了此选项。