如何告诉vim保存文件?


Answers:


12

您可以使用自动命令来完成。我没有一个会自动加载的文件,但是如果我知道要使用一个文件进行一段时间的编辑,编译,编辑,我将在Vim命令行上执行以下操作:

:au BufWritePost * make

您可以make用任何合适的build或run命令替换。


2

@garyjohn的答案是正确的。

让我添加一个示例,说明如何在coffeescript上运行多重编译:

# add these lines to your .vimrc file (~/.vimrc in my pc)
autocmd BufWritePost,FileWritePost *.coffee :silent !coffee --compile --join appstore/static/javascripts/angular/controllers.js file1.coffee file2.coffee

autocmd BufWritePost,FileWritePost *.coffee :silent !coffee --compile appstore/static/javascripts/angular/app.coffee appstore/static/javascripts/angular/directives.coffee appstore/static/javascripts/angular/filters.coffee appstore/static/javascripts/angular/services.coffee
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.