Skip to content

Commit

Permalink
Add information about Vim's other autocmd events (#1333)
Browse files Browse the repository at this point in the history
This lets you configure Vim to format your code even more frequently.
  • Loading branch information
josephfrazier authored and vjeux committed Apr 18, 2017
1 parent 565106d commit dc499ba
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Expand Up @@ -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:
Expand Down

0 comments on commit dc499ba

Please sign in to comment.