Multiple autocommands in vim

Viewed 27825

I've got some sections in my .vimrc that look like this:

autocmd Filetype ruby setlocal ts=2
autocmd Filetype ruby setlocal sts=2
autocmd Filetype ruby setlocal sw=2

now it seems I can convert them to this:

autocmd Filetype ruby setlocal ts=2 sts=2 sw=2

but here's my question: is there a vim way to have a structure like this?

<something mentioning Filetype ruby>
  setlocal ts=2
  setlocal sts=2
  ...
<end>

ie, can the autocmd Filetype bit somehow be made to address a group of actions? (this is a simple example, I'm really asking for more complicated situations.)

3 Answers
Related