Add information about Vim's other autocmd events (#1333)

This lets you configure Vim to format your code even more frequently.
master
Joseph Frazier 2017-04-18 18:30:16 -04:00 committed by Christopher Chedeau
parent 565106dd63
commit dc499ba990
1 changed files with 15 additions and 0 deletions

View File

@ -345,6 +345,21 @@ Then make Neoformat run on save:
autocmd BufWritePre *.js Neoformat
```
#### Other `autocmd` events
You can also make Vim format your code more frequently, by setting an `autocmd` for other events. Here are a couple of useful ones:
* `TextChanged`: after a change was made to the text in Normal mode
* `InsertLeave`: when leaving Insert mode
For example, you can format on both of the above events together with `BufWritePre` like this:
```vim
autocmd BufWritePre,TextChanged,InsertLeave *.js Neoformat
```
See `:help autocmd-events` in Vim for details.
#### Customizing Prettier in Vim
If your project requires settings other than the default Prettier settings, you can pass arguments to do so in your `.vimrc` or [vim project](http://vim.wikia.com/wiki/Project_specific_settings), you can do so: