diff options
Diffstat (limited to 'ftplugin')
-rw-r--r-- | ftplugin/elm.vim | 16 | ||||
-rw-r--r-- | ftplugin/graphql.vim | 3 | ||||
-rw-r--r-- | ftplugin/ruby.vim | 4 | ||||
-rw-r--r-- | ftplugin/twig.vim | 21 |
4 files changed, 34 insertions, 10 deletions
diff --git a/ftplugin/elm.vim b/ftplugin/elm.vim index 180e719c..c989d922 100644 --- a/ftplugin/elm.vim +++ b/ftplugin/elm.vim @@ -43,14 +43,14 @@ setlocal comments=:-- setlocal commentstring=--\ %s " Commands -command -buffer -nargs=? -complete=file ElmMake call elm#Make(<f-args>) -command -buffer ElmMakeMain call elm#Make("Main.elm") -command -buffer -nargs=? -complete=file ElmTest call elm#Test(<f-args>) -command -buffer ElmRepl call elm#Repl() -command -buffer ElmErrorDetail call elm#ErrorDetail() -command -buffer ElmShowDocs call elm#ShowDocs() -command -buffer ElmBrowseDocs call elm#BrowseDocs() -command -buffer ElmFormat call elm#Format() +command! -buffer -nargs=? -complete=file ElmMake call elm#Make(<f-args>) +command! -buffer ElmMakeMain call elm#Make("Main.elm") +command! -buffer -nargs=? -complete=file ElmTest call elm#Test(<f-args>) +command! -buffer ElmRepl call elm#Repl() +command! -buffer ElmErrorDetail call elm#ErrorDetail() +command! -buffer ElmShowDocs call elm#ShowDocs() +command! -buffer ElmBrowseDocs call elm#BrowseDocs() +command! -buffer ElmFormat call elm#Format() if get(g:, 'elm_setup_keybindings', 1) nmap <buffer> <LocalLeader>m <Plug>(elm-make) diff --git a/ftplugin/graphql.vim b/ftplugin/graphql.vim index 42d96e6c..d1ac4329 100644 --- a/ftplugin/graphql.vim +++ b/ftplugin/graphql.vim @@ -13,5 +13,8 @@ setlocal comments=:# setlocal commentstring=#\ %s setlocal formatoptions-=t setlocal iskeyword+=$,@-@ +setlocal softtabstop=2 +setlocal shiftwidth=2 +setlocal expandtab endif diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 9189730b..b844bfdf 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -46,7 +46,7 @@ endif setlocal formatoptions-=t formatoptions+=croql setlocal include=^\\s*\\<\\(load\\>\\\|require\\>\\\|autoload\\s*:\\=[\"']\\=\\h\\w*[\"']\\=,\\) -setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'\%(\.rb\)\=$','.rb','') +setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'\\%(\\.rb\\)\\=$','.rb','') setlocal suffixesadd=.rb if exists("&ofu") && has("ruby") @@ -151,7 +151,7 @@ let b:undo_ftplugin = "setl fo< inc< inex< sua< def< com< cms< path< tags< kp<" function! s:map(mode, flags, map) abort let from = matchstr(a:map, '\S\+') if empty(mapcheck(from, a:mode)) - exe a:mode.'map' '<buffer>'.(a:0 ? a:1 : '') a:map + exe a:mode.'map' '<buffer>' a:map let b:undo_ftplugin .= '|sil! '.a:mode.'unmap <buffer> '.from endif endfunction diff --git a/ftplugin/twig.vim b/ftplugin/twig.vim index 8fa94a41..fc406dba 100644 --- a/ftplugin/twig.vim +++ b/ftplugin/twig.vim @@ -12,6 +12,27 @@ setlocal comments=s:{#,ex:#} setlocal formatoptions+=tcqln " setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+ +if exists('b:match_words') + let b:twigMatchWords = [ + \ ['block', 'endblock'], + \ ['for', 'endfor'], + \ ['macro', 'endmacro'], + \ ['if', 'elseif', 'else', 'endif'], + \ ['set', 'endset'] + \] + for s:element in b:twigMatchWords + let s:pattern = '' + for s:tag in s:element[:-2] + if s:pattern != '' + let s:pattern .= ':' + endif + let s:pattern .= '{%\s*\<' . s:tag . '\>\s*\%(.*=\)\@![^}]\{-}%}' + endfor + let s:pattern .= ':{%\s*\<' . s:element[-1:][0] . '\>\s*.\{-}%}' + let b:match_words .= ',' . s:pattern + endfor +endif + if exists("b:did_ftplugin") let b:undo_ftplugin .= "|setlocal comments< formatoptions<" else |