vim-polyglot/ftdetect/polyglot.vim

1025 lines
28 KiB
VimL
Raw Normal View History

" Enable jsx syntax by default
if !exists('g:jsx_ext_required')
let g:jsx_ext_required = 0
endif
" Disable json concealing by default
if !exists('g:vim_json_syntax_conceal')
let g:vim_json_syntax_conceal = 0
endif
let g:filetype_euphoria = 'elixir'
augroup filetypedetect
autocmd BufNewFile,BufReadPost *.vb setlocal filetype=vbnet
augroup END
let g:python_highlight_all = 1
augroup filetypedetect
if v:version < 704
" NOTE: this line fixes an issue with the default system-wide lisp ftplugin
" which didn't define b:undo_ftplugin on older Vim versions
" (*.jl files are recognized as lisp)
autocmd BufRead,BufNewFile *.jl let b:undo_ftplugin = "setlocal comments< define< formatoptions< iskeyword< lisp<"
endif
autocmd BufRead,BufNewFile *.jl set filetype=julia
" coffeescript
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
autocmd BufNewFile,BufRead *.litcoffee set filetype=litcoffee
autocmd BufNewFile,BufRead *.coffee.md set filetype=litcoffee
" elixir
au BufRead,BufNewFile *.ex,*.exs call s:setf('elixir')
au BufRead,BufNewFile *.eex call s:setf('eelixir')
" fish
autocmd BufRead,BufNewFile *.fish setfiletype fish
autocmd BufRead fish_funced_*_*.fish call search('^$')
autocmd BufRead,BufNewFile ~/.config/fish/fish_{read_,}history setfiletype yaml
autocmd BufRead,BufNewFile ~/.config/fish/fishd.* setlocal readonly
autocmd BufNewFile ~/.config/fish/functions/*.fish
\ call append(0, ['function '.expand('%:t:r'),
\'',
\'end']) |
\ 2
" git
autocmd BufNewFile,BufRead *.git/{,modules/**/,worktrees/*/}{COMMIT_EDIT,TAG_EDIT,MERGE_,}MSG set ft=gitcommit
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
" plantuml
autocmd BufRead,BufNewFile *.pu,*.uml,*.plantuml setfiletype plantuml | set filetype=plantuml
" scala
au BufRead,BufNewFile *.scala,*.sc set filetype=scala
au BufRead,BufNewFile *.sbt setfiletype sbt.scala
" swift
autocmd BufNewFile,BufRead *.swift set filetype=swift
augroup END
2017-03-23 08:21:01 -04:00
augroup filetypedetect
" apiblueprint:sheerun/apiblueprint.vim
autocmd BufReadPost,BufNewFile *.apib set filetype=apiblueprint
autocmd FileType apiblueprint set syntax=apiblueprint
autocmd FileType apiblueprint set makeprg=drafter\ -l\ %
augroup END
augroup filetypedetect
" applescript:vim-scripts/applescript.vim
augroup END
2017-05-17 05:18:30 -04:00
augroup filetypedetect
" asciidoc:asciidoc/vim-asciidoc
autocmd BufNewFile,BufRead *.asciidoc,*.adoc
\ set ft=asciidoc
augroup END
augroup filetypedetect
" yaml:stephpy/vim-yaml
augroup END
augroup filetypedetect
" ansible:pearofducks/ansible-vim
2016-05-02 04:42:37 -04:00
function! s:isAnsible()
2015-12-17 04:48:07 -05:00
let filepath = expand("%:p")
let filename = expand("%:t")
2016-05-02 04:42:37 -04:00
if filepath =~ '\v/(tasks|roles|handlers)/.*\.ya?ml$' | return 1 | en
if filepath =~ '\v/(group|host)_vars/' | return 1 | en
if filename =~ '\v(playbook|site|main|local)\.ya?ml$' | return 1 | en
2016-07-05 04:00:59 -04:00
2016-05-02 04:42:37 -04:00
let shebang = getline(1)
if shebang =~# '^#!.*/bin/env\s\+ansible-playbook\>' | return 1 | en
if shebang =~# '^#!.*/bin/ansible-playbook\>' | return 1 | en
2016-07-05 04:00:59 -04:00
2016-05-02 04:42:37 -04:00
return 0
2015-12-17 04:48:07 -05:00
endfunction
2016-07-05 04:00:59 -04:00
2016-05-02 04:42:37 -04:00
:au BufNewFile,BufRead * if s:isAnsible() | set ft=ansible | en
2015-12-17 04:48:07 -05:00
:au BufNewFile,BufRead *.j2 set ft=ansible_template
:au BufNewFile,BufRead hosts set ft=ansible_hosts
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" arduino:sudar/vim-arduino-syntax
au BufRead,BufNewFile *.ino,*.pde set filetype=arduino
augroup END
2016-07-05 04:00:59 -04:00
2017-09-27 14:14:30 -04:00
augroup filetypedetect
" autohotkey:hnamikaw/vim-autohotkey
augroup END
augroup filetypedetect
" blade:jwalton512/vim-blade
2016-01-22 03:08:00 -05:00
autocmd BufNewFile,BufRead *.blade.php set filetype=blade
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" c++11:octol/vim-cpp-enhanced-highlight
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" c/c++:vim-jp/vim-cpp
augroup END
2017-03-23 06:43:41 -04:00
augroup filetypedetect
" caddyfile:isobit/vim-caddyfile
au BufNewFile,BufRead Caddyfile set ft=caddyfile
augroup END
2017-03-23 06:43:41 -04:00
2017-12-30 05:29:09 -05:00
augroup filetypedetect
" carp:hellerve/carp-vim
au BufRead,BufNewFile *.carp set filetype=carp
augroup END
augroup filetypedetect
" cjsx:mtscout6/vim-cjsx
2015-07-18 16:54:07 -04:00
augroup CJSX
au!
autocmd BufNewFile,BufRead *.csx,*.cjsx set filetype=coffee
augroup END
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" clojure:guns/vim-clojure-static
2016-12-20 14:57:20 -05:00
autocmd BufNewFile,BufRead *.clj,*.cljs,*.edn,*.cljx,*.cljc,{build,profile}.boot setlocal filetype=clojure
augroup END
2016-07-05 04:00:59 -04:00
2017-11-19 15:46:44 -05:00
augroup filetypedetect
" cmake:pboettch/vim-cmake-syntax
augroup END
augroup filetypedetect
" cryptol:victoredwardocallaghan/cryptol.vim
2016-07-05 04:00:59 -04:00
" Copyright © 2013 Edward O'Callaghan. All Rights Reserved.
" Normal Cryptol Program;
2016-05-02 04:44:59 -04:00
au! BufRead,BufNewFile *.cry set filetype=cryptol
au! BufRead,BufNewFile *.cyl set filetype=cryptol
2016-07-05 04:00:59 -04:00
" Literate Cryptol Program;
2016-05-02 04:44:59 -04:00
au! BufRead,BufNewFile *.lcry set filetype=cryptol
au! BufRead,BufNewFile *.lcyl set filetype=cryptol
2016-07-05 04:00:59 -04:00
" Also in LaTeX *.tex which is outside our coverage scope.
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" crystal:rhysd/vim-crystal
2016-05-02 04:49:45 -04:00
autocmd BufNewFile,BufReadPost *.cr setlocal filetype=crystal
autocmd BufNewFile,BufReadPost Projectfile setlocal filetype=crystal
autocmd BufNewFile,BufReadPost *.ecr setlocal filetype=eruby
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" cql:elubow/cql-vim
if has("autocmd")
au BufNewFile,BufRead *.cql set filetype=cql
2016-05-02 04:49:45 -04:00
endif
augroup END
augroup filetypedetect
" cucumber:tpope/vim-cucumber
2016-07-05 04:00:59 -04:00
" Cucumber
autocmd BufNewFile,BufReadPost *.feature,*.story set filetype=cucumber
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" dart:dart-lang/dart-vim-plugin
2015-12-06 05:38:02 -05:00
autocmd BufRead,BufNewFile *.dart set filetype=dart
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" dockerfile:docker/docker::/contrib/syntax/vim/
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
2017-09-27 14:52:13 -04:00
" elm:ElmCast/elm-vim
" detection for Elm (http://elm-lang.org/)
au BufRead,BufNewFile *.elm set filetype=elm
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" emberscript:yalesov/vim-ember-script
2016-07-05 04:00:59 -04:00
" Language: ember-script
" Maintainer: Yulij Andreevich Lesov <yalesov@gmail.com>>
" URL: http://github.com/yalesov/vim-ember-script
2016-07-19 04:09:54 -04:00
" Version: 1.0.4
" Last Change: 2016 Jul 6
" License: ISC
2016-07-05 04:00:59 -04:00
2016-07-05 03:53:49 -04:00
if !exists('g:vim_ember_script')
let g:vim_ember_script = 1
endif
2016-07-05 04:00:59 -04:00
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
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" emblem:yalesov/vim-emblem
2016-07-05 04:00:59 -04:00
" Language: emblem
" Maintainer: Yulij Andreevich Lesov <yalesov@gmail.com>
" URL: http://github.com/yalesov/vim-emblem
2016-07-19 04:09:54 -04:00
" Version: 2.0.1
" Last Change: 2016 Jul 6
" License: ISC
2016-07-05 04:00:59 -04:00
2016-07-05 03:53:49 -04:00
if !exists('g:vim_emblem')
let g:vim_emblem = 1
endif
2016-07-05 04:00:59 -04:00
2016-07-05 03:53:49 -04:00
if exists('g:vim_ember_script')
autocmd BufNewFile,BufRead *.emblem set filetype=emblem
else
autocmd BufNewFile,BufRead *.em,*.emblem set filetype=emblem
endif
2014-08-12 18:03:22 -04:00
autocmd FileType emblem set tabstop=2|set shiftwidth=2|set expandtab
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" erlang:vim-erlang/vim-erlang-runtime
2017-12-30 05:10:32 -05:00
au BufNewFile,BufRead *.erl,*.hrl,rebar.config,*.app,*.app.src,*.yaws,*.xrl,*.escript set ft=erlang
augroup END
2016-07-05 04:00:59 -04:00
2017-09-27 14:19:38 -04:00
augroup filetypedetect
" fsharp:fsharp/vim-fsharp:_BASIC
2017-12-06 07:17:06 -05:00
" F#, fsharp
autocmd BufNewFile,BufRead *.fs,*.fsi,*.fsx set filetype=fsharp
2017-09-27 14:19:38 -04:00
augroup END
augroup filetypedetect
" gmpl:maelvalais/gmpl.vim
2017-12-06 07:17:06 -05:00
au BufRead,BufNewFile *.mod set filetype=gmpl
augroup END
augroup filetypedetect
" glsl:tikhomirov/vim-glsl
2017-12-06 07:17:06 -05:00
" Language: OpenGL Shading Language
" Maintainer: Sergey Tikhomirov <sergey@tikhomirov.io>
" Extensions supported by Khronos reference compiler (with one exception, ".glsl")
" https://github.com/KhronosGroup/glslang
autocmd! BufNewFile,BufRead *.vert,*.tesc,*.tese,*.glsl,*.geom,*.frag,*.comp set filetype=glsl
" vim:set sts=2 sw=2 :
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" gnuplot:vim-scripts/gnuplot-syntax-highlighting
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" go:fatih/vim-go:_BASIC
2018-02-05 22:15:01 -05:00
" vint: -ProhibitAutocmdWithNoGroup
2016-07-05 04:00:59 -04:00
" We take care to preserve the user's fileencodings and fileformats,
" because those settings are global (not buffer local), yet we want
" to override them for loading Go files, which are defined to be UTF-8.
let s:current_fileformats = ''
let s:current_fileencodings = ''
2016-07-05 04:00:59 -04:00
" define fileencodings to open as utf-8 encoding even if it's ascii.
2016-01-22 03:08:00 -05:00
function! s:gofiletype_pre(type)
2016-06-26 12:03:28 -04:00
let s:current_fileformats = &g:fileformats
let s:current_fileencodings = &g:fileencodings
set fileencodings=utf-8 fileformats=unix
let &l:filetype = a:type
endfunction
2016-07-05 04:00:59 -04:00
" restore fileencodings as others
function! s:gofiletype_post()
2016-06-26 12:03:28 -04:00
let &g:fileformats = s:current_fileformats
let &g:fileencodings = s:current_fileencodings
endfunction
2016-07-05 04:00:59 -04:00
2018-02-05 22:15:01 -05:00
" Note: should not use augroup in ftdetect (see :help ftdetect)
au BufNewFile *.go setfiletype go | setlocal fileencoding=utf-8 fileformat=unix
au BufRead *.go call s:gofiletype_pre("go")
au BufReadPost *.go call s:gofiletype_post()
2016-07-05 04:00:59 -04:00
2018-02-05 22:15:01 -05:00
au BufNewFile *.s setfiletype asm | setlocal fileencoding=utf-8 fileformat=unix
au BufRead *.s call s:gofiletype_pre("asm")
au BufReadPost *.s call s:gofiletype_post()
2016-07-05 04:00:59 -04:00
2018-02-05 22:15:01 -05:00
au BufRead,BufNewFile *.tmpl set filetype=gohtmltmpl
2016-07-05 04:00:59 -04:00
" vim: sw=2 ts=2 et
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" groovy:vim-scripts/groovy.vim
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" haml:sheerun/vim-haml
autocmd BufNewFile,BufRead *.sass setf sass
autocmd BufNewFile,BufRead *.scss setf scss
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" handlebars:mustache/vim-mustache-handlebars
if has("autocmd")
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
endif
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" haskell:neovimhaskell/haskell-vim
au BufRead,BufNewFile *.hsc set filetype=haskell
2017-02-02 15:16:29 -05:00
au BufRead,BufNewFile *.bpk set filetype=haskell
au BufRead,BufNewFile *.hsig set filetype=haskell
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" haxe:yaymukund/vim-haxe
2014-06-08 07:22:29 -04:00
autocmd BufNewFile,BufRead *.hx setf haxe
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" html5:othree/html5.vim
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" i3:PotatoesMaster/i3-vim-syntax
2017-02-02 15:54:55 -05:00
augroup i3_ftdetect
au!
2017-12-06 06:56:27 -05:00
au BufRead,BufNewFile *i3/config,*sway/config set ft=i3
2017-02-02 15:54:55 -05:00
augroup END
augroup END
2017-02-02 15:54:55 -05:00
augroup filetypedetect
" jasmine:glanotte/vim-jasmine
2014-04-14 19:12:18 -04:00
autocmd BufNewFile,BufRead *Spec.js,*_spec.js set filetype=jasmine.javascript syntax=jasmine
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" javascript:pangloss/vim-javascript:_JAVASCRIPT
2017-09-27 13:57:29 -04:00
au BufNewFile,BufRead *.{js,mjs,jsm,es,es6},Jakefile setf javascript
2017-05-17 05:07:28 -04:00
fun! s:SourceFlowSyntax()
if !exists('javascript_plugin_flow') && !exists('b:flow_active') &&
\ search('\v\C%^\_s*%(//\s*|/\*[ \t\n*]*)\@flow>','nw')
runtime extras/flow.vim
let b:flow_active = 1
endif
endfun
au FileType javascript au BufRead,BufWritePost <buffer> call s:SourceFlowSyntax()
2016-07-05 04:00:59 -04:00
fun! s:SelectJavascript()
2016-05-30 19:53:12 -04:00
if getline(1) =~# '^#!.*/bin/\%(env\s\+\)\?node\>'
set ft=javascript
endif
endfun
au BufNewFile,BufRead * call s:SelectJavascript()
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" jenkins:martinda/Jenkinsfile-vim-syntax
" Jenkinsfile
autocmd BufRead,BufNewFile Jenkinsfile set ft=Jenkinsfile
autocmd BufRead,BufNewFile Jenkinsfile* setf Jenkinsfile
autocmd BufRead,BufNewFile *.jenkinsfile set ft=Jenkinsfile
autocmd BufRead,BufNewFile *.jenkinsfile setf Jenkinsfile
augroup END
augroup filetypedetect
" json:elzr/vim-json
autocmd BufNewFile,BufRead *.json setlocal filetype=json
2018-01-10 17:50:02 -05:00
autocmd BufNewFile,BufRead *.jsonl setlocal filetype=json
autocmd BufNewFile,BufRead *.jsonp setlocal filetype=json
autocmd BufNewFile,BufRead *.geojson setlocal filetype=json
2017-12-06 06:56:27 -05:00
autocmd BufNewFile,BufRead *.template setlocal filetype=json
augroup END
2017-12-30 05:34:40 -05:00
augroup filetypedetect
" json5:GutenYe/json5.vim
au BufNewFile,BufRead *.json5 setfiletype json5
augroup END
augroup filetypedetect
" jst:briancollins/vim-jst
au BufNewFile,BufRead *.ejs set filetype=jst
au BufNewFile,BufRead *.jst set filetype=jst
au BufNewFile,BufRead *.djs set filetype=jst
au BufNewFile,BufRead *.hamljs set filetype=jst
au BufNewFile,BufRead *.ect set filetype=jst
augroup END
augroup filetypedetect
" jsx:mxw/vim-jsx:_ALL
2016-07-05 04:00:59 -04:00
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim ftdetect file
"
" Language: JSX (JavaScript)
" Maintainer: Max Wang <mxawng@gmail.com>
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Whether the .jsx extension is required.
2015-12-06 05:31:38 -05:00
if !exists('g:jsx_ext_required')
let g:jsx_ext_required = 1
endif
2016-07-05 04:00:59 -04:00
" Whether the @jsx pragma is required.
2015-12-06 05:31:38 -05:00
if !exists('g:jsx_pragma_required')
let g:jsx_pragma_required = 0
endif
2016-07-05 04:00:59 -04:00
2017-09-27 13:57:29 -04:00
let s:jsx_pragma_pattern = '\%^\_s*\/\*\*\%(\_.\%(\*\/\)\@!\)*@jsx\_.\{-}\*\/'
2016-07-05 04:00:59 -04:00
" Whether to set the JSX filetype on *.js files.
2015-12-06 05:31:38 -05:00
fu! <SID>EnableJSX()
2017-09-27 13:57:29 -04:00
if g:jsx_pragma_required && !exists('b:jsx_ext_found')
" Look for the @jsx pragma. It must be included in a docblock comment
" before anything else in the file (except whitespace).
let b:jsx_pragma_found = search(s:jsx_pragma_pattern, 'npw')
endif
2015-12-06 05:31:38 -05:00
if g:jsx_pragma_required && !b:jsx_pragma_found | return 0 | endif
if g:jsx_ext_required && !exists('b:jsx_ext_found') | return 0 | endif
return 1
endfu
2016-07-05 04:00:59 -04:00
2015-12-06 05:31:38 -05:00
autocmd BufNewFile,BufRead *.jsx let b:jsx_ext_found = 1
autocmd BufNewFile,BufRead *.jsx set filetype=javascript.jsx
autocmd BufNewFile,BufRead *.js
\ if <SID>EnableJSX() | set filetype=javascript.jsx | endif
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" kotlin:udalov/kotlin-vim
autocmd BufNewFile,BufRead *.kt setfiletype kotlin
autocmd BufNewFile,BufRead *.kts setfiletype kotlin
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" latex:LaTeX-Box-Team/LaTeX-Box
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" less:groenewege/vim-less
autocmd BufNewFile,BufRead *.less setf less
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" liquid:tpope/vim-liquid
2016-07-05 04:00:59 -04:00
" Liquid
2014-06-08 13:38:42 -04:00
au BufNewFile,BufRead *.liquid set ft=liquid
2016-07-05 04:00:59 -04:00
2014-06-08 13:38:42 -04:00
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
2016-07-05 04:00:59 -04:00
" Set subtype for Shopify alternate templates
2014-06-08 13:38:42 -04:00
au BufNewFile,BufRead */templates/**.liquid,*/layout/**.liquid,*/snippets/**.liquid
\ let b:liquid_subtype = 'html' |
\ set ft=liquid |
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" livescript:gkz/vim-ls
2016-07-26 08:06:32 -04:00
" Language: LiveScript
" Maintainer: George Zahariev
" URL: http://github.com/gkz/vim-ls
" License: WTFPL
"
autocmd BufNewFile,BufRead *.ls set filetype=ls
autocmd BufNewFile,BufRead *Slakefile set filetype=ls
augroup END
2016-07-26 08:06:32 -04:00
augroup filetypedetect
" lua:tbastos/vim-lua
augroup END
2016-07-26 08:06:32 -04:00
augroup filetypedetect
" mako:sophacles/vim-bundle-mako
2017-09-27 13:57:29 -04:00
if !exists("g:mako_detect_lang_from_ext")
let g:mako_detect_lang_from_ext = 1
endif
if g:mako_detect_lang_from_ext
au BufNewFile *.*.mako execute "do BufNewFile filetypedetect " . expand("<afile>:r") | let b:mako_outer_lang = &filetype
" it's important to get this before any of the normal BufRead autocmds execute
" for this file, otherwise a mako tag at the start of the file can cause the
" filetype to be set to mason
au BufReadPre *.*.mako execute "do BufRead filetypedetect " . expand("<afile>:r") | let b:mako_outer_lang = &filetype
endif
2016-05-13 09:56:51 -04:00
au BufRead,BufNewFile *.mako set filetype=mako
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" markdown:plasticboy/vim-markdown:_SYNTAX
2016-07-05 04:00:59 -04:00
" markdown filetype file
2016-06-26 12:13:30 -04:00
au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn} set filetype=markdown
au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn}.{des3,des,bf,bfa,aes,idea,cast,rc2,rc4,rc5,desx} set filetype=markdown
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" mathematica:rsmenon/vim-mathematica
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" nginx:chr4/nginx.vim
au BufRead,BufNewFile *.nginx set ft=nginx
au BufRead,BufNewFile nginx*.conf set ft=nginx
au BufRead,BufNewFile *nginx.conf set ft=nginx
au BufRead,BufNewFile */etc/nginx/* set ft=nginx
au BufRead,BufNewFile */usr/local/nginx/conf/* set ft=nginx
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" nim:zah/nim.vim:_BASIC
2016-05-30 19:53:12 -04:00
au BufNewFile,BufRead *.nim,*.nims set filetype=nim
2016-07-05 04:00:59 -04:00
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
2017-11-19 15:34:38 -05:00
" nix:LnL7/vim-nix
" Vim filetype detect
" Language: Nix
" Maintainer: Daiderd Jordan <daiderd@gmail.com>
" URL: https://github.com/LnL7/vim-nix
au BufRead,BufNewFile *.nix set filetype=nix
au FileType nix setl sw=2 sts=2 et iskeyword+=-
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" objc:b4winckler/vim-objc
augroup END
augroup filetypedetect
" ocaml:jrk/vim-ocaml
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" octave:vim-scripts/octave.vim--
augroup END
augroup filetypedetect
" opencl:petRUShka/vim-opencl
2015-12-06 05:31:38 -05:00
au! BufRead,BufNewFile *.cl set filetype=opencl
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" perl:vim-perl/vim-perl
" Highlight .html files as Mason if they start with Mason tags
autocmd BufRead *.html
\ if getline(1) =~ '^\(%\|<[%&].*>\)' |
\ set filetype=mason |
\ endif
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" perl:vim-perl/vim-perl
2014-07-29 07:03:49 -04:00
function! s:DetectPerl6()
let line_no = 1
let eof = line('$')
let in_pod = 0
2016-07-05 04:00:59 -04:00
2014-07-29 07:03:49 -04:00
while line_no <= eof
let line = getline(line_no)
let line_no = line_no + 1
2016-07-05 04:00:59 -04:00
2014-07-29 07:03:49 -04:00
if line =~ '^=\w'
let in_pod = 1
elseif line =~ '^=\%(end\|cut\)'
let in_pod = 0
elseif !in_pod
let line = substitute(line, '#.*', '', '')
2016-07-05 04:00:59 -04:00
2014-07-29 07:03:49 -04:00
if line =~ '^\s*$'
continue
endif
2016-07-05 04:00:59 -04:00
2014-07-29 07:03:49 -04:00
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
2016-07-05 04:00:59 -04:00
2014-07-29 07:03:49 -04:00
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
2016-07-05 04:00:59 -04:00
2014-07-29 07:03:49 -04:00
autocmd BufReadPost *.pl,*.pm,*.t call s:DetectPerl6()
2015-03-09 00:32:50 -04:00
autocmd BufNew,BufNewFile,BufRead *.nqp setf perl6
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" pgsql:exu/pgsql.vim
2016-07-05 04:00:59 -04:00
" postgreSQL
2016-05-02 04:52:01 -04:00
au BufNewFile,BufRead *.pgsql setf pgsql
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" php:StanAngeloff/php.vim
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" powershell:PProvost/vim-ps1
2016-07-05 04:00:59 -04:00
" Vim ftdetect plugin file
" Language: Windows PowerShell
" Maintainer: Peter Provost <peter@provost.org>
" Version: 2.10
" Project Repository: https://github.com/PProvost/vim-ps1
" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327
"
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 *.pssc set ft=ps1
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" powershell:PProvost/vim-ps1
2016-07-05 04:00:59 -04:00
" Vim ftdetect plugin file
" Language: Windows PowerShell
" Maintainer: Peter Provost <peter@provost.org>
" Version: 2.10
" Project Repository: https://github.com/PProvost/vim-ps1
" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327
2014-12-11 17:16:49 -05:00
au BufNewFile,BufRead *.ps1xml set ft=ps1xml
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" powershell:PProvost/vim-ps1
" Vim ftdetect plugin file
" Language: Windows PowerShell
" Maintainer: Peter Provost <peter@provost.org>
" Version: 2.10
" Project Repository: https://github.com/PProvost/vim-ps1
" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327
au BufNewFile,BufRead *.cdxml set ft=xml
au BufNewFile,BufRead *.psc1 set ft=xml
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" protobuf:uarun/vim-protobuf
autocmd BufNewFile,BufRead *.proto setfiletype proto
augroup END
augroup filetypedetect
" pug:digitaltoad/vim-pug
2016-07-05 04:00:59 -04:00
" Pug
2016-05-02 04:42:37 -04:00
autocmd BufNewFile,BufReadPost *.pug set filetype=pug
2016-07-05 04:00:59 -04:00
" Jade
2016-05-02 04:42:37 -04:00
autocmd BufNewFile,BufReadPost *.jade set filetype=pug
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" puppet:voxpupuli/vim-puppet
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
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
2017-09-27 13:57:29 -04:00
" purescript:purescript-contrib/purescript-vim
2016-05-02 05:35:06 -04:00
au BufNewFile,BufRead *.purs setf purescript
au FileType purescript let &l:commentstring='{--%s--}'
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" python:vim-python/python-syntax
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" python-compiler:aliev/vim-compiler-python
2016-09-11 07:25:03 -04:00
" Vim compiler file
" Compiler: Unit testing tool for Python
" Maintainer: Ali Aliev <ali@aliev.me>
" Last Change: 2015 Nov 2
autocmd FileType python compiler python
augroup END
2016-09-11 07:25:03 -04:00
augroup filetypedetect
" python-ident:Vimjas/vim-python-pep8-indent
augroup END
augroup filetypedetect
" qml:peterhoeg/vim-qml
2015-10-10 11:25:38 -04:00
autocmd BufRead,BufNewFile *.qml setfiletype qml
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" r-lang:vim-scripts/R.vim
augroup END
2016-07-05 04:00:59 -04:00
2017-05-17 05:46:19 -04:00
augroup filetypedetect
" racket:wlangstroth/vim-racket
au BufRead,BufNewFile *.rkt,*.rktl set filetype=racket
augroup END
augroup filetypedetect
" raml:IN3D/vim-raml
au BufRead,BufNewFile *.raml set ft=raml
augroup END
augroup filetypedetect
" ragel:jneen/ragel.vim
augroup END
augroup filetypedetect
" rspec:sheerun/rspec.vim
augroup END
augroup filetypedetect
" ruby:vim-ruby/vim-ruby
2016-07-05 04:00:59 -04:00
" Officially distributed filetypes
" Support functions {{{
2014-04-14 19:05:44 -04:00
function! s:setf(filetype) abort
2017-09-27 13:57:29 -04:00
if &filetype !~# '\<'.a:filetype.'\>'
2014-04-14 19:05:44 -04:00
let &filetype = a:filetype
endif
endfunction
2016-07-05 04:00:59 -04:00
2016-05-30 19:53:12 -04:00
func! s:StarSetf(ft)
if expand("<amatch>") !~ g:ft_ignore_pat
exe 'setf ' . a:ft
endif
endfunc
2016-07-05 04:00:59 -04:00
" }}}
" HTML with Ruby - eRuby
2016-05-30 19:53:12 -04:00
au BufNewFile,BufRead *.erb,*.rhtml call s:setf('eruby')
2016-07-05 04:00:59 -04:00
" Interactive Ruby shell
2016-05-30 19:53:12 -04:00
au BufNewFile,BufRead .irbrc,irbrc call s:setf('ruby')
2016-07-05 04:00:59 -04:00
" Ruby
2016-05-30 19:53:12 -04:00
au BufNewFile,BufRead *.rb,*.rbw,*.gemspec call s:setf('ruby')
2016-07-05 04:00:59 -04:00
" Rackup
2016-05-30 19:53:12 -04:00
au BufNewFile,BufRead *.ru call s:setf('ruby')
2016-07-05 04:00:59 -04:00
" Bundler
2016-05-30 19:53:12 -04:00
au BufNewFile,BufRead Gemfile call s:setf('ruby')
2016-07-05 04:00:59 -04:00
" Ruby on Rails
2016-05-30 19:53:12 -04:00
au BufNewFile,BufRead *.builder,*.rxml,*.rjs,*.ruby call s:setf('ruby')
2016-07-05 04:00:59 -04:00
" Rakefile
2016-05-30 19:53:12 -04:00
au BufNewFile,BufRead [rR]akefile,*.rake call s:setf('ruby')
au BufNewFile,BufRead [rR]akefile* call s:StarSetf('ruby')
2016-07-05 04:00:59 -04:00
" Rantfile
2016-05-30 19:53:12 -04:00
au BufNewFile,BufRead [rR]antfile,*.rant call s:setf('ruby')
2016-07-05 04:00:59 -04:00
" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker:
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" ruby:vim-ruby/vim-ruby
2016-07-05 04:00:59 -04:00
" All other filetypes
" Support functions {{{
2016-05-30 19:53:12 -04:00
function! s:setf(filetype) abort
if &filetype !=# a:filetype
let &filetype = a:filetype
endif
endfunction
2016-07-05 04:00:59 -04:00
" }}}
" Appraisal
2016-05-30 19:53:12 -04:00
au BufNewFile,BufRead Appraisals call s:setf('ruby')
2016-07-05 04:00:59 -04:00
" Autotest
2016-05-30 19:53:12 -04:00
au BufNewFile,BufRead .autotest call s:setf('ruby')
2016-07-05 04:00:59 -04:00
" Buildr Buildfile
2016-05-30 19:53:12 -04:00
au BufNewFile,BufRead [Bb]uildfile call s:setf('ruby')
2016-07-05 04:00:59 -04:00
" Capistrano
2016-05-30 19:53:12 -04:00
au BufNewFile,BufRead Capfile,*.cap call s:setf('ruby')
2016-07-05 04:00:59 -04:00
" Chef
2014-04-14 19:05:44 -04:00
au BufNewFile,BufRead Cheffile call s:setf('ruby')
au BufNewFile,BufRead Berksfile call s:setf('ruby')
2016-07-05 04:00:59 -04:00
" CocoaPods
2016-05-30 19:53:12 -04:00
au BufNewFile,BufRead Podfile,*.podspec call s:setf('ruby')
2016-07-05 04:00:59 -04:00
" Guard
2016-05-30 19:53:12 -04:00
au BufNewFile,BufRead Guardfile,.Guardfile call s:setf('ruby')
2016-07-05 04:00:59 -04:00
" Jbuilder
2014-04-14 19:05:44 -04:00
au BufNewFile,BufRead *.jbuilder call s:setf('ruby')
2016-07-05 04:00:59 -04:00
" Kitchen Sink
2016-05-30 19:53:12 -04:00
au BufNewFile,BufRead KitchenSink call s:setf('ruby')
2016-07-05 04:00:59 -04:00
" Opal
2016-05-30 19:53:12 -04:00
au BufNewFile,BufRead *.opal call s:setf('ruby')
2016-07-05 04:00:59 -04:00
" Pry config
2016-05-30 19:53:12 -04:00
au BufNewFile,BufRead .pryrc call s:setf('ruby')
2016-07-05 04:00:59 -04:00
" Puppet librarian
2014-04-14 19:05:44 -04:00
au BufNewFile,BufRead Puppetfile call s:setf('ruby')
2016-07-05 04:00:59 -04:00
" Rabl
2016-05-30 19:53:12 -04:00
au BufNewFile,BufRead *.rabl call s:setf('ruby')
2016-07-05 04:00:59 -04:00
" Routefile
2015-10-10 10:56:22 -04:00
au BufNewFile,BufRead [rR]outefile call s:setf('ruby')
2016-07-05 04:00:59 -04:00
" SimpleCov
2016-06-26 12:03:28 -04:00
au BufNewFile,BufRead .simplecov call s:setf('ruby')
2016-07-05 04:00:59 -04:00
" Thor
2016-05-30 19:53:12 -04:00
au BufNewFile,BufRead [tT]horfile,*.thor call s:setf('ruby')
2016-07-05 04:00:59 -04:00
" Vagrant
2016-05-30 19:53:12 -04:00
au BufNewFile,BufRead [vV]agrantfile call s:setf('ruby')
2016-07-05 04:00:59 -04:00
" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker:
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" rust:rust-lang/rust.vim
2014-01-24 12:06:22 -05:00
au BufRead,BufNewFile *.rs set filetype=rust
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" sbt:derekwyatt/vim-sbt
2016-07-05 04:00:59 -04:00
" Vim detect file
" Language: sbt
" Maintainer: Derek Wyatt <derek@{myfirstname}{mylastname}.org>
" Last Change: 2012 Jan 19
2015-02-11 14:27:11 -05:00
au BufRead,BufNewFile *.sbt set filetype=sbt.scala
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" scss:cakebaker/scss-syntax.vim
au BufRead,BufNewFile *.scss setfiletype scss
au BufEnter *.scss :syntax sync fromstart
augroup END
augroup filetypedetect
" slim:slim-template/vim-slim
2016-12-20 14:57:20 -05:00
autocmd BufNewFile,BufRead *.slim setfiletype slim
augroup END
2016-07-05 04:00:59 -04:00
2017-12-06 07:17:06 -05:00
augroup filetypedetect
" slime:slime-lang/vim-slime-syntax
autocmd BufNewFile,BufRead *.slime set filetype=slime
augroup END
augroup filetypedetect
2017-09-27 14:08:01 -04:00
" solidity:tomlion/vim-solidity
2015-07-18 17:00:08 -04:00
au BufNewFile,BufRead *.sol setf solidity
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" stylus:wavded/vim-stylus
2016-07-05 04:00:59 -04:00
" Stylus
autocmd BufNewFile,BufReadPost *.styl set filetype=stylus
autocmd BufNewFile,BufReadPost *.stylus set filetype=stylus
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" sxhkd:baskerville/vim-sxhkdrc
2017-03-23 07:48:17 -04:00
if &compatible || v:version < 603
finish
endif
autocmd BufNewFile,BufRead sxhkdrc,*.sxhkdrc set ft=sxhkdrc
augroup END
2017-03-23 07:48:17 -04:00
augroup filetypedetect
" systemd:kurayama/systemd-vim-syntax
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
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" terraform:hashivim/vim-terraform
2017-02-02 15:44:42 -05:00
au BufRead,BufNewFile *.tf setlocal filetype=terraform
au BufRead,BufNewFile *.tfvars setlocal filetype=terraform
au BufRead,BufNewFile *.tfstate setlocal filetype=javascript
augroup END
2017-02-02 15:44:42 -05:00
augroup filetypedetect
" textile:timcharper/textile.vim
2016-07-05 04:00:59 -04:00
" textile.vim
"
" Tim Harper (tim.theenchanter.com)
" Force filetype to be textile even if already set
" This will override the system ftplugin/changelog
" set on some distros
au BufRead,BufNewFile *.textile set filetype=textile
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" thrift:solarnz/thrift.vim
au BufNewFile,BufRead *.thrift setlocal filetype=thrift
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" tmux:keith/tmux.vim
2016-06-26 12:03:28 -04:00
autocmd BufNewFile,BufRead {.,}tmux*.conf* setfiletype tmux
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" tomdoc:wellbredgrapefruit/tomdoc.vim
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" toml:cespare/vim-toml
2017-11-19 15:26:59 -05:00
" Go dep and Rust use several TOML config files that are not named with .toml.
autocmd BufNewFile,BufRead *.toml,Gopkg.lock,Cargo.lock,*/.cargo/config set filetype=toml
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" twig:lumiliet/vim-twig
2017-05-17 05:07:28 -04:00
if !exists('g:vim_twig_filetype_detected') && has("autocmd")
au BufNewFile,BufRead *.twig set filetype=html.twig
au BufNewFile,BufRead *.html.twig set filetype=html.twig
au BufNewFile,BufRead *.xml.twig set filetype=xml.twig
endif
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" typescript:leafgarland/typescript-vim
2017-03-23 06:28:19 -04:00
" use `set filetype` to override default filetype=xml for *.ts files
autocmd BufNewFile,BufRead *.ts set filetype=typescript
" use `setfiletype` to not override any other plugins like ianks/vim-tsx
autocmd BufNewFile,BufRead *.tsx setfiletype typescript
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" vala:arrufat/vala.vim
2014-12-11 17:09:07 -05:00
autocmd BufRead *.vala,*.vapi set efm=%f:%l.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m
au BufRead,BufNewFile *.vala,*.vapi,*.valadoc setfiletype vala
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" vbnet:vim-scripts/vbnet.vim
augroup END
2016-07-05 04:00:59 -04:00
augroup filetypedetect
" vcl:smerrill/vcl-vim-plugin
2015-12-06 05:34:19 -05:00
au BufRead,BufNewFile *.vcl set filetype=vcl
augroup END
2016-07-05 04:00:59 -04:00
2017-09-27 14:23:42 -04:00
augroup filetypedetect
" vifm:vifm/vifm.vim
autocmd BufRead,BufNewFile vifm.rename* :set filetype=vifm-rename
augroup END
augroup filetypedetect
" vifm:vifm/vifm.vim
autocmd BufRead,BufNewFile vifmrc :set filetype=vifm
autocmd BufRead,BufNewFile *vifm/colors/* :set filetype=vifm
augroup END
augroup filetypedetect
" vue:posva/vim-vue
2017-05-17 05:07:28 -04:00
au BufNewFile,BufRead *.vue setf vue
augroup END
2017-02-02 15:49:51 -05:00
augroup filetypedetect
" vm:lepture/vim-velocity
au BufRead,BufNewFile *.vm set ft=velocity syntax=velocity
augroup END
augroup filetypedetect
" xls:vim-scripts/XSLT-syntax
augroup END
augroup filetypedetect
" yard:sheerun/vim-yardoc
augroup END