Reputation: 1027
In my .vimrc I add this,
autocmd BufNewFile,BufRead *.markdown setfiletype octopress
But it seems not working because after I open a xxx.markdown file and input the command setfiletype octopress
everything works fine.
Here is my intact .vimrc
set nocompatible
syntax on
filetype off
colorscheme desert
set nu
set mouse=a
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
filetype plugin indent on
Bundle 'vim-octopress'
autocmd FileType markdown setfiletype octopress
Hope someone can help me and tell me how to debug this thing...
Upvotes: 2
Views: 10561
Reputation:
filetype plugin on
filetype indent on
au FileType htm,html,php,css setl ts=2 sw=2 sts=2 et
Upvotes: 0
Reputation: 47122
I don't see this:
autocmd BufNewFile,BufRead *.markdown setfiletype octopress
I only see this at the end:
autocmd FileType markdown setfiletype octopress
I think fixing that will fix you issue.
Update:
A couple more things to consider. First, the Markdown-syntax plugin sets the filetype to be mkd
, not markdown
. This doesn't seem to work correctly either:
autocmd FileType mkd setfiletype octopress
But this does:
au FileType mkd set filetype=octopress
...And that makes sense now. setfiletype
won't set the file type if it's already been set. Since it was already flagged as being of type mkd
, it wasn't being updated to the new file type.
Upvotes: 5
Reputation: 1027
It's because setfiletype ... but only if not done yet in a sequence of (nested) autocommands.
Doc about setfiletype function
Upvotes: 0