Try:
:setf none
or (equivalently):
:set ft=
If you want to do it automatically, you'll need to configure the syntax detection. Create a file (if it doesn't exist): vimfiles/after/filetype.vim or ~/.vim/after/filetype.vim. In this file, add the following line:
au BufNewFile,BufRead *.markdown set ft=none
Alternatively, download the markdown syntax from here (I've not tried this) and configure with:
au BufNewFile,BufRead *.markdown set ft=mkd
For more information:
:help :setf
:help 'filetype'
:help :autocmd
:help BufRead
:help BufNewFile
For information, the problem arises because the .markdown
extension is not recognised, so Vim looks at the contents to try to determine what the file type is. Presumably there is something in your file that looks a little like a configuration file, so it does its best guess. The guess is carried out in the system filetype.vim
, typically in c:\vim\vim72 or /usr/share/vim/vim72/filetype.vim (I think) and looks like this:
" Generic configuration file (check this last, it's just guessing!)
au BufNewFile,BufRead,StdinReadPost *
\ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat
\ && (getline(1) =~ '^#' || getline(2) =~ '^#' || getline(3) =~ '^#'
\ || getline(4) =~ '^#' || getline(5) =~ '^#') |
\ setf conf |
\ endif
This checks whether any of the first five lines start with a #
and if they do and no other filetype has been matched, it sets the filetype to conf
.