Add information about Vim's other autocmd events (#1333)
This lets you configure Vim to format your code even more frequently.master
parent
565106dd63
commit
dc499ba990
15
README.md
15
README.md
|
@ -345,6 +345,21 @@ Then make Neoformat run on save:
|
||||||
autocmd BufWritePre *.js Neoformat
|
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
|
#### 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:
|
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:
|
||||||
|
|
Loading…
Reference in New Issue