" Vim support file to detect file types " Check if file type config is already loaded {{{ if exists("did_load_filetypes") finish endif " }}} " Filetype detection {{{ " " According to ":help BufRead", this augroup is also evaluated also on " ":filetype detect". augroup filetypedetect autocmd! " Calendar autocmd BufRead,BufNewFile *.rem setfiletype remind " Trac autocmd BufRead,BufNewFile *.trac setfiletype tracwiki autocmd BufRead,BufNewFile *.tracwiki setfiletype tracwiki " Programming languages autocmd BufRead,BufNewFile kvmxfile setfiletype sh autocmd BufRead,BufNewFile Vagrantfile setfiletype ruby autocmd BufRead,BufNewFile *.py setfiletype python autocmd BufRead,BufNewFile *.pp setfiletype puppet autocmd BufRead,BufNewFile *.php setfiletype php autocmd BufRead,BufNewFile *.thtml setfiletype php autocmd BufRead,BufNewFile *.vue setfiletype html " Markdown " " This handling is disabled by default, since it may be conflicting " with something. " " Markdown folding through NestedMarkdownFolds() are not correctly working " with this configuration. " " Maybe what's happenning is that setting the "markdown" filetype " trigger behaviors that conflicts with our custom configuration. " "autocmd BufRead,BufNewFile,BufEnter *.mdwn setfiletype markdown "autocmd BufRead,BufNewFile,BufEnter *.md setfiletype markdown augroup END " }}} " Markdown workaround {{{ " " Since the following configuration is not working at ftplugin/markdown.vim, " it's being used here. " " Also note that BufEnter event also need to be included, otherwise foldings " won't be correctly applied in some Markdown files loaded in new windows. augroup filetype_markdown autocmd! "autocmd BufRead,BufNewFile,BufEnter *.md set foldexpr=NestedMarkdownFolds() "autocmd BufRead,BufNewFile,BufEnter *.md set autoindent smartindent "autocmd BufRead,BufNewFile,BufEnter *.md set formatoptions=tcroqn2 comments=n:> autocmd BufRead,BufNewFile,BufEnter *.md set tabstop=2 softtabstop=2 shiftwidth=2 expandtab augroup END " }}} " VIM filetype {{{ augroup filetype_vim autocmd! autocmd FileType vim setlocal foldmethod=marker augroup END " }}} " Drupal {{{ " Handle *.module, *.install, *.profile etc if has("autocmd") augroup filetype_drupal autocmd! autocmd BufRead,BufNewFile,BufEnter *.profile setfiletype php autocmd BufRead,BufNewFile,BufEnter *.module setfiletype php autocmd BufRead,BufNewFile,BufEnter *.install setfiletype php autocmd BufRead,BufNewFile,BufEnter *.test setfiletype php augroup END endif " }}}