diff options
Diffstat (limited to 'ftplugin')
-rw-r--r-- | ftplugin/crystal.vim | 1 | ||||
-rw-r--r-- | ftplugin/git.vim | 2 | ||||
-rw-r--r-- | ftplugin/julia.vim | 11 | ||||
-rw-r--r-- | ftplugin/juliadoc.vim | 34 | ||||
-rw-r--r-- | ftplugin/rust.vim | 44 | ||||
-rw-r--r-- | ftplugin/rust/tagbar.vim | 32 | ||||
-rw-r--r-- | ftplugin/slim.vim | 18 | ||||
-rw-r--r-- | ftplugin/terraform.vim | 73 | ||||
-rw-r--r-- | ftplugin/vue.vim | 4 |
9 files changed, 173 insertions, 46 deletions
diff --git a/ftplugin/crystal.vim b/ftplugin/crystal.vim index 6ef907be..58ce5251 100644 --- a/ftplugin/crystal.vim +++ b/ftplugin/crystal.vim @@ -51,6 +51,7 @@ command! -buffer -nargs=? CrystalSpecSwitch call crystal_lang#switch_spec_file(< command! -buffer -nargs=? CrystalSpecRunAll call crystal_lang#run_all_spec(<f-args>) command! -buffer -nargs=? CrystalSpecRunCurrent call crystal_lang#run_current_spec(<f-args>) command! -buffer -nargs=* -bar CrystalFormat call crystal_lang#format(<q-args>, 0) +command! -buffer -nargs=* CrystalExpand echo crystal_lang#expand(expand('%'), getpos('.'), <q-args>).output nnoremap <buffer><Plug>(crystal-jump-to-definition) :<C-u>CrystalDef<CR> nnoremap <buffer><Plug>(crystal-show-context) :<C-u>CrystalContext<CR> diff --git a/ftplugin/git.vim b/ftplugin/git.vim index 38b9493b..e5c34b48 100644 --- a/ftplugin/git.vim +++ b/ftplugin/git.vim @@ -12,7 +12,7 @@ endif let b:did_ftplugin = 1 if !exists('b:git_dir') - if expand('%:p') =~# '[\/]\.git[\/]modules[\/]' + if expand('%:p') =~# '[\/]\.git[\/]modules[\/]\|:[\/][\/]\|^\a\a\+:' " Stay out of the way elseif expand('%:p') =~# '[\/]\.git[\/]worktrees' let b:git_dir = matchstr(expand('%:p'),'.*\.git[\/]worktrees[\/][^\/]\+\>') diff --git a/ftplugin/julia.vim b/ftplugin/julia.vim index 2d1bcb49..caddabaf 100644 --- a/ftplugin/julia.vim +++ b/ftplugin/julia.vim @@ -19,11 +19,12 @@ setlocal comments=:# setlocal commentstring=#=%s=# setlocal cinoptions+=#1 setlocal define=^\\s*macro\\> +setlocal fo-=t fo+=croql let b:julia_vim_loaded = 1 let b:undo_ftplugin = "setlocal include< suffixesadd< comments< commentstring<" - \ . " define< shiftwidth< expandtab< indentexpr< indentkeys< cinoptions< omnifunc<" + \ . " define< fo< shiftwidth< expandtab< indentexpr< indentkeys< cinoptions< omnifunc<" \ . " | unlet! b:julia_vim_loaded" " MatchIt plugin support @@ -93,6 +94,14 @@ if has("gui_win32") let b:undo_ftplugin = b:undo_ftplugin . " | unlet! b:browsefilter" endif +" Lookup documents +nnoremap <silent><buffer> <Plug>(JuliaDocPrompt) :<C-u>call julia#doc#prompt()<CR> +command! -nargs=1 -buffer -complete=customlist,julia#doc#complete JuliaDoc call julia#doc#open(<q-args>) +command! -nargs=1 -buffer JuliaDocKeywordprg call julia#doc#keywordprg(<q-args>) +setlocal keywordprg=:JuliaDocKeywordprg +let b:undo_ftplugin .= " | setlocal keywordprg<" +let b:undo_ftplugin .= " | delcommand JuliaDoc | delcommand JuliaDocKeywordprg" + let &cpo = s:save_cpo unlet s:save_cpo diff --git a/ftplugin/juliadoc.vim b/ftplugin/juliadoc.vim new file mode 100644 index 00000000..0544ff8d --- /dev/null +++ b/ftplugin/juliadoc.vim @@ -0,0 +1,34 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1 + +" Vim filetype plugin file +" Language: Julia document + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:save_cpo = &cpo +set cpo-=C + +setlocal conceallevel=2 +setlocal concealcursor=nc +setlocal wrap + +if !exists('b:undo_ftplugin') + let b:undo_ftplugin = '' +endif +let b:undo_ftplugin .= 'setlocal conceallevel< concealcursor< wrap<' + +" Lookup documents +nnoremap <silent><buffer> <Plug>(JuliaDocPrompt) :<C-u>call julia#doc#prompt()<CR> +command! -nargs=1 -buffer -complete=customlist,julia#doc#complete JuliaDoc call julia#doc#open(<q-args>) +command! -nargs=1 -buffer JuliaDocKeywordprg call julia#doc#keywordprg(<q-args>) +setlocal keywordprg=:JuliaDocKeywordprg +let b:undo_ftplugin .= " | setlocal keywordprg<" +let b:undo_ftplugin .= " | delcommand JuliaDoc | delcommand JuliaDocKeywordprg" + +let &cpo = s:save_cpo +unlet s:save_cpo + +endif diff --git a/ftplugin/rust.vim b/ftplugin/rust.vim index acf4d71d..ead86d13 100644 --- a/ftplugin/rust.vim +++ b/ftplugin/rust.vim @@ -12,8 +12,10 @@ if exists("b:did_ftplugin") endif let b:did_ftplugin = 1 +" vint: -ProhibitAbbreviationOption let s:save_cpo = &cpo set cpo&vim +" vint: +ProhibitAbbreviationOption augroup rust.vim autocmd! @@ -69,32 +71,13 @@ augroup rust.vim let b:rust_original_delimitMate_excluded_regions = b:delimitMate_excluded_regions endif - let s:delimitMate_extra_excluded_regions = ',rustLifetimeCandidate,rustGenericLifetimeCandidate' - - " For this buffer, when delimitMate issues the `User delimitMate_map` - " event in the autocommand system, add the above-defined extra excluded - " regions to delimitMate's state, if they have not already been added. - autocmd User <buffer> - \ if expand('<afile>') ==# 'delimitMate_map' && match( - \ delimitMate#Get("excluded_regions"), - \ s:delimitMate_extra_excluded_regions) == -1 - \| let b:delimitMate_excluded_regions = - \ delimitMate#Get("excluded_regions") - \ . s:delimitMate_extra_excluded_regions - \|endif + autocmd User delimitMate_map :call rust#delimitmate#onMap() + autocmd User delimitMate_unmap :call rust#delimitmate#onUnmap() + endif - " For this buffer, when delimitMate issues the `User delimitMate_unmap` - " event in the autocommand system, delete the above-defined extra excluded - " regions from delimitMate's state (the deletion being idempotent and - " having no effect if the extra excluded regions are not present in the - " targeted part of delimitMate's state). - autocmd User <buffer> - \ if expand('<afile>') ==# 'delimitMate_unmap' - \| let b:delimitMate_excluded_regions = substitute( - \ delimitMate#Get("excluded_regions"), - \ '\C\V' . s:delimitMate_extra_excluded_regions, - \ '', 'g') - \|endif + " Integration with auto-pairs (https://github.com/jiangmiao/auto-pairs) + if exists("g:AutoPairsLoaded") && !get(g:, 'rust_keep_autopairs_default', 0) + let b:AutoPairs = {'(':')', '[':']', '{':'}','"':'"', '`':'`'} endif if has("folding") && get(g:, 'rust_fold', 0) @@ -154,6 +137,9 @@ augroup rust.vim " See |:RustInfoToFile| for docs command! -bar -nargs=1 RustInfoToFile call rust#debugging#InfoToFile(<f-args>) + " See |:RustTest| for docs + command! -buffer -nargs=* -bang RustTest call rust#Test(<bang>0, <q-args>) + if !exists("b:rust_last_rustc_args") || !exists("b:rust_last_args") let b:rust_last_rustc_args = [] let b:rust_last_args = [] @@ -192,23 +178,25 @@ augroup rust.vim \|xunmap <buffer> ]] \|ounmap <buffer> [[ \|ounmap <buffer> ]] - \|set matchpairs-=<:> + \|setlocal matchpairs-=<:> \|unlet b:match_skip \" " }}}1 " Code formatting on save - autocmd BufWritePre *.rs silent! call rustfmt#PreWrite() + autocmd BufWritePre <buffer> silent! call rustfmt#PreWrite() augroup END -set matchpairs+=<:> +setlocal matchpairs+=<:> " For matchit.vim (rustArrow stops `Fn() -> X` messing things up) let b:match_skip = 's:comment\|string\|rustArrow' +" vint: -ProhibitAbbreviationOption let &cpo = s:save_cpo unlet s:save_cpo +" vint: +ProhibitAbbreviationOption " vim: set et sw=4 sts=4 ts=8: diff --git a/ftplugin/rust/tagbar.vim b/ftplugin/rust/tagbar.vim index 5c95f357..d30dd7d7 100644 --- a/ftplugin/rust/tagbar.vim +++ b/ftplugin/rust/tagbar.vim @@ -7,30 +7,36 @@ if !exists(':Tagbar') finish endif +" vint: -ProhibitAbbreviationOption let s:save_cpo = &cpo set cpo&vim +" vint: +ProhibitAbbreviationOption -let g:tagbar_type_rust = { - \ 'ctagstype' : 'rust', - \ 'kinds' : [ - \'T:types', - \'f:functions', - \'g:enumerations', - \'s:structures', - \'m:modules', - \'c:constants', - \'t:traits', - \'i:trait implementations', - \ ] - \ } +if !exists('g:tagbar_type_rust') + let g:tagbar_type_rust = { + \ 'ctagstype' : 'rust', + \ 'kinds' : [ + \'T:types', + \'f:functions', + \'g:enumerations', + \'s:structures', + \'m:modules', + \'c:constants', + \'t:traits', + \'i:trait implementations', + \ ] + \ } +endif " In case you've updated/customized your ~/.ctags and prefer to use it. if !get(g:, 'rust_use_custom_ctags_defs', 0) let g:tagbar_type_rust.deffile = expand('<sfile>:p:h:h:h') . '/ctags/rust.ctags' endif +" vint: -ProhibitAbbreviationOption let &cpo = s:save_cpo unlet s:save_cpo +" vint: +ProhibitAbbreviationOption " vim: set et sw=4 sts=4 ts=8: diff --git a/ftplugin/slim.vim b/ftplugin/slim.vim index 99ebeeb3..8de98c8a 100644 --- a/ftplugin/slim.vim +++ b/ftplugin/slim.vim @@ -3,9 +3,25 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'slim') == -1 if exists("b:did_ftplugin") finish endif + +" Define some defaults in case the included ftplugins don't set them. +let s:undo_ftplugin = "" + +" Override our defaults if these were set by an included ftplugin. +if exists("b:undo_ftplugin") + let s:undo_ftplugin = b:undo_ftplugin + unlet b:undo_ftplugin +endif + +runtime! ftplugin/ruby.vim ftplugin/ruby_*.vim ftplugin/ruby/*.vim let b:did_ftplugin = 1 -let b:undo_ftplugin = "setl isk<" +" Combine the new set of values with those previously included. +if exists("b:undo_ftplugin") + let s:undo_ftplugin = b:undo_ftplugin . " | " . s:undo_ftplugin +endif + +let b:undo_ftplugin = "setl isk<" . " | " . s:undo_ftplugin setlocal iskeyword+=- setlocal commentstring=/%s diff --git a/ftplugin/terraform.vim b/ftplugin/terraform.vim new file mode 100644 index 00000000..ce646377 --- /dev/null +++ b/ftplugin/terraform.vim @@ -0,0 +1,73 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'terraform') == -1 + +" terraform.vim - basic vim/terraform integration +" Maintainer: HashiVim <https://github.com/hashivim> + +if exists("g:loaded_terraform") || v:version < 700 || &cp || !executable('terraform') + finish +endif +let g:loaded_terraform = 1 + +if !exists("g:terraform_fmt_on_save") + let g:terraform_fmt_on_save = 0 +endif + +function! s:commands(A, L, P) + return join([ + \ "apply", + \ "console", + \ "destroy", + \ "env", + \ "fmt", + \ "get", + \ "graph", + \ "import", + \ "init", + \ "output", + \ "plan", + \ "providers", + \ "push", + \ "refresh", + \ "show", + \ "taint", + \ "untaint", + \ "validate", + \ "version", + \ "workspace", + \ "debug", + \ "force-unlock", + \ "state" + \ ], "\n") +endfunction + +" Adapted from vim-hclfmt: +" https://github.com/fatih/vim-hclfmt/blob/master/autoload/fmt.vim +function! terraform#fmt() + let l:curw = winsaveview() + let l:tmpfile = tempname() + call writefile(getline(1, "$"), l:tmpfile) + let output = system("terraform fmt -write " . l:tmpfile) + if v:shell_error == 0 + try | silent undojoin | catch | endtry + call rename(l:tmpfile, resolve(expand("%"))) + silent edit! + let &syntax = &syntax + else + echo output + call delete(l:tmpfile) + endif + call winrestview(l:curw) +endfunction + +augroup terraform + autocmd! + autocmd VimEnter * + \ command! -nargs=+ -complete=custom,s:commands Terraform execute '!terraform '.<q-args>. ' -no-color' + autocmd VimEnter * command! -nargs=0 TerraformFmt call terraform#fmt() + if get(g:, "terraform_fmt_on_save", 1) + autocmd BufWritePre *.tf call terraform#fmt() + autocmd BufWritePre *.tfvars call terraform#fmt() + endif +augroup END + +endif diff --git a/ftplugin/vue.vim b/ftplugin/vue.vim index 959dca4e..2f57d65d 100644 --- a/ftplugin/vue.vim +++ b/ftplugin/vue.vim @@ -22,7 +22,7 @@ endif " Run only ESLint for Vue files by default. " linters specifically for Vue can still be loaded. -let b:ale_linter_aliases = ['vue', 'javascript'] -let b:ale_linters = ['eslint'] +let b:ale_linter_aliases = get(get(g:, 'ale_linter_aliases', {}), 'vue', ['vue', 'javascript']) +let b:ale_linters = get(get(g:, 'ale_linters', {}), 'vue', ['eslint', 'vls']) endif |