autocmd

How to automatically execute a shell command after saving a file in Vim?

你说的曾经没有我的故事 提交于 2019-11-28 16:19:20
This is because I'd like to automatically run tests after each file save. I have looked at autocmd and BufWritePost but cannot make it work. Alex Howell This runs run_tests.sh after any file is saved, with the current filename as the only parameter: :autocmd BufWritePost * !run_tests.sh <afile> View the auto-command with: :autocmd BufWritePost * And remove all auto-commands from the previous with: :autocmd! BufWritePost * 来源: https://stackoverflow.com/questions/4627701/how-to-automatically-execute-a-shell-command-after-saving-a-file-in-vim

Vim run autocmd on all filetypes EXCEPT

天涯浪子 提交于 2019-11-27 10:59:53
I have a Vim autocmd that removes trailing whitespace in files before write. I want this almost 100% of the time, but there are a few filetypes that I'd like it disabled. Conventional wisdom is to list the filetypes you want an autocmd to run against in a comma-separated list, eg: autocmd BufWritePre *.rb, *.js, *.pl But in this case that would be onerous. Is there a way to match an autocmd pattern against all files EXCEPT those matching the pattern? I cannot find the equivalent to a NOT matcher in the docs. *.rb isn't a filetype. It's a file pattern. ruby is the filetype and could even be set

How to automatically execute a shell command after saving a file in Vim?

我是研究僧i 提交于 2019-11-27 09:45:56
问题 This is because I'd like to automatically run tests after each file save. I have looked at autocmd and BufWritePost but cannot make it work. 回答1: This runs run_tests.sh after any file is saved, with the current filename as the only parameter: :autocmd BufWritePost * !run_tests.sh <afile> View the auto-command with: :autocmd BufWritePost * And remove all auto-commands from the previous with: :autocmd! BufWritePost * 来源: https://stackoverflow.com/questions/4627701/how-to-automatically-execute-a

Vim run autocmd on all filetypes EXCEPT

风流意气都作罢 提交于 2019-11-26 15:23:23
问题 I have a Vim autocmd that removes trailing whitespace in files before write. I want this almost 100% of the time, but there are a few filetypes that I'd like it disabled. Conventional wisdom is to list the filetypes you want an autocmd to run against in a comma-separated list, eg: autocmd BufWritePre *.rb, *.js, *.pl But in this case that would be onerous. Is there a way to match an autocmd pattern against all files EXCEPT those matching the pattern? I cannot find the equivalent to a NOT