diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2017-05-17 11:07:28 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2017-05-17 11:07:28 +0200 |
commit | af870100716f20ee4daef9cc527a9ecf41b54114 (patch) | |
tree | 0859464c3145682cbfc29ad08de4527dd661abf7 /ftplugin | |
parent | ef369d45a505403587ea0bae30ce6768ba51398c (diff) | |
download | vim-polyglot-af870100716f20ee4daef9cc527a9ecf41b54114.tar.gz vim-polyglot-af870100716f20ee4daef9cc527a9ecf41b54114.zip |
Update
Diffstat (limited to 'ftplugin')
-rw-r--r-- | ftplugin/eelixir.vim | 4 | ||||
-rw-r--r-- | ftplugin/elixir.vim | 39 | ||||
-rw-r--r-- | ftplugin/plantuml.vim | 15 | ||||
-rw-r--r-- | ftplugin/ps1.vim | 2 | ||||
-rw-r--r-- | ftplugin/ps1xml.vim | 2 | ||||
-rw-r--r-- | ftplugin/ruby.vim | 45 | ||||
-rw-r--r-- | ftplugin/vue.vim | 7 |
7 files changed, 50 insertions, 64 deletions
diff --git a/ftplugin/eelixir.vim b/ftplugin/eelixir.vim index eb6f6559..a4721f99 100644 --- a/ftplugin/eelixir.vim +++ b/ftplugin/eelixir.vim @@ -16,7 +16,7 @@ if !exists("g:eelixir_default_subtype") endif if !exists("b:eelixir_subtype") - let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$") + let s:lines = join(getline(1, 5) + [getline('$')], "\n") let b:eelixir_subtype = matchstr(s:lines,'eelixir_subtype=\zs\w\+') if b:eelixir_subtype == '' let b:eelixir_subtype = matchstr(&filetype,'^eex\.\zs\w\+') @@ -100,7 +100,7 @@ endif setlocal comments=:<%# setlocal commentstring=<%#\ %s\ %> -let b:undo_ftplugin = "setl cms< " +let b:undo_ftplugin = "setl cms< " . \ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin let &cpo = s:save_cpo diff --git a/ftplugin/elixir.vim b/ftplugin/elixir.vim index 807d0665..651cfba6 100644 --- a/ftplugin/elixir.vim +++ b/ftplugin/elixir.vim @@ -17,45 +17,24 @@ if exists("loaded_matchit") && !exists("b:match_words") \ ',{:},\[:\],(:)' endif +setlocal shiftwidth=2 softtabstop=2 expandtab iskeyword+=!,? setlocal comments=:# setlocal commentstring=#\ %s -function! GetElixirFilename(word) - let word = a:word - - " get first thing that starts uppercase, until the first space or end of line - let word = substitute(word,'^\s*\(\u[^ ]\+\).*$','\1','g') - - " remove any trailing characters that don't look like a nested module - let word = substitute(word,'\.\U.*$','','g') - - " replace module dots with slash - let word = substitute(word,'\.','/','g') - - " remove any special chars - let word = substitute(word,'[^A-z0-9-_/]','','g') - - " convert to snake_case - let word = substitute(word,'\(\u\+\)\(\u\l\)','\1_\2','g') - let word = substitute(word,'\(\u\+\)\(\u\l\)','\1_\2','g') - let word = substitute(word,'\(\l\|\d\)\(\u\)','\1_\2','g') - let word = substitute(word,'-','_','g') - let word = tolower(word) - - return word -endfunction - let &l:path = \ join([ - \ getcwd().'/lib', - \ getcwd().'/src', - \ getcwd().'/deps/**/lib', - \ getcwd().'/deps/**/src', + \ 'lib', + \ 'src', + \ 'deps/**/lib', + \ 'deps/**/src', \ &g:path \ ], ',') -setlocal includeexpr=GetElixirFilename(v:fname) +setlocal includeexpr=elixir#util#get_filename(v:fname) setlocal suffixesadd=.ex,.exs,.eex,.erl,.yrl,.hrl silent! setlocal formatoptions-=t formatoptions+=croqlj +let b:undo_ftplugin = 'setlocal sw< sts< et< isk< com< cms< path< inex< sua< '. + \ '| unlet! b:match_ignorecase b:match_words' + endif diff --git a/ftplugin/plantuml.vim b/ftplugin/plantuml.vim index fe5496fc..4d55d809 100644 --- a/ftplugin/plantuml.vim +++ b/ftplugin/plantuml.vim @@ -1,22 +1,17 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'plantuml') == -1 -" Vim plugin file -" Language: PlantUML -" Maintainer: Aaron C. Meadows < language name at shadowguarddev dot com> -" Version: 0.1 - -if exists("b:loaded_plantuml_plugin") +if exists('b:loaded_plantuml_plugin') finish endif let b:loaded_plantuml_plugin = 1 let s:cpo_save = &cpo set cpo&vim -if !exists("g:plantuml_executable_script") - let g:plantuml_executable_script="plantuml" +if !exists('g:plantuml_executable_script') + let g:plantuml_executable_script='plantuml' endif -if exists("loaded_matchit") +if exists('loaded_matchit') let b:match_ignorecase = 0 let b:match_words = \ '\(\<ref\>\|\<box\>\|\<opt\>\|\<alt\>\|\<group\>\|\<loop\>\|\<note\>\|\<legend\>\):\<else\>:\<end\>' . @@ -27,7 +22,7 @@ if exists("loaded_matchit") \ ',\<\while\>:\<endwhile\>' endif -let &l:makeprg=g:plantuml_executable_script . " " . fnameescape(expand("%")) +let &l:makeprg=g:plantuml_executable_script . ' ' . fnameescape(expand('%')) setlocal comments=s1:/',mb:',ex:'/,:' commentstring=/'%s'/ formatoptions-=t formatoptions+=croql diff --git a/ftplugin/ps1.vim b/ftplugin/ps1.vim index a88fe019..9a980834 100644 --- a/ftplugin/ps1.vim +++ b/ftplugin/ps1.vim @@ -19,6 +19,8 @@ setlocal formatoptions=tcqro " Enable autocompletion of hyphenated PowerShell commands, " e.g. Get-Content or Get-ADUser setlocal iskeyword+=- +" MS applications (including PowerShell) require a Byte Order Mark (BOM) for UTF-8. +setlocal bomb " Change the browse dialog on Win32 to show mainly PowerShell-related files if has("gui_win32") diff --git a/ftplugin/ps1xml.vim b/ftplugin/ps1xml.vim index 11815d2d..e2616a00 100644 --- a/ftplugin/ps1xml.vim +++ b/ftplugin/ps1xml.vim @@ -16,6 +16,8 @@ let b:did_ftplugin = 1 setlocal tw=0 setlocal commentstring=#%s setlocal formatoptions=tcqro +" MS applications (including PowerShell) require a Byte Order Mark (BOM) for UTF-8. +setlocal bomb " Change the browse dialog on Win32 to show mainly PowerShell-related files if has("gui_win32") diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 806b21cb..24576de0 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -71,7 +71,7 @@ endif function! s:query_path(root) abort let code = "print $:.join %q{,}" - if &shell =~# 'sh' + if &shell =~# 'sh' && empty(&shellxquote) let prefix = 'env PATH='.shellescape($PATH).' ' else let prefix = '' @@ -164,23 +164,23 @@ if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps") nmap <buffer><script> <SID>: :<C-U> nmap <buffer><script> <SID>c: :<C-U><C-R>=v:count ? v:count : ''<CR> - nnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','b','n')<CR> - nnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','','n')<CR> - nnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','b','n')<CR> - nnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','','n')<CR> - xnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','b','v')<CR> - xnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','','v')<CR> - xnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','b','v')<CR> - xnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','','v')<CR> - - nnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','b','n')<CR> - nnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','','n')<CR> - nnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','b','n')<CR> - nnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','','n')<CR> - xnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','b','v')<CR> - xnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','','v')<CR> - xnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','b','v')<CR> - xnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','','v')<CR> + nnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'b','n')<CR> + nnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'','n')<CR> + nnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'b','n')<CR> + nnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'','n')<CR> + xnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'b','v')<CR> + xnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'','v')<CR> + xnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'b','v')<CR> + xnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'','v')<CR> + + nnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'b','n')<CR> + nnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'','n')<CR> + nnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'b','n')<CR> + nnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'','n')<CR> + xnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'b','v')<CR> + xnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'','v')<CR> + xnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'b','v')<CR> + xnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'','v')<CR> let b:undo_ftplugin = b:undo_ftplugin \."| sil! exe 'unmap <buffer> [[' | sil! exe 'unmap <buffer> ]]' | sil! exe 'unmap <buffer> []' | sil! exe 'unmap <buffer> ]['" @@ -290,12 +290,13 @@ function! s:searchsyn(pattern, syn, flags, mode) abort norm! gv endif let i = 0 + call map(a:syn, 'hlID(v:val)') while i < cnt let i = i + 1 let line = line('.') let col = col('.') let pos = search(a:pattern,'W'.a:flags) - while pos != 0 && s:synname() !~# a:syn + while pos != 0 && index(a:syn, s:synid()) < 0 let pos = search(a:pattern,'W'.a:flags) endwhile if pos == 0 @@ -305,8 +306,8 @@ function! s:searchsyn(pattern, syn, flags, mode) abort endwhile endfunction -function! s:synname() abort - return synIDattr(synID(line('.'),col('.'),0),'name') +function! s:synid() abort + return synID(line('.'),col('.'),0) endfunction function! s:wrap_i(back,forward) abort @@ -362,7 +363,7 @@ function! RubyCursorFile() abort let pre = matchstr(strpart(getline('.'), 0, col('.')-1), '.*\f\@<!') let post = matchstr(strpart(getline('.'), col('.')), '\f\@!.*') let ext = getline('.') =~# '^\s*\%(require\%(_relative\)\=\|autoload\)\>' && cfile !~# '\.rb$' ? '.rb' : '' - if s:synname() ==# 'rubyConstant' + if s:synid() ==# hlID('rubyConstant') let cfile = substitute(cfile,'\.\w\+[?!=]\=$','','') let cfile = substitute(cfile,'::','/','g') let cfile = substitute(cfile,'\(\u\+\)\(\u\l\)','\1_\2', 'g') diff --git a/ftplugin/vue.vim b/ftplugin/vue.vim index 4bb5ae20..14ad26a0 100644 --- a/ftplugin/vue.vim +++ b/ftplugin/vue.vim @@ -13,4 +13,11 @@ runtime! ftplugin/html.vim setlocal suffixesadd+=.vue +if exists('g:loaded_ale') + let g:ale_linters = get(g:, 'ale_linters', {}) + let g:ale_linters.vue = get(g:ale_linters, 'vue', ['eslint']) + let g:ale_linter_aliases = get(g:, 'ale_linter_aliases', {}) + let g:ale_linter_aliases.vue = get(g:ale_linter_aliases, 'vue', 'javascript') +endif + endif |