Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a vim auto-command group that looks like this:

augroup filetypedetect_wiki
    au!
    au! FileType vimwiki iabbrev cfo %% TODO {{{1<esc>hhhhhhhhveh
    au! FileType vimwiki iabbrev cfc %% TODO }}}1<esc>hhhhhhhhveh
    au! FileType vimwiki :set foldmethod=marker
    au! FileType vimwiki :set spell
    " Insert a comment block
    au! FileType vimwiki iabbrev ccc {{{ ><cr>    $ <cr>}}}<esc>kllllli
    "===Wiki markup macros
    au! FileType vimwiwki :nnoremap <leader>h1 ^i= <esc>A =<esc>^
    au! FileType vimwiwki imap <leader>h1 <esc>^i= <esc>A =<esc>^
    au! FileType vimwiwki nnoremap <leader>h2 ^i== <esc>A ==<esc>^
    au! FileType vimwiwki imap <leader>h2 <esc>^i== <esc>A ==<esc>^
    au! FileType vimwiwki nnoremap <leader>h3 ^i=== <esc>A ===<esc>^
    au! FileType vimwiwki imap <leader>h3 <esc>^i=== <esc>A ===<esc>^
    au! FileType vimwiwki nnoremap <leader>h4 ^i==== <esc>A ====<esc>^
    au! FileType vimwiwki imap <leader>h4 <esc>^i==== <esc>A ====<esc>^
    au! FileType vimwiwki nnoremap <leader>h5 ^i===== <esc>A =====<esc>^
    au! FileType vimwiwki imap <leader>h5 <esc>^i===== <esc>A =====<esc>^
    au! FileType vimwiwki nnoremap <leader>h6 ^i====== <esc>A ======<esc>^
    au! FileType vimwiwki imap <leader>h6 <esc>^i====== <esc>A ======<esc>^
    au! FileType vimwiwki nnoremap <leader>wm bi[[<esc>A]]<esc>
    au! FileType vimwiwki imap <leader>h6 <esc>bi[[<esc>A]]<esc>
augroup END

However, I can only use one of the commands in the list when I open a vimwiki file:

au! FileType vimwiki iabbrev ccc {{{ ><cr>    $ <cr>}}}<esc>kllllli

Today, I tried to see what was available by typing this command:

:au FileType vimwiki

When I did, I saw this:

:au FileType vimwiki
--- Auto-Commands ---
filetypedetect_wiki  FileType
    vimwiki   iabbrev ccc {{{ ><cr>    $ <cr>}}}<esc>kllllli

So that confirms my suspicions that only one autocommand is being loaded. But why is that the case? Is there a funny character that is breaking the group?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

au! deletes are defined autocmds, so I don't think you want this when defining your commands. Try removing the exclamation from everything except the first one, so it looks something like this:

augroup filetypedetect_wiki
    au!
    au FileType vimwiki iabbrev cfo %% TODO {{{1<esc>hhhhhhhhveh
    au FileType vimwiki iabbrev cfc %% TODO }}}1<esc>hhhhhhhhveh
share|improve this answer
    
Oh man, I can't believe that my typo was that obvious. Thanks a ton for your help! –  Tom Purl Aug 9 '12 at 12:34
    
i think the creator of the command's ! meaning is partly to blame too. Many times the commands imply that the ! has a global meaning of "force" or "without prompting" or even "don't complain or tell me about this, even if it has problems". It should have been made more clear that the ! suffix is not just used when defining things forcefully, like with map and map!, looking at that it is easy to see how anyone would make this sort of mistake. People say read the FM, but anyone who's attempted to read the entire vim documentation,has long fell to sleep or gone crazy because it's so misorganized! –  osirisgothra Oct 4 at 14:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.