2

Let's say I rename a augroup in my vimrc; what happens then? Do the autocmds inside that augroup get loaded twice? For example, let's say I rename the following augroup

augroup testgroup autocmd! autocmd BufWrite * :sleep 200m autocmd BufWrite * :echom "Foo" autocmd BufWrite * :echom "Bar" augroup END 

as

augroup TestGroup autocmd! autocmd BufWrite * :sleep 200m autocmd BufWrite * :echom "Foo" autocmd BufWrite * :echom "Bar" augroup END 

1 Answer 1

3

Your vimrc file is normally only loaded once per vim session. So if you change the file and rename the augroup, nothing happens in your running vim instance.

If you :source $MYVIMRC after you changed it you will end up with two versions of each of these autocommands. One in each group. To see which autocommands are defined you can execute

:au "lists all autocommands (potentially very many) :au BufWrite " lists all autocommands for the BufWrite event :au testgroup " lists all autocommands in the group "testgroup" :au TestGroup " lists all autocommands in the group "TestGroup" 

In order to remove all autocommads of the "testgroup" in a running vim instance you can execute :au! testgroup.

You can start reading at :h :au.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.