diff options
Diffstat (limited to 'runtime/ftplugin')
-rw-r--r-- | runtime/ftplugin/c.vim | 6 | ||||
-rw-r--r-- | runtime/ftplugin/gdb.vim | 12 | ||||
-rw-r--r-- | runtime/ftplugin/hamster.vim | 3 | ||||
-rw-r--r-- | runtime/ftplugin/neomuttrc.vim | 23 | ||||
-rw-r--r-- | runtime/ftplugin/perl.vim | 13 | ||||
-rw-r--r-- | runtime/ftplugin/python.vim | 35 | ||||
-rw-r--r-- | runtime/ftplugin/rust.vim | 197 | ||||
-rw-r--r-- | runtime/ftplugin/sbt.vim | 15 | ||||
-rw-r--r-- | runtime/ftplugin/verilog.vim | 21 | ||||
-rw-r--r-- | runtime/ftplugin/zsh.vim | 12 |
10 files changed, 308 insertions, 29 deletions
diff --git a/runtime/ftplugin/c.vim b/runtime/ftplugin/c.vim index 3717ea92a9..6047f9f863 100644 --- a/runtime/ftplugin/c.vim +++ b/runtime/ftplugin/c.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: C " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2016 Jun 12 +" Last Change: 2017 Sep 28 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -30,8 +30,8 @@ endif setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// " When the matchit plugin is loaded, this makes the % command skip parens and -" braces in comments. -let b:match_words = &matchpairs . ',^\s*#\s*if\(\|def\|ndef\)\>:^\s*#\s*elif\>:^\s*#\s*else\>:^\s*#\s*endif\>' +" braces in comments properly. +let b:match_words = '^\s*#\s*if\(\|def\|ndef\)\>:^\s*#\s*elif\>:^\s*#\s*else\>:^\s*#\s*endif\>' let b:match_skip = 's:comment\|string\|character\|special' " Win32 can filter files in the browse dialog diff --git a/runtime/ftplugin/gdb.vim b/runtime/ftplugin/gdb.vim new file mode 100644 index 0000000000..2473b13af0 --- /dev/null +++ b/runtime/ftplugin/gdb.vim @@ -0,0 +1,12 @@ +" Vim filetype plugin file +" Language: gdb +" Maintainer: Michaël Peeters <NOSPAMm.vim@noekeon.org> +" Last Changed: 26 Oct 2017 + +if exists("b:did_ftplugin") | finish | endif +let b:did_ftplugin = 1 + +setlocal commentstring=#%s + +" Undo the stuff we changed. +let b:undo_ftplugin = "setlocal cms<" diff --git a/runtime/ftplugin/hamster.vim b/runtime/ftplugin/hamster.vim index 29711fb093..6c0630fe04 100644 --- a/runtime/ftplugin/hamster.vim +++ b/runtime/ftplugin/hamster.vim @@ -2,7 +2,7 @@ " Language: Hamster Script " Version: 2.0.6.0 " Maintainer: David Fishburn <dfishburn dot vim at gmail dot com> -" Last Change: 2017 Mar 07 +" Last Change: 2017 Mar 18 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -14,7 +14,6 @@ let b:did_ftplugin = 1 let s:cpo_save = &cpo set cpo&vim -set cpo-=C let b:undo_ftplugin = "setl fo< com< tw< commentstring<" \ . "| unlet! b:match_ignorecase b:match_words b:match_skip" diff --git a/runtime/ftplugin/neomuttrc.vim b/runtime/ftplugin/neomuttrc.vim new file mode 100644 index 0000000000..86f1cded63 --- /dev/null +++ b/runtime/ftplugin/neomuttrc.vim @@ -0,0 +1,23 @@ +" Vim filetype plugin file +" Language: NeoMutt RC File +" Previous Maintainer: Guillaume Brogi <gui-gui@netcourrier.com> +" Latest Revision: 2017-09-17 +" Original version copied from ftplugin/muttrc.vim + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:cpo_save = &cpo +set cpo&vim + +let b:undo_ftplugin = "setl com< cms< inc< fo<" + +setlocal comments=:# commentstring=#\ %s +setlocal formatoptions-=t formatoptions+=croql + +let &l:include = '^\s*source\>' + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/ftplugin/perl.vim b/runtime/ftplugin/perl.vim index 741cfae047..e7acf654f3 100644 --- a/runtime/ftplugin/perl.vim +++ b/runtime/ftplugin/perl.vim @@ -3,7 +3,7 @@ " Maintainer: vim-perl <vim-perl@googlegroups.com> " Homepage: http://github.com/vim-perl/vim-perl " Bugs/requests: http://github.com/vim-perl/vim-perl/issues -" Last Change: 2013-07-21 +" Last Change: 2015-02-09 if exists("b:did_ftplugin") | finish | endif let b:did_ftplugin = 1 @@ -33,14 +33,14 @@ endif setlocal include=\\<\\(use\\\|require\\)\\> setlocal includeexpr=substitute(substitute(substitute(v:fname,'::','/','g'),'->\*','',''),'$','.pm','') setlocal define=[^A-Za-z_] +setlocal iskeyword+=: " The following line changes a global variable but is necessary to make -" gf and similar commands work. The change to iskeyword was incorrect. -" Thanks to Andrew Pimlott for pointing out the problem. If this causes a -" problem for you, add an after/ftplugin/perl.vim file that contains +" gf and similar commands work. Thanks to Andrew Pimlott for pointing +" out the problem. If this causes a problem for you, add an +" after/ftplugin/perl.vim file that contains " set isfname-=: set isfname+=: -set iskeyword+=: " Set this once, globally. if !exists("perlpath") @@ -77,11 +77,12 @@ endif "--------------------------------------------- " Undo the stuff we changed. -let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isf< kp< path<" . +let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isk< isf< kp< path<" . \ " | unlet! b:browsefilter" " proper matching for matchit plugin let b:match_skip = 's:comment\|string\|perlQQ\|perlShellCommand\|perlHereDoc\|perlSubstitution\|perlTranslation\|perlMatch\|perlFormatField' +let b:match_words = '\<if\>:\<elsif\>:\<else\>' " Restore the saved compatibility options. let &cpo = s:save_cpo diff --git a/runtime/ftplugin/python.vim b/runtime/ftplugin/python.vim index 546e3bd560..d52a338b5b 100644 --- a/runtime/ftplugin/python.vim +++ b/runtime/ftplugin/python.vim @@ -1,9 +1,10 @@ " Vim filetype plugin file " Language: python -" Maintainer: James Sully <sullyj3@gmail.com> +" Maintainer: Tom Picton <tom@tompicton.co.uk> +" Previous Maintainer: James Sully <sullyj3@gmail.com> " Previous Maintainer: Johannes Zellner <johannes@zellner.org> -" Last Change: Tue, 09 October 2016 -" https://github.com/sullyj3/vim-ftplugin-python +" Last Change: Fri, 20 October 2017 +" https://github.com/tpict/vim-ftplugin-python if exists("b:did_ftplugin") | finish | endif let b:did_ftplugin = 1 @@ -24,31 +25,51 @@ set wildignore+=*.pyc let b:next_toplevel='\v%$\|^(class\|def\|async def)>' let b:prev_toplevel='\v^(class\|def\|async def)>' +let b:next_endtoplevel='\v%$\|\S.*\n+(def\|class)' +let b:prev_endtoplevel='\v\S.*\n+(def\|class)' let b:next='\v%$\|^\s*(class\|def\|async def)>' let b:prev='\v^\s*(class\|def\|async def)>' +let b:next_end='\v\S\n*(%$\|^\s*(class\|def\|async def)\|^\S)' +let b:prev_end='\v\S\n*(^\s*(class\|def\|async def)\|^\S)' execute "nnoremap <silent> <buffer> ]] :call <SID>Python_jump('n', '". b:next_toplevel."', 'W')<cr>" execute "nnoremap <silent> <buffer> [[ :call <SID>Python_jump('n', '". b:prev_toplevel."', 'Wb')<cr>" +execute "nnoremap <silent> <buffer> ][ :call <SID>Python_jump('n', '". b:next_endtoplevel."', 'W', 0)<cr>" +execute "nnoremap <silent> <buffer> [] :call <SID>Python_jump('n', '". b:prev_endtoplevel."', 'Wb', 0)<cr>" execute "nnoremap <silent> <buffer> ]m :call <SID>Python_jump('n', '". b:next."', 'W')<cr>" execute "nnoremap <silent> <buffer> [m :call <SID>Python_jump('n', '". b:prev."', 'Wb')<cr>" +execute "nnoremap <silent> <buffer> ]M :call <SID>Python_jump('n', '". b:next_end."', 'W', 0)<cr>" +execute "nnoremap <silent> <buffer> [M :call <SID>Python_jump('n', '". b:prev_end."', 'Wb', 0)<cr>" execute "onoremap <silent> <buffer> ]] :call <SID>Python_jump('o', '". b:next_toplevel."', 'W')<cr>" execute "onoremap <silent> <buffer> [[ :call <SID>Python_jump('o', '". b:prev_toplevel."', 'Wb')<cr>" +execute "onoremap <silent> <buffer> ][ :call <SID>Python_jump('n', '". b:next_endtoplevel."', 'W', 0)<cr>" +execute "onoremap <silent> <buffer> [] :call <SID>Python_jump('n', '". b:prev_endtoplevel."', 'Wb', 0)<cr>" execute "onoremap <silent> <buffer> ]m :call <SID>Python_jump('o', '". b:next."', 'W')<cr>" execute "onoremap <silent> <buffer> [m :call <SID>Python_jump('o', '". b:prev."', 'Wb')<cr>" +execute "onoremap <silent> <buffer> ]M :call <SID>Python_jump('o', '". b:next_end."', 'W', 0)<cr>" +execute "onoremap <silent> <buffer> [M :call <SID>Python_jump('o', '". b:prev_end."', 'Wb', 0)<cr>" execute "xnoremap <silent> <buffer> ]] :call <SID>Python_jump('x', '". b:next_toplevel."', 'W')<cr>" execute "xnoremap <silent> <buffer> [[ :call <SID>Python_jump('x', '". b:prev_toplevel."', 'Wb')<cr>" +execute "xnoremap <silent> <buffer> ][ :call <SID>Python_jump('n', '". b:next_endtoplevel."', 'W', 0)<cr>" +execute "xnoremap <silent> <buffer> [] :call <SID>Python_jump('n', '". b:prev_endtoplevel."', 'Wb', 0)<cr>" execute "xnoremap <silent> <buffer> ]m :call <SID>Python_jump('x', '". b:next."', 'W')<cr>" execute "xnoremap <silent> <buffer> [m :call <SID>Python_jump('x', '". b:prev."', 'Wb')<cr>" +execute "xnoremap <silent> <buffer> ]M :call <SID>Python_jump('x', '". b:next_end."', 'W', 0)<cr>" +execute "xnoremap <silent> <buffer> [M :call <SID>Python_jump('x', '". b:prev_end."', 'Wb', 0)<cr>" if !exists('*<SID>Python_jump') - fun! <SID>Python_jump(mode, motion, flags) range + fun! <SID>Python_jump(mode, motion, flags, ...) range + let l:startofline = (a:0 >= 1) ? a:1 : 1 + if a:mode == 'x' normal! gv endif - normal! 0 + if l:startofline == 1 + normal! 0 + endif let cnt = v:count1 mark ' @@ -57,7 +78,9 @@ if !exists('*<SID>Python_jump') let cnt = cnt - 1 endwhile - normal! ^ + if l:startofline == 1 + normal! ^ + endif endfun endif diff --git a/runtime/ftplugin/rust.vim b/runtime/ftplugin/rust.vim new file mode 100644 index 0000000000..7efca5985b --- /dev/null +++ b/runtime/ftplugin/rust.vim @@ -0,0 +1,197 @@ +" Language: Rust +" Description: Vim ftplugin for Rust +" 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 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:save_cpo = &cpo +set cpo&vim + +augroup rust.vim +autocmd! + +" Variables {{{1 + +" The rust source code at present seems to typically omit a leader on /*! +" comments, so we'll use that as our default, but make it easy to switch. +" This does not affect indentation at all (I tested it with and without +" leader), merely whether a leader is inserted by default or not. +if exists("g:rust_bang_comment_leader") && g:rust_bang_comment_leader != 0 + " Why is the `,s0:/*,mb:\ ,ex:*/` there, you ask? I don't understand why, + " but without it, */ gets indented one space even if there were no + " leaders. I'm fairly sure that's a Vim bug. + setlocal comments=s1:/*,mb:*,ex:*/,s0:/*,mb:\ ,ex:*/,:///,://!,:// +else + setlocal comments=s0:/*!,m:\ ,ex:*/,s1:/*,mb:*,ex:*/,:///,://!,:// +endif +setlocal commentstring=//%s +setlocal formatoptions-=t formatoptions+=croqnl +" j was only added in 7.3.541, so stop complaints about its nonexistence +silent! setlocal formatoptions+=j + +" smartindent will be overridden by indentexpr if filetype indent is on, but +" otherwise it's better than nothing. +setlocal smartindent nocindent + +if !exists("g:rust_recommended_style") || g:rust_recommended_style != 0 + setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab + setlocal textwidth=99 +endif + +" This includeexpr isn't perfect, but it's a good start +setlocal includeexpr=substitute(v:fname,'::','/','g') + +setlocal suffixesadd=.rs + +if exists("g:ftplugin_rust_source_path") + let &l:path=g:ftplugin_rust_source_path . ',' . &l:path +endif + +if exists("g:loaded_delimitMate") + if exists("b:delimitMate_excluded_regions") + 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 + + " 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 +endif + +if has("folding") && exists('g:rust_fold') && g:rust_fold != 0 + let b:rust_set_foldmethod=1 + setlocal foldmethod=syntax + if g:rust_fold == 2 + setlocal foldlevel< + else + setlocal foldlevel=99 + endif +endif + +if has('conceal') && exists('g:rust_conceal') && g:rust_conceal != 0 + let b:rust_set_conceallevel=1 + setlocal conceallevel=2 +endif + +" Motion Commands {{{1 + +" Bind motion commands to support hanging indents +nnoremap <silent> <buffer> [[ :call rust#Jump('n', 'Back')<CR> +nnoremap <silent> <buffer> ]] :call rust#Jump('n', 'Forward')<CR> +xnoremap <silent> <buffer> [[ :call rust#Jump('v', 'Back')<CR> +xnoremap <silent> <buffer> ]] :call rust#Jump('v', 'Forward')<CR> +onoremap <silent> <buffer> [[ :call rust#Jump('o', 'Back')<CR> +onoremap <silent> <buffer> ]] :call rust#Jump('o', 'Forward')<CR> + +" Commands {{{1 + +" See |:RustRun| for docs +command! -nargs=* -complete=file -bang -buffer RustRun call rust#Run(<bang>0, <q-args>) + +" See |:RustExpand| for docs +command! -nargs=* -complete=customlist,rust#CompleteExpand -bang -buffer RustExpand call rust#Expand(<bang>0, <q-args>) + +" See |:RustEmitIr| for docs +command! -nargs=* -buffer RustEmitIr call rust#Emit("llvm-ir", <q-args>) + +" See |:RustEmitAsm| for docs +command! -nargs=* -buffer RustEmitAsm call rust#Emit("asm", <q-args>) + +" See |:RustPlay| for docs +command! -range=% RustPlay :call rust#Play(<count>, <line1>, <line2>, <f-args>) + +" See |:RustFmt| for docs +command! -buffer RustFmt call rustfmt#Format() + +" See |:RustFmtRange| for docs +command! -range -buffer RustFmtRange call rustfmt#FormatRange(<line1>, <line2>) + +" Mappings {{{1 + +" Bind ⌘R in MacVim to :RustRun +nnoremap <silent> <buffer> <D-r> :RustRun<CR> +" Bind ⌘⇧R in MacVim to :RustRun! pre-filled with the last args +nnoremap <buffer> <D-R> :RustRun! <C-r>=join(b:rust_last_rustc_args)<CR><C-\>erust#AppendCmdLine(' -- ' . join(b:rust_last_args))<CR> + +if !exists("b:rust_last_rustc_args") || !exists("b:rust_last_args") + let b:rust_last_rustc_args = [] + let b:rust_last_args = [] +endif + +" Cleanup {{{1 + +let b:undo_ftplugin = " + \ setlocal formatoptions< comments< commentstring< includeexpr< suffixesadd< + \|setlocal tabstop< shiftwidth< softtabstop< expandtab< textwidth< + \|if exists('b:rust_original_delimitMate_excluded_regions') + \|let b:delimitMate_excluded_regions = b:rust_original_delimitMate_excluded_regions + \|unlet b:rust_original_delimitMate_excluded_regions + \|else + \|unlet! b:delimitMate_excluded_regions + \|endif + \|if exists('b:rust_set_foldmethod') + \|setlocal foldmethod< foldlevel< + \|unlet b:rust_set_foldmethod + \|endif + \|if exists('b:rust_set_conceallevel') + \|setlocal conceallevel< + \|unlet b:rust_set_conceallevel + \|endif + \|unlet! b:rust_last_rustc_args b:rust_last_args + \|delcommand RustRun + \|delcommand RustExpand + \|delcommand RustEmitIr + \|delcommand RustEmitAsm + \|delcommand RustPlay + \|nunmap <buffer> <D-r> + \|nunmap <buffer> <D-R> + \|nunmap <buffer> [[ + \|nunmap <buffer> ]] + \|xunmap <buffer> [[ + \|xunmap <buffer> ]] + \|ounmap <buffer> [[ + \|ounmap <buffer> ]] + \|set matchpairs-=<:> + \" + +" }}}1 + +" Code formatting on save +if get(g:, "rustfmt_autosave", 0) + autocmd BufWritePre *.rs silent! call rustfmt#Format() +endif + +augroup END + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set noet sw=8 ts=8: diff --git a/runtime/ftplugin/sbt.vim b/runtime/ftplugin/sbt.vim new file mode 100644 index 0000000000..309d30e503 --- /dev/null +++ b/runtime/ftplugin/sbt.vim @@ -0,0 +1,15 @@ +" Vim filetype plugin file +" Language: sbt +" Maintainer: Steven Dobay <stevendobay at protonmail.com> +" License: Same as Vim +" Last Change: 2017.04.30 +" ---------------------------------------------------------------------------- + +if exists('b:did_ftplugin') || &cp + finish +endif + +let b:did_ftplugin = 1 + +runtime! ftplugin/scala.vim + diff --git a/runtime/ftplugin/verilog.vim b/runtime/ftplugin/verilog.vim index 6594f2ea90..cbf30a3185 100644 --- a/runtime/ftplugin/verilog.vim +++ b/runtime/ftplugin/verilog.vim @@ -1,8 +1,12 @@ " Vim filetype plugin file " Language: Verilog HDL -" Maintainer: Chih-Tsun Huang <cthuang@larc.ee.nthu.edu.tw> -" Last Change: Wed Sep 3 15:24:49 CST 2008 -" URL: http://larc.ee.nthu.edu.tw/~cthuang/vim/ftplugin/verilog.vim +" Maintainer: Chih-Tsun Huang <cthuang@cs.nthu.edu.tw> +" Last Change: 2017 Aug 25 by Chih-Tsun Huang +" URL: http://www.cs.nthu.edu.tw/~cthuang/vim/ftplugin/verilog.vim +" +" Credits: +" Suggestions for improvement, bug reports by +" Shao <shaominghai2005@163.com> " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -45,11 +49,16 @@ if exists("loaded_matchit") \ '\<begin\>:\<end\>,' . \ '\<case\>\|\<casex\>\|\<casez\>:\<endcase\>,' . \ '\<module\>:\<endmodule\>,' . - \ '\<if\>:\<else\>,' . + \ '\<if\>:`\@<!\<else\>,' . \ '\<function\>:\<endfunction\>,' . - \ '`ifdef\>:`else\>:`endif\>,' . + \ '`ifn\?def\>:`elsif\>:`else\>:`endif\>,' . \ '\<task\>:\<endtask\>,' . - \ '\<specify\>:\<endspecify\>' + \ '\<specify\>:\<endspecify\>,' . + \ '\<config\>:\<endconfig\>,' . + \ '\<generate\>:\<endgenerate\>,' . + \ '\<fork\>:\<join\>,' . + \ '\<primitive\>:\<endprimitive\>,' . + \ '\<table\>:\<endtable\>' endif " Reset 'cpoptions' back to the user's setting diff --git a/runtime/ftplugin/zsh.vim b/runtime/ftplugin/zsh.vim index 6cbc380dc3..c03a9466a1 100644 --- a/runtime/ftplugin/zsh.vim +++ b/runtime/ftplugin/zsh.vim @@ -1,10 +1,10 @@ " Vim filetype plugin file -" Language: Zsh shell script -" Maintainer: Christian Brabandt <cb@256bit.org> -" Previous Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2015-05-29 -" License: Vim (see :h license) -" Repository: https://github.com/chrisbra/vim-zsh +" Language: Zsh shell script +" Maintainer: Christian Brabandt <cb@256bit.org> +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2015-05-29 +" License: Vim (see :h license) +" Repository: https://github.com/chrisbra/vim-zsh if exists("b:did_ftplugin") finish |