2013-09-16 10:53:38 -04:00
|
|
|
au BufRead,BufNewFile *.ino,*.pde set filetype=arduino
|
2014-11-10 20:37:21 -05:00
|
|
|
au BufNewFile,BufRead *.blade.php set filetype=blade
|
2015-07-18 16:54:07 -04:00
|
|
|
augroup CJSX
|
|
|
|
au!
|
|
|
|
autocmd BufNewFile,BufRead *.csx,*.cjsx set filetype=coffee
|
|
|
|
augroup END
|
2015-07-18 15:29:35 -04:00
|
|
|
autocmd BufNewFile,BufRead *.clj,*.cljs,*.edn,*.cljx,*.cljc setlocal filetype=clojure
|
2013-09-16 10:53:38 -04:00
|
|
|
autocmd BufNewFile,BufRead *.coffee set filetype=coffee
|
|
|
|
autocmd BufNewFile,BufRead *Cakefile set filetype=coffee
|
|
|
|
autocmd BufNewFile,BufRead *.coffeekup,*.ck set filetype=coffee
|
|
|
|
autocmd BufNewFile,BufRead *._coffee set filetype=coffee
|
|
|
|
function! s:DetectCoffee()
|
|
|
|
if getline(1) =~ '^#!.*\<coffee\>'
|
|
|
|
set filetype=coffee
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
autocmd BufNewFile,BufRead * call s:DetectCoffee()
|
|
|
|
autocmd BufNewFile,BufReadPost *.feature,*.story set filetype=cucumber
|
2013-09-26 06:48:01 -04:00
|
|
|
au BufNewFile,BufRead Dockerfile set filetype=dockerfile
|
2014-08-27 12:16:33 -04:00
|
|
|
au BufRead,BufNewFile *.eex set filetype=eelixir
|
|
|
|
au FileType eelixir setl sw=2 sts=2 et iskeyword+=!,?
|
2013-09-16 10:53:38 -04:00
|
|
|
au BufRead,BufNewFile *.ex,*.exs set filetype=elixir
|
|
|
|
au FileType elixir setl sw=2 sts=2 et iskeyword+=!,?
|
2014-11-10 20:37:21 -05:00
|
|
|
function! s:DetectElixir()
|
|
|
|
if getline(1) =~ '^#!.*\<elixir\>'
|
|
|
|
set filetype=elixir
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
autocmd BufNewFile,BufRead * call s:DetectElixir()
|
2014-04-14 19:14:47 -04:00
|
|
|
autocmd BufNewFile,BufRead *.em set filetype=ember-script
|
|
|
|
autocmd FileType ember-script set tabstop=2|set shiftwidth=2|set expandtab
|
2014-08-12 18:03:22 -04:00
|
|
|
autocmd BufNewFile,BufRead *.emblem set filetype=emblem
|
|
|
|
autocmd FileType emblem set tabstop=2|set shiftwidth=2|set expandtab
|
2014-04-14 19:05:44 -04:00
|
|
|
autocmd BufNewFile,BufRead *.git/{,modules/**/}{COMMIT_EDIT,TAG_EDIT,MERGE_,}MSG set ft=gitcommit
|
2015-01-23 15:09:23 -05:00
|
|
|
autocmd BufNewFile,BufRead *.git/config,.gitconfig,gitconfig,.gitmodules set ft=gitconfig
|
|
|
|
autocmd BufNewFile,BufRead */.config/git/config set ft=gitconfig
|
|
|
|
autocmd BufNewFile,BufRead *.git/modules/**/config set ft=gitconfig
|
|
|
|
autocmd BufNewFile,BufRead git-rebase-todo set ft=gitrebase
|
|
|
|
autocmd BufNewFile,BufRead .gitsendemail.* set ft=gitsendemail
|
2013-09-16 10:53:38 -04:00
|
|
|
autocmd BufNewFile,BufRead *.git/**
|
|
|
|
\ if getline(1) =~ '^\x\{40\}\>\|^ref: ' |
|
|
|
|
\ set ft=git |
|
|
|
|
\ endif
|
|
|
|
autocmd BufNewFile,BufRead,StdinReadPost *
|
|
|
|
\ if getline(1) =~ '^\(commit\|tree\|object\) \x\{40\}\>\|^tag \S\+$' |
|
|
|
|
\ set ft=git |
|
|
|
|
\ endif
|
2014-07-29 07:03:49 -04:00
|
|
|
autocmd BufNewFile,BufRead *
|
|
|
|
\ if getline(1) =~ '^From \x\{40\} Mon Sep 17 00:00:00 2001$' |
|
|
|
|
\ set filetype=gitsendemail |
|
|
|
|
\ endif
|
2014-08-12 18:55:50 -04:00
|
|
|
let s:current_fileformats = ''
|
|
|
|
let s:current_fileencodings = ''
|
|
|
|
function! s:gofiletype_pre()
|
2015-05-11 09:05:13 -04:00
|
|
|
let s:current_fileformats = &g:fileformats
|
|
|
|
let s:current_fileencodings = &g:fileencodings
|
|
|
|
set fileencodings=utf-8 fileformats=unix
|
|
|
|
setlocal filetype=go
|
2014-08-12 18:55:50 -04:00
|
|
|
endfunction
|
|
|
|
function! s:gofiletype_post()
|
2015-05-11 09:05:13 -04:00
|
|
|
let &g:fileformats = s:current_fileformats
|
|
|
|
let &g:fileencodings = s:current_fileencodings
|
2014-08-12 18:55:50 -04:00
|
|
|
endfunction
|
|
|
|
au BufNewFile *.go setlocal filetype=go fileencoding=utf-8 fileformat=unix
|
|
|
|
au BufRead *.go call s:gofiletype_pre()
|
|
|
|
au BufReadPost *.go call s:gofiletype_post()
|
2015-05-11 09:05:13 -04:00
|
|
|
au BufRead,BufNewFile *.tmpl set filetype=gohtmltmpl
|
2014-04-14 19:05:44 -04:00
|
|
|
autocmd BufNewFile,BufRead *.haml,*.hamlbars,*.hamlc setf haml
|
2013-09-16 10:53:38 -04:00
|
|
|
autocmd BufNewFile,BufRead *.sass setf sass
|
|
|
|
autocmd BufNewFile,BufRead *.scss setf scss
|
2014-06-08 07:22:29 -04:00
|
|
|
autocmd BufNewFile,BufRead *.hx setf haxe
|
2013-09-16 10:53:38 -04:00
|
|
|
autocmd BufNewFile,BufReadPost *.jade set filetype=jade
|
2014-04-14 19:12:18 -04:00
|
|
|
autocmd BufNewFile,BufRead *Spec.js,*_spec.js set filetype=jasmine.javascript syntax=jasmine
|
2013-09-16 10:53:38 -04:00
|
|
|
au BufNewFile,BufRead *.js setf javascript
|
|
|
|
au BufNewFile,BufRead *.jsm setf javascript
|
|
|
|
au BufNewFile,BufRead Jakefile setf javascript
|
|
|
|
fun! s:SelectJavascript()
|
|
|
|
if getline(1) =~# '^#!.*/bin/env\s\+node\>'
|
|
|
|
set ft=javascript
|
|
|
|
endif
|
|
|
|
endfun
|
|
|
|
au BufNewFile,BufRead * call s:SelectJavascript()
|
|
|
|
autocmd BufNewFile,BufRead *.json set filetype=json
|
2015-03-09 00:50:10 -04:00
|
|
|
autocmd BufNewFile,BufRead *.jsonp set filetype=json
|
2015-05-11 09:05:13 -04:00
|
|
|
au BufNewFile,BufRead *.ejs set filetype=jst
|
|
|
|
au BufNewFile,BufRead *.jst set filetype=jst
|
|
|
|
au BufNewFile,BufRead *.djs set filetype=jst
|
2013-09-16 10:53:38 -04:00
|
|
|
au BufNewFile,BufRead *.hamljs set filetype=jst
|
2015-02-11 14:27:11 -05:00
|
|
|
au BufNewFile,BufRead *.ect set filetype=jst
|
2015-06-11 11:02:51 -04:00
|
|
|
au BufRead,BufNewFile *.jl let b:undo_ftplugin = "setlocal comments< define< formatoptions< iskeyword< lisp<"
|
|
|
|
au BufRead,BufNewFile *.jl set filetype=julia
|
2013-09-16 10:53:38 -04:00
|
|
|
autocmd BufNewFile,BufRead *.less setf less
|
2014-06-08 13:38:42 -04:00
|
|
|
au BufNewFile,BufRead *.liquid set ft=liquid
|
|
|
|
au BufNewFile,BufRead */_layouts/*.html,*/_includes/*.html set ft=liquid
|
|
|
|
au BufNewFile,BufRead *.html,*.xml,*.textile
|
|
|
|
\ if getline(1) == '---' | set ft=liquid | endif
|
|
|
|
au BufNewFile,BufRead *.markdown,*.mkd,*.mkdn,*.md
|
|
|
|
\ if getline(1) == '---' |
|
|
|
|
\ let b:liquid_subtype = 'markdown' |
|
|
|
|
\ set ft=liquid |
|
|
|
|
\ endif
|
|
|
|
au BufNewFile,BufRead */templates/**.liquid,*/layout/**.liquid,*/snippets/**.liquid
|
|
|
|
\ let b:liquid_subtype = 'html' |
|
|
|
|
\ set ft=liquid |
|
2013-09-16 10:53:38 -04:00
|
|
|
autocmd BufNewFile,BufRead *.markdown,*.md,*.mdown,*.mkd,*.mkdn
|
|
|
|
\ if &ft =~# '^\%(conf\|modula2\)$' |
|
|
|
|
\ set ft=markdown |
|
|
|
|
\ else |
|
|
|
|
\ setf markdown |
|
|
|
|
\ endif
|
2013-11-06 17:55:01 -05:00
|
|
|
autocmd BufRead *.html
|
|
|
|
\ if getline(1) =~ '^\(%\|<[%&].*>\)' |
|
|
|
|
\ set filetype=mason |
|
|
|
|
\ endif
|
2014-02-04 13:15:58 -05:00
|
|
|
if has("autocmd")
|
2014-11-10 20:37:21 -05:00
|
|
|
au BufNewFile,BufRead *.mustache,*.hogan,*.hulk,*.hjs set filetype=html.mustache syntax=mustache | runtime! ftplugin/mustache.vim ftplugin/mustache*.vim ftplugin/mustache/*.vim
|
|
|
|
au BufNewFile,BufRead *.handlebars,*.hbs set filetype=html.handlebars syntax=mustache | runtime! ftplugin/mustache.vim ftplugin/mustache*.vim ftplugin/mustache/*.vim
|
2014-02-04 13:15:58 -05:00
|
|
|
endif
|
2013-09-16 10:53:38 -04:00
|
|
|
au BufRead,BufNewFile /etc/nginx/*,/usr/local/nginx/*,*/nginx/vhosts.d/*,nginx.conf if &ft == '' | setfiletype nginx | endif
|
2014-03-16 09:52:12 -04:00
|
|
|
au BufRead,BufNewFile *.cl set filetype=opencl
|
2014-07-29 07:03:49 -04:00
|
|
|
function! s:DetectPerl6()
|
|
|
|
let line_no = 1
|
|
|
|
let eof = line('$')
|
|
|
|
let in_pod = 0
|
|
|
|
while line_no <= eof
|
|
|
|
let line = getline(line_no)
|
|
|
|
let line_no = line_no + 1
|
|
|
|
if line =~ '^=\w'
|
|
|
|
let in_pod = 1
|
|
|
|
elseif line =~ '^=\%(end\|cut\)'
|
|
|
|
let in_pod = 0
|
|
|
|
elseif !in_pod
|
|
|
|
let line = substitute(line, '#.*', '', '')
|
|
|
|
if line =~ '^\s*$'
|
|
|
|
continue
|
|
|
|
endif
|
|
|
|
if line =~ '^\s*\%(use\s\+\)\=v6\%(\.\d\%(\.\d\)\=\)\=;'
|
|
|
|
set filetype=perl6 " we matched a 'use v6' declaration
|
2015-05-24 17:42:59 -04:00
|
|
|
elseif line =~ '^\s*\%(\%(my\|our\)\s\+\)\=\%(unit\s\+\)\=\(module\|class\|role\|enum\|grammar\)'
|
2014-07-29 07:03:49 -04:00
|
|
|
set filetype=perl6 " we found a class, role, module, enum, or grammar declaration
|
|
|
|
endif
|
|
|
|
break " we either found what we needed, or we found a non-POD, non-comment,
|
|
|
|
" non-Perl 6 indicating line, so bail out
|
|
|
|
endif
|
|
|
|
endwhile
|
|
|
|
endfunction
|
|
|
|
autocmd BufReadPost *.pl,*.pm,*.t call s:DetectPerl6()
|
2015-03-09 00:32:50 -04:00
|
|
|
autocmd BufNew,BufNewFile,BufRead *.nqp setf perl6
|
2013-09-16 10:53:38 -04:00
|
|
|
autocmd BufNewFile,BufRead *.proto setfiletype proto
|
2014-12-11 17:16:49 -05:00
|
|
|
au BufNewFile,BufRead *.ps1 set ft=ps1
|
|
|
|
au BufNewFile,BufRead *.psd1 set ft=ps1
|
|
|
|
au BufNewFile,BufRead *.psm1 set ft=ps1
|
|
|
|
au BufNewFile,BufRead *.ps1xml set ft=ps1xml
|
2014-04-14 19:26:34 -04:00
|
|
|
au! BufRead,BufNewFile *.pp setfiletype puppet
|
2014-08-12 17:45:36 -04:00
|
|
|
au! BufRead,BufNewFile Puppetfile setfiletype ruby
|
2014-04-14 19:05:44 -04:00
|
|
|
function! s:setf(filetype) abort
|
|
|
|
if &filetype !=# a:filetype
|
|
|
|
let &filetype = a:filetype
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
au BufNewFile,BufRead *.rb,*.rbw,*.gemspec call s:setf('ruby')
|
|
|
|
au BufNewFile,BufRead *.builder,*.rxml,*.rjs,*.ruby call s:setf('ruby')
|
|
|
|
au BufNewFile,BufRead [rR]akefile,*.rake call s:setf('ruby')
|
|
|
|
au BufNewFile,BufRead [rR]antfile,*.rant call s:setf('ruby')
|
|
|
|
au BufNewFile,BufRead .irbrc,irbrc call s:setf('ruby')
|
|
|
|
au BufNewFile,BufRead .pryrc call s:setf('ruby')
|
|
|
|
au BufNewFile,BufRead *.ru call s:setf('ruby')
|
2014-07-29 07:03:49 -04:00
|
|
|
au BufNewFile,BufRead Capfile,*.cap call s:setf('ruby')
|
2014-04-14 19:05:44 -04:00
|
|
|
au BufNewFile,BufRead Gemfile call s:setf('ruby')
|
|
|
|
au BufNewFile,BufRead Guardfile,.Guardfile call s:setf('ruby')
|
|
|
|
au BufNewFile,BufRead Cheffile call s:setf('ruby')
|
|
|
|
au BufNewFile,BufRead Berksfile call s:setf('ruby')
|
|
|
|
au BufNewFile,BufRead [vV]agrantfile call s:setf('ruby')
|
|
|
|
au BufNewFile,BufRead .autotest call s:setf('ruby')
|
|
|
|
au BufNewFile,BufRead *.erb,*.rhtml call s:setf('eruby')
|
|
|
|
au BufNewFile,BufRead [tT]horfile,*.thor call s:setf('ruby')
|
|
|
|
au BufNewFile,BufRead *.rabl call s:setf('ruby')
|
|
|
|
au BufNewFile,BufRead *.jbuilder call s:setf('ruby')
|
|
|
|
au BufNewFile,BufRead Puppetfile call s:setf('ruby')
|
|
|
|
au BufNewFile,BufRead [Bb]uildfile call s:setf('ruby')
|
|
|
|
au BufNewFile,BufRead Appraisals call s:setf('ruby')
|
|
|
|
au BufNewFile,BufRead Podfile,*.podspec call s:setf('ruby')
|
2014-01-24 12:06:22 -05:00
|
|
|
au BufRead,BufNewFile *.rs set filetype=rust
|
2015-02-11 14:27:11 -05:00
|
|
|
au BufRead,BufNewFile *.sbt set filetype=sbt.scala
|
2013-09-16 10:53:38 -04:00
|
|
|
fun! s:DetectScala()
|
2015-03-09 00:32:50 -04:00
|
|
|
if getline(1) =~# '^#!\(/usr\)\?/bin/env\s\+scalas\?'
|
2013-09-16 10:53:38 -04:00
|
|
|
set filetype=scala
|
|
|
|
endif
|
|
|
|
endfun
|
2015-02-11 14:27:11 -05:00
|
|
|
au BufRead,BufNewFile *.scala set filetype=scala
|
2013-09-16 10:53:38 -04:00
|
|
|
au BufRead,BufNewFile * call s:DetectScala()
|
2015-02-11 14:27:11 -05:00
|
|
|
au BufRead,BufNewFile *.sbt setfiletype sbt.scala
|
2014-01-09 05:59:09 -05:00
|
|
|
autocmd BufNewFile,BufRead *.slim set filetype=slim
|
2015-07-18 17:00:08 -04:00
|
|
|
au BufNewFile,BufRead *.sol setf solidity
|
2013-09-16 10:53:38 -04:00
|
|
|
autocmd BufNewFile,BufReadPost *.styl set filetype=stylus
|
|
|
|
autocmd BufNewFile,BufReadPost *.stylus set filetype=stylus
|
2014-08-12 18:17:05 -04:00
|
|
|
autocmd BufNewFile,BufRead *.swift set filetype=swift
|
2014-06-08 07:57:13 -04:00
|
|
|
au BufNewFile,BufRead *.automount set filetype=systemd
|
|
|
|
au BufNewFile,BufRead *.mount set filetype=systemd
|
|
|
|
au BufNewFile,BufRead *.path set filetype=systemd
|
|
|
|
au BufNewFile,BufRead *.service set filetype=systemd
|
|
|
|
au BufNewFile,BufRead *.socket set filetype=systemd
|
|
|
|
au BufNewFile,BufRead *.swap set filetype=systemd
|
|
|
|
au BufNewFile,BufRead *.target set filetype=systemd
|
|
|
|
au BufNewFile,BufRead *.timer set filetype=systemd
|
2013-09-16 10:53:38 -04:00
|
|
|
au BufRead,BufNewFile *.textile set filetype=textile
|
2014-12-11 17:02:50 -05:00
|
|
|
au BufNewFile,BufRead *.thrift setlocal filetype=thrift
|
2014-12-11 17:11:43 -05:00
|
|
|
autocmd BufNewFile,BufRead {.,}tmux.conf{.*,} setlocal filetype=tmux
|
2015-03-11 00:56:33 -04:00
|
|
|
autocmd BufNewFile,BufRead {.,}tmux.conf{.*,} setlocal commentstring=#\ %s
|
2014-04-14 19:16:56 -04:00
|
|
|
autocmd BufNewFile,BufRead *.toml set filetype=toml
|
2015-01-23 15:09:23 -05:00
|
|
|
autocmd BufNewFile,BufRead Cargo.lock set filetype=toml
|
2013-09-16 10:53:38 -04:00
|
|
|
autocmd BufNewFile,BufRead *.twig set filetype=twig
|
|
|
|
autocmd BufNewFile,BufRead *.html.twig set filetype=html.twig
|
2013-09-26 06:41:08 -04:00
|
|
|
autocmd BufNewFile,BufRead *.ts setlocal filetype=typescript
|
2014-12-11 17:09:07 -05:00
|
|
|
autocmd BufRead *.vala,*.vapi set efm=%f:%l.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m
|
|
|
|
au BufRead,BufNewFile *.vala,*.vapi setfiletype vala
|
2014-12-22 16:01:38 -05:00
|
|
|
au BufRead,BufNewFile *.vm set ft=velocity syntax=velocity
|