Quantcast
Channel: Why should I use augroup? - Vi and Vim Stack Exchange
Viewing all articles
Browse latest Browse all 4

Why should I use augroup?

$
0
0

I understand how auto commands work, and how to use them, but I'm somewhat unsure of what augroup is for. I read in :help augroup

                                                    *:aug* *:augroup*:aug[roup] {name}               Define the autocmd group name for the                                following ":autocmd" commands.  The name "end"                                or "END" selects the default group.                                To avoid confusion, the name should be                                different from existing {event} names, as this                                most likely will not do what you intended.

This doesn't really explain why they are useful, or why I would ever want to make an autocommand group name over just defining a bunch of autocommands next to each other.

For example, if autocommands foo and bar are related, why would I want to do

augroup spam  au!  au foo * foo  au bar * baraugroup END

when I could just do

"Autocommands for spamau foo * fooau bar * bar

Unless I'm misunderstanding what augroups are really for. So why are they useful?


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles



Latest Images