diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2019-03-04 09:15:44 +0100 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2019-03-04 09:15:44 +0100 |
commit | ed677c34d55a0e025b7008f29419498a3989cde2 (patch) | |
tree | 62efef78ed05b2b4e61efb21e40a6b337359eb8e /ftplugin | |
parent | c161994e9607399a7b365ab274592bfc4f100306 (diff) | |
download | vim-polyglot-ed677c34d55a0e025b7008f29419498a3989cde2.tar.gz vim-polyglot-ed677c34d55a0e025b7008f29419498a3989cde2.zip |
Update
Diffstat (limited to 'ftplugin')
-rw-r--r-- | ftplugin/elixir.vim | 6 | ||||
-rw-r--r-- | ftplugin/eruby.vim | 17 | ||||
-rw-r--r-- | ftplugin/graphql.vim | 2 | ||||
-rw-r--r-- | ftplugin/kotlin.vim | 9 | ||||
-rw-r--r-- | ftplugin/rst.vim | 9 | ||||
-rw-r--r-- | ftplugin/ruby.vim | 36 | ||||
-rw-r--r-- | ftplugin/rust.vim | 10 | ||||
-rw-r--r-- | ftplugin/terraform.vim | 4 | ||||
-rw-r--r-- | ftplugin/toml.vim | 20 |
9 files changed, 58 insertions, 55 deletions
diff --git a/ftplugin/elixir.vim b/ftplugin/elixir.vim index debaa10a..f37efe68 100644 --- a/ftplugin/elixir.vim +++ b/ftplugin/elixir.vim @@ -30,7 +30,7 @@ let &l:path = \ &g:path \ ], ',') setlocal includeexpr=elixir#util#get_filename(v:fname) -setlocal suffixesadd=.ex,.exs,.eex,.erl,.yrl,.hrl +setlocal suffixesadd=.ex,.exs,.eex,.erl,.xrl,.yrl,.hrl let &l:define = 'def\(macro\|guard\|delegate\)\=p\=' @@ -49,9 +49,7 @@ onoremap <buffer> <silent> <expr> [[ ':silent keeppatterns ?'.b:block_begin.'<CR onoremap <buffer> <silent> <expr> ][ ':silent keeppatterns /'.b:block_end .'<CR>' onoremap <buffer> <silent> <expr> [] ':silent keeppatterns ?'.b:block_end .'<CR>' -silent! setlocal formatoptions-=t formatoptions+=croqlj - -let b:undo_ftplugin = 'setlocal sw< sts< et< isk< com< cms< path< inex< sua< def<'. +let b:undo_ftplugin = 'setlocal sw< sts< et< isk< com< cms< path< inex< sua< def< fo<'. \ '| unlet! b:match_ignorecase b:match_words b:block_begin b:block_end' endif diff --git a/ftplugin/eruby.vim b/ftplugin/eruby.vim index 12d3245f..07558f9c 100644 --- a/ftplugin/eruby.vim +++ b/ftplugin/eruby.vim @@ -7,7 +7,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ruby') == -1 " Release Coordinator: Doug Kearns <dougkearns@gmail.com> " Only do this when not done yet for this buffer -if get(b:, 'did_ftplugin') =~# '\<eruby\>' +if exists("b:did_ftplugin") finish endif @@ -25,8 +25,6 @@ endif if &filetype =~ '^eruby\.' let b:eruby_subtype = matchstr(&filetype,'^eruby\.\zs\w\+') -elseif &filetype =~ '^.*\.eruby\>' - let b:eruby_subtype = matchstr(&filetype,'^.\{-\}\ze\.eruby\>') elseif !exists("b:eruby_subtype") let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$") let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+') @@ -49,14 +47,11 @@ elseif !exists("b:eruby_subtype") endif endif -if &filetype =~# '^eruby\>' - if exists("b:eruby_subtype") && b:eruby_subtype != '' && b:eruby_subtype !=? 'eruby' - exe "runtime! ftplugin/".b:eruby_subtype.".vim ftplugin/".b:eruby_subtype."_*.vim ftplugin/".b:eruby_subtype."/*.vim" - else - runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim - endif +if exists("b:eruby_subtype") && b:eruby_subtype != '' && b:eruby_subtype !=? 'eruby' + exe "runtime! ftplugin/".b:eruby_subtype.".vim ftplugin/".b:eruby_subtype."_*.vim ftplugin/".b:eruby_subtype."/*.vim" +else + runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim endif -let s:did_ftplugin = get(b:, 'did_ftplugin', 1) unlet! b:did_ftplugin " Override our defaults if these were set by an included ftplugin. @@ -89,7 +84,7 @@ let s:path = &l:path let s:suffixesadd = &l:suffixesadd runtime! ftplugin/ruby.vim ftplugin/ruby_*.vim ftplugin/ruby/*.vim -let b:did_ftplugin = s:did_ftplugin . '.eruby' +let b:did_ftplugin = 1 " Combine the new set of values with those previously included. if exists("b:undo_ftplugin") diff --git a/ftplugin/graphql.vim b/ftplugin/graphql.vim index d1ac4329..ce5fd3d1 100644 --- a/ftplugin/graphql.vim +++ b/ftplugin/graphql.vim @@ -17,4 +17,6 @@ setlocal softtabstop=2 setlocal shiftwidth=2 setlocal expandtab +let b:undo_ftplugin = 'setlocal com< cms< fo< isk< sts< sw< et<' + endif diff --git a/ftplugin/kotlin.vim b/ftplugin/kotlin.vim new file mode 100644 index 00000000..0fceaf35 --- /dev/null +++ b/ftplugin/kotlin.vim @@ -0,0 +1,9 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'kotlin') == -1 + +if exists("b:did_ftplugin") | finish | endif +let b:did_ftplugin = 1 + +setlocal comments=:// +setlocal commentstring=//\ %s + +endif diff --git a/ftplugin/rst.vim b/ftplugin/rst.vim index e6ef32cd..edd1f977 100644 --- a/ftplugin/rst.vim +++ b/ftplugin/rst.vim @@ -5,7 +5,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rst') == -1 " Maintainer: Marshall Ward <marshall.ward@gmail.com> " Original Maintainer: Nikolai Weibull <now@bitwi.se> " Website: https://github.com/marshallward/vim-restructuredtext -" Latest Revision: 2018-01-07 +" Latest Revision: 2018-12-29 if exists("b:did_ftplugin") finish @@ -15,6 +15,11 @@ let b:did_ftplugin = 1 let s:cpo_save = &cpo set cpo&vim +"Disable folding +if !exists('g:rst_fold_enabled') + let g:rst_fold_enabled = 0 +endif + let b:undo_ftplugin = "setl com< cms< et< fo<" setlocal comments=fb:.. commentstring=..\ %s expandtab @@ -27,7 +32,7 @@ setlocal formatoptions+=tcroql " " More sophisticated indentation rules should be revisted in the future. -if !exists("g:rst_style") || g:rst_style != 0 +if exists("g:rst_style") && g:rst_style != 0 setlocal expandtab shiftwidth=3 softtabstop=3 tabstop=8 endif diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 5b763e16..4c925fab 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -4,8 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ruby') == -1 " Language: Ruby " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " URL: https://github.com/vim-ruby/vim-ruby -" Release Coordinator: Doug Kearns <dougkearns@gmail.com> -" ---------------------------------------------------------------------------- +" Release Coordinator: Doug Kearns <dougkearns@gmail.com> if (exists("b:did_ftplugin")) finish @@ -26,20 +25,20 @@ if exists("loaded_matchit") && !exists("b:match_words") let b:match_ignorecase = 0 let b:match_words = - \ '\<\%(if\|unless\|case\|while\|until\|for\|do\|class\|module\|def\|begin\)\>=\@!' . + \ '\<\%(if\|unless\|case\|while\|until\|for\|do\|class\|module\|def\|=\@<!begin\)\>=\@!' . \ ':' . \ '\<\%(else\|elsif\|ensure\|when\|rescue\|break\|redo\|next\|retry\)\>' . \ ':' . - \ '\%(^\|[^.\:@$]\)\@<=\<end\:\@!\>' . + \ '\%(^\|[^.\:@$=]\)\@<=\<end\:\@!\>' . + \ ',^=begin\>:^=end\>,' . \ ',{:},\[:\],(:)' let b:match_skip = \ "synIDattr(synID(line('.'),col('.'),0),'name') =~ '" . - \ "\\<ruby\\%(String\\|StringDelimiter\\|ASCIICode\\|Escape\\|" . - \ "Regexp\\|RegexpDelimiter\\|" . - \ "Interpolation\\|NoInterpolation\\|Comment\\|Documentation\\|" . - \ "ConditionalModifier\\|RepeatModifier\\|OptionalDo\\|" . - \ "Function\\|BlockArgument\\|KeywordAsMethod\\|ClassVariable\\|" . + \ "\\<ruby\\%(String\\|.\+Delimiter\\|Character\\|.\+Escape\\|" . + \ "Regexp\\|Interpolation\\|Comment\\|Documentation\\|" . + \ "ConditionalModifier\\|RepeatModifier\\|RescueModifier\\|OptionalDo\\|" . + \ "MethodName\\|BlockArgument\\|KeywordAsMethod\\|ClassVariable\\|" . \ "InstanceVariable\\|GlobalVariable\\|Symbol\\)\\>'" endif @@ -154,7 +153,7 @@ endif 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:map + exe a:mode.'map' '<buffer>' a:flags a:map let b:undo_ftplugin .= '|sil! '.a:mode.'unmap <buffer> '.from endif endfunction @@ -313,13 +312,16 @@ function! s:synid() abort endfunction function! s:wrap_i(back,forward) abort - execute 'norm k'.a:forward + execute 'norm! k' + execute 'norm '.a:forward let line = line('.') execute 'norm '.a:back if line('.') == line - 1 return s:wrap_a(a:back,a:forward) endif - execute 'norm jV'.a:forward.'k' + execute 'norm! jV' + execute 'norm '.a:forward + execute 'norm! k' endfunction function! s:wrap_a(back,forward) abort @@ -332,11 +334,15 @@ function! s:wrap_a(back,forward) abort - endwhile if exists('after') - execute 'norm V'.a:forward.'j' + execute 'norm! V' + execute 'norm '.a:forward + execute 'norm! j' elseif line('.') > 1 && getline(line('.')-1) =~# '^\s*$' - execute 'norm kV'.a:forward + execute 'norm! kV' + execute 'norm '.a:forward else - execute 'norm V'.a:forward + execute 'norm! V' + execute 'norm '.a:forward endif endfunction diff --git a/ftplugin/rust.vim b/ftplugin/rust.vim index cdc318f1..fa9e1562 100644 --- a/ftplugin/rust.vim +++ b/ftplugin/rust.vim @@ -5,7 +5,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1 " Maintainer: Chris Morgan <me@chrismorgan.info> " Maintainer: Kevin Ballard <kevin@sb.org> " Last Change: June 08, 2016 -" For bugs, patches and license go to https://github.com/rust-lang/rust.vim +" For bugs, patches and license go to https://github.com/rust-lang/rust.vim if exists("b:did_ftplugin") finish @@ -54,8 +54,8 @@ if get(g:, 'rust_recommended_style', 1) setlocal textwidth=99 endif -" This includeexpr isn't perfect, but it's a good start -setlocal includeexpr=substitute(v:fname,'::','/','g') +setlocal include=\\v^\\s*(pub\\s+)?use\\s+\\zs(\\f\|:)+ +setlocal includeexpr=rust#IncludeExpr(v:fname) setlocal suffixesadd=.rs @@ -149,7 +149,7 @@ endif " Cleanup {{{1 let b:undo_ftplugin = " - \ setlocal formatoptions< comments< commentstring< includeexpr< suffixesadd< + \ setlocal formatoptions< comments< commentstring< include< includeexpr< suffixesadd< \|if exists('b:rust_set_style') \|setlocal tabstop< shiftwidth< softtabstop< expandtab< textwidth< \|endif @@ -188,7 +188,7 @@ let b:undo_ftplugin = " " Code formatting on save augroup rust.vim.PreWrite autocmd! - autocmd BufWritePre <buffer> silent! call rustfmt#PreWrite() + autocmd BufWritePre *.rs silent! call rustfmt#PreWrite() augroup END setlocal matchpairs+=<:> diff --git a/ftplugin/terraform.vim b/ftplugin/terraform.vim index bbebacbc..c5c30627 100644 --- a/ftplugin/terraform.vim +++ b/ftplugin/terraform.vim @@ -3,6 +3,8 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'terraform') == " terraform.vim - basic vim/terraform integration " Maintainer: HashiVim <https://github.com/hashivim> +set formatoptions-=t + if exists("g:loaded_terraform") || v:version < 700 || &cp || !executable('terraform') finish endif @@ -44,7 +46,7 @@ endfunction " https://github.com/fatih/vim-hclfmt/blob/master/autoload/fmt.vim function! terraform#fmt() let l:curw = winsaveview() - let l:tmpfile = tempname() + let l:tmpfile = tempname() . ".tf" call writefile(getline(1, "$"), l:tmpfile) let output = system("terraform fmt -write " . l:tmpfile) if v:shell_error == 0 diff --git a/ftplugin/toml.vim b/ftplugin/toml.vim index baa19ba1..b440a714 100644 --- a/ftplugin/toml.vim +++ b/ftplugin/toml.vim @@ -3,7 +3,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'toml') == -1 " File: ftplugin/toml.vim " Author: Kevin Ballard <kevin@sb.org> " Description: FileType Plugin for Toml -" Last Change: Dec 09, 2014 +" Last Change: Feb 12, 2019 if exists('b:did_ftplugin') finish @@ -12,24 +12,10 @@ let b:did_ftplugin = 1 let s:save_cpo = &cpo set cpo&vim +let b:undo_ftplugin = 'setlocal commentstring< comments<' setlocal commentstring=#\ %s - -" Add NERDCommenter delimiters - -let s:delims = { 'left': '#' } -if exists('g:NERDDelimiterMap') - if !has_key(g:NERDDelimiterMap, 'toml') - let g:NERDDelimiterMap.toml = s:delims - endif -elseif exists('g:NERDCustomDelimiters') - if !has_key(g:NERDCustomDelimiters, 'toml') - let g:NERDCustomDelimiters.toml = s:delims - endif -else - let g:NERDCustomDelimiters = { 'toml': s:delims } -endif -unlet s:delims +setlocal comments=:# let &cpo = s:save_cpo unlet s:save_cpo |