ih4cku / blog

deprecated, Git issues are great for writing blogs :)
2 stars 0 forks source link

autocommand groups #6

Open ih4cku opened 8 years ago

ih4cku commented 8 years ago

When using autocmd, Vim doesn't know if you want to replacing an existing one. So it just append the new operation to the event. This is when to use augroup.

Use autocmd! to clear previous group.

see: LVTHW - Autocommand Groups

ih4cku commented 8 years ago

Example:

augroup reload_vimrc " {
    autocmd!
    autocmd BufWritePost $MYVIMRC source $MYVIMRC
augroup END " }

Ref: Auto-Reload Your Vimrc