From cc63193ce82c1e7b9ee2ad7d0ddd14e8394211ef Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Mon, 1 Mar 2021 13:44:50 +0100 Subject: Update --- ftplugin/ada.vim | 69 ++++++++++++++++++++------------------- ftplugin/basic.vim | 31 ++++++++++++++++++ ftplugin/bzl.vim | 4 ++- ftplugin/embeddedpuppet.vim | 79 --------------------------------------------- ftplugin/epuppet.vim | 79 +++++++++++++++++++++++++++++++++++++++++++++ ftplugin/framescript.vim | 6 ++-- ftplugin/freebasic.vim | 17 ++++++++++ ftplugin/hamster.vim | 7 ++-- ftplugin/lisp.vim | 4 +-- ftplugin/octave.vim | 5 +++ ftplugin/rust.vim | 2 +- ftplugin/sxhkdrc.vim | 10 ++++++ ftplugin/tidy.vim | 36 +++++++++++++++++++++ ftplugin/vlang.vim | 31 ++++++++++++++++++ ftplugin/zig.vim | 8 +++-- 15 files changed, 263 insertions(+), 125 deletions(-) create mode 100644 ftplugin/basic.vim delete mode 100644 ftplugin/embeddedpuppet.vim create mode 100644 ftplugin/epuppet.vim create mode 100644 ftplugin/freebasic.vim create mode 100644 ftplugin/octave.vim create mode 100644 ftplugin/tidy.vim (limited to 'ftplugin') diff --git a/ftplugin/ada.vim b/ftplugin/ada.vim index d7b34be0..bddd43b6 100644 --- a/ftplugin/ada.vim +++ b/ftplugin/ada.vim @@ -163,40 +163,41 @@ if exists("g:ada_abbrev") endif " Section: Commands, Mapping, Menus {{{1 -" -call ada#Map_Popup ( - \ 'Tag.List', - \ 'l', - \ 'call ada#List_Tag ()') -call ada#Map_Popup ( - \'Tag.Jump', - \'j', - \'call ada#Jump_Tag ()') -call ada#Map_Menu ( - \'Tag.Create File', - \':AdaTagFile', - \'call ada#Create_Tags (''file'')') -call ada#Map_Menu ( - \'Tag.Create Dir', - \':AdaTagDir', - \'call ada#Create_Tags (''dir'')') - -call ada#Map_Menu ( - \'Highlight.Toggle Space Errors', - \ ':AdaSpaces', - \'call ada#Switch_Syntax_Option (''space_errors'')') -call ada#Map_Menu ( - \'Highlight.Toggle Lines Errors', - \ ':AdaLines', - \'call ada#Switch_Syntax_Option (''line_errors'')') -call ada#Map_Menu ( - \'Highlight.Toggle Rainbow Color', - \ ':AdaRainbow', - \'call ada#Switch_Syntax_Option (''rainbow_color'')') -call ada#Map_Menu ( - \'Highlight.Toggle Standard Types', - \ ':AdaTypes', - \'call ada#Switch_Syntax_Option (''standard_types'')') +if !exists(':AdaTagFile') + call ada#Map_Popup ( + \ 'Tag.List', + \ 'l', + \ 'call ada#List_Tag ()') + call ada#Map_Popup ( + \'Tag.Jump', + \'j', + \'call ada#Jump_Tag ()') + call ada#Map_Menu ( + \'Tag.Create File', + \':AdaTagFile', + \'call ada#Create_Tags (''file'')') + call ada#Map_Menu ( + \'Tag.Create Dir', + \':AdaTagDir', + \'call ada#Create_Tags (''dir'')') + + call ada#Map_Menu ( + \'Highlight.Toggle Space Errors', + \ ':AdaSpaces', + \'call ada#Switch_Syntax_Option (''space_errors'')') + call ada#Map_Menu ( + \'Highlight.Toggle Lines Errors', + \ ':AdaLines', + \'call ada#Switch_Syntax_Option (''line_errors'')') + call ada#Map_Menu ( + \'Highlight.Toggle Rainbow Color', + \ ':AdaRainbow', + \'call ada#Switch_Syntax_Option (''rainbow_color'')') + call ada#Map_Menu ( + \'Highlight.Toggle Standard Types', + \ ':AdaTypes', + \'call ada#Switch_Syntax_Option (''standard_types'')') +endif " 1}}} " Reset cpoptions diff --git a/ftplugin/basic.vim b/ftplugin/basic.vim new file mode 100644 index 00000000..016253f6 --- /dev/null +++ b/ftplugin/basic.vim @@ -0,0 +1,31 @@ +if polyglot#init#is_disabled(expand(':p'), 'basic', 'ftplugin/basic.vim') + finish +endif + +" Vim filetype plugin file +" Language: BASIC +" Maintainer: Doug Kearns +" Last Change: 2015 Jan 10 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:cpo_save = &cpo +set cpo&vim + +setlocal comments=:REM,:' +setlocal commentstring='\ %s +setlocal formatoptions-=t formatoptions+=croql + +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter = "BASIC Source Files (*.bas)\t*.bas\n" . + \ "All Files (*.*)\t*.*\n" +endif + +let b:undo_ftplugin = "setl fo< com< cms< sua<" . + \ " | unlet! b:browsefilter" + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/ftplugin/bzl.vim b/ftplugin/bzl.vim index b1ece99b..c6add72a 100644 --- a/ftplugin/bzl.vim +++ b/ftplugin/bzl.vim @@ -5,7 +5,7 @@ endif " Vim filetype plugin file " Language: Bazel (http://bazel.io) " Maintainer: David Barnett (https://github.com/google/vim-ft-bzl) -" Last Change: 2015 Aug 11 +" Last Change: 2021 Jan 19 "" " @section Introduction, intro @@ -55,6 +55,8 @@ if get(g:, 'ft_bzl_fold', 0) endif if exists('*BzlFoldText') + let &cpo = s:save_cpo + unlet s:save_cpo finish endif diff --git a/ftplugin/embeddedpuppet.vim b/ftplugin/embeddedpuppet.vim deleted file mode 100644 index 7a2621fb..00000000 --- a/ftplugin/embeddedpuppet.vim +++ /dev/null @@ -1,79 +0,0 @@ -if polyglot#init#is_disabled(expand(':p'), 'puppet', 'ftplugin/embeddedpuppet.vim') - finish -endif - -" Vim filetype plugin -" Language: embedded puppet -" Maintainer: Gabriel Filion -" URL: https://github.com/rodjek/vim-puppet -" Last Change: 2019-09-01 - -" Only do this when not done yet for this buffer -if exists("b:did_ftplugin") - finish -endif - -let s:save_cpo = &cpo -set cpo-=C - -" Define some defaults in case the included ftplugins don't set them. -let s:undo_ftplugin = "" -let s:browsefilter = "All Files (*.*)\t*.*\n" -let s:match_words = "" - -runtime! ftplugin/sh.vim -unlet! b:did_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 -if exists("b:browsefilter") - let s:browsefilter = b:browsefilter - unlet b:browsefilter -endif -if exists("b:match_words") - let s:match_words = b:match_words - unlet b:match_words -endif - -let s:include = &l:include -let s:path = &l:path -let s:suffixesadd = &l:suffixesadd - -runtime! ftplugin/puppet.vim -let b:did_ftplugin = 1 - -" 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 -if exists ("b:browsefilter") - let s:browsefilter = substitute(b:browsefilter,'\cAll Files (\*\.\*)\t\*\.\*\n','','') . s:browsefilter -endif -if exists("b:match_words") - let s:match_words = b:match_words . ',' . s:match_words -endif - -if len(s:include) - let &l:include = s:include -endif -let &l:path = s:path . (s:path =~# ',$\|^$' ? '' : ',') . &l:path -let &l:suffixesadd = s:suffixesadd . (s:suffixesadd =~# ',$\|^$' ? '' : ',') . &l:suffixesadd -unlet s:include s:path s:suffixesadd - -" Load the combined list of match_words for matchit.vim -if exists("loaded_matchit") - let b:match_words = s:match_words -endif - -" TODO: comments= -setlocal commentstring=<%#%s%> - -let b:undo_ftplugin = "setl cms< " - \ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin - -let &cpo = s:save_cpo -unlet s:save_cpo - diff --git a/ftplugin/epuppet.vim b/ftplugin/epuppet.vim new file mode 100644 index 00000000..482d2af1 --- /dev/null +++ b/ftplugin/epuppet.vim @@ -0,0 +1,79 @@ +if polyglot#init#is_disabled(expand(':p'), 'puppet', 'ftplugin/epuppet.vim') + finish +endif + +" Vim filetype plugin +" Language: embedded puppet +" Maintainer: Gabriel Filion +" URL: https://github.com/rodjek/vim-puppet +" Last Change: 2019-09-01 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +let s:save_cpo = &cpo +set cpo-=C + +" Define some defaults in case the included ftplugins don't set them. +let s:undo_ftplugin = "" +let s:browsefilter = "All Files (*.*)\t*.*\n" +let s:match_words = "" + +runtime! ftplugin/sh.vim +unlet! b:did_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 +if exists("b:browsefilter") + let s:browsefilter = b:browsefilter + unlet b:browsefilter +endif +if exists("b:match_words") + let s:match_words = b:match_words + unlet b:match_words +endif + +let s:include = &l:include +let s:path = &l:path +let s:suffixesadd = &l:suffixesadd + +runtime! ftplugin/puppet.vim +let b:did_ftplugin = 1 + +" 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 +if exists ("b:browsefilter") + let s:browsefilter = substitute(b:browsefilter,'\cAll Files (\*\.\*)\t\*\.\*\n','','') . s:browsefilter +endif +if exists("b:match_words") + let s:match_words = b:match_words . ',' . s:match_words +endif + +if len(s:include) + let &l:include = s:include +endif +let &l:path = s:path . (s:path =~# ',$\|^$' ? '' : ',') . &l:path +let &l:suffixesadd = s:suffixesadd . (s:suffixesadd =~# ',$\|^$' ? '' : ',') . &l:suffixesadd +unlet s:include s:path s:suffixesadd + +" Load the combined list of match_words for matchit.vim +if exists("loaded_matchit") + let b:match_words = s:match_words +endif + +" TODO: comments= +setlocal commentstring=<%#%s%> + +let b:undo_ftplugin = "setl cms< " + \ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin + +let &cpo = s:save_cpo +unlet s:save_cpo + diff --git a/ftplugin/framescript.vim b/ftplugin/framescript.vim index 9ec58b5f..ba858408 100644 --- a/ftplugin/framescript.vim +++ b/ftplugin/framescript.vim @@ -7,14 +7,14 @@ endif " Previous Maintainer: Nikolai Weibull " Latest Revision: 2008-07-19 -let s:cpo_save = &cpo -set cpo&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< fo< inc< | unlet! b:matchwords" setlocal comments=s1:/*,mb:*,ex:*/,:// commentstring=/*\ %s\ */ diff --git a/ftplugin/freebasic.vim b/ftplugin/freebasic.vim new file mode 100644 index 00000000..d2212481 --- /dev/null +++ b/ftplugin/freebasic.vim @@ -0,0 +1,17 @@ +if polyglot#init#is_disabled(expand(':p'), 'freebasic', 'ftplugin/freebasic.vim') + finish +endif + +" Vim filetype plugin file +" Language: FreeBasic +" Maintainer: Doug Kearns +" Last Change: 2015 Jan 10 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +runtime! ftplugin/basic.vim + +" vim: ts=8 diff --git a/ftplugin/hamster.vim b/ftplugin/hamster.vim index c72a8657..2eca00f8 100644 --- a/ftplugin/hamster.vim +++ b/ftplugin/hamster.vim @@ -6,7 +6,7 @@ endif " Language: Hamster Script " Version: 2.0.6.0 " Maintainer: David Fishburn -" Last Change: 2017 Mar 18 +" Last Change: 2021 Jan 19 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -61,6 +61,9 @@ if exists("loaded_matchit") endif setlocal ignorecase + let &cpo = s:cpo_save unlet s:cpo_save -setlocal cpo+=M " makes \%( match \) + +" Disabled, 'cpo' is a global option. +" setlocal cpo+=M " makes \%( match \) diff --git a/ftplugin/lisp.vim b/ftplugin/lisp.vim index 365a26b8..cc86c720 100644 --- a/ftplugin/lisp.vim +++ b/ftplugin/lisp.vim @@ -18,13 +18,11 @@ endif " Don't load another plugin for this buffer let b:did_ftplugin = 1 -setl comments=:; +setl comments=:;;;;,:;;;,:;;,:;,sr:#\|,mb:\|,ex:\|# setl define=^\\s*(def\\k* setl formatoptions-=t setl iskeyword+=+,-,*,/,%,<,=,>,:,$,?,!,@-@,94 setl lisp setl commentstring=;%s -setl comments^=:;;;,:;;,sr:#\|,mb:\|,ex:\|# - let b:undo_ftplugin = "setlocal comments< define< formatoptions< iskeyword< lisp< commentstring<" diff --git a/ftplugin/octave.vim b/ftplugin/octave.vim new file mode 100644 index 00000000..c9408150 --- /dev/null +++ b/ftplugin/octave.vim @@ -0,0 +1,5 @@ +if polyglot#init#is_disabled(expand(':p'), 'octave', 'ftplugin/octave.vim') + finish +endif + +setlocal commentstring=%\ %s diff --git a/ftplugin/rust.vim b/ftplugin/rust.vim index a131a1d1..c13edfbc 100644 --- a/ftplugin/rust.vim +++ b/ftplugin/rust.vim @@ -51,7 +51,7 @@ setlocal smartindent nocindent if get(g:, 'rust_recommended_style', 1) let b:rust_set_style = 1 - setlocal tabstop=8 shiftwidth=4 softtabstop=4 expandtab + setlocal shiftwidth=4 softtabstop=4 expandtab setlocal textwidth=99 endif diff --git a/ftplugin/sxhkdrc.vim b/ftplugin/sxhkdrc.vim index b58baa1f..8b5be981 100644 --- a/ftplugin/sxhkdrc.vim +++ b/ftplugin/sxhkdrc.vim @@ -2,4 +2,14 @@ if polyglot#init#is_disabled(expand(':p'), 'sxhkd', 'ftplugin/sxhkdrc.vim finish endif +if exists("b:did_ftplugin") + finish +endif + setlocal cms=#%s + +if exists('b:undo_ftplugin') + let b:undo_ftplugin .= "|setlocal commentstring<" +else + let b:undo_ftplugin = "setlocal commentstring<" +endif diff --git a/ftplugin/tidy.vim b/ftplugin/tidy.vim new file mode 100644 index 00000000..8f368fa9 --- /dev/null +++ b/ftplugin/tidy.vim @@ -0,0 +1,36 @@ +if polyglot#init#is_disabled(expand(':p'), 'tidy', 'ftplugin/tidy.vim') + finish +endif + +" Vim filetype plugin file +" Language: HMTL Tidy Configuration +" Maintainer: Doug Kearns +" Last Change: 2020 Sep 4 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:cpo_save = &cpo +set cpo&vim + +setlocal comments=:#,:// +setlocal commentstring=#\ %s +setlocal formatoptions-=t formatoptions+=croql + +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter = "HTML Tidy Files (tidyrc, .tidyrc, tidy.conf)\ttidyrc;.tidyrc;tidy.conf\n" . + \ "HTML Files (*.html, *.htm)\t*.html;*.htm\n" . + \ "XHTML Files (*.xhtml, *.xhtm)\t*.xhtml;*.xhtm\n" . + \ "XML Files (*.xml)\t*.xml\n" . + \ "All Files (*.*)\t*.*\n" +endif + +let b:undo_ftplugin = "setl fo< com< cms<" . + \ " | unlet! b:browsefilter" + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: nowrap sw=2 sts=2 ts=8 diff --git a/ftplugin/vlang.vim b/ftplugin/vlang.vim index cda16cba..fbc0a711 100644 --- a/ftplugin/vlang.vim +++ b/ftplugin/vlang.vim @@ -2,5 +2,36 @@ if polyglot#init#is_disabled(expand(':p'), 'v', 'ftplugin/vlang.vim') finish endif +if exists("b:did_ftplugin") + finish +endif + setlocal commentstring=//\ %s setlocal makeprg=v\ % + +if exists('b:undo_ftplugin') + let b:undo_ftplugin .= "|setlocal commentstring< makeprg<" +else + let b:undo_ftplugin = "setlocal commentstring< makeprg<" +endif + +function! _VFormatFile() + if exists('g:v_autofmt_bufwritepre') && g:v_autofmt_bufwritepre || exists('b:v_autofmt_bufwritepre') && b:v_autofmt_bufwritepre + let substitution = system("v fmt -", join(getline(1, line('$')), "\n")) + if v:shell_error != 0 + echoerr "While formatting the buffer via vfmt, the following error occurred:" + echoerr printf("ERROR(%d): %s", v:shell_error, substitution) + else + let [_, lnum, colnum, _] = getpos('.') + %delete + call append(0, split(substitution, "\n")) + call cursor(lnum, colnum) + endif + endif +endfunction + +if has('autocmd') + augroup v_fmt + autocmd BufWritePre *.v call _VFormatFile() + augroup END +endif diff --git a/ftplugin/zig.vim b/ftplugin/zig.vim index 3b88372c..cb2f3e84 100644 --- a/ftplugin/zig.vim +++ b/ftplugin/zig.vim @@ -12,6 +12,11 @@ let b:did_ftplugin = 1 let s:cpo_orig = &cpo set cpo&vim +compiler zig_build + +" Match Zig builtin fns +setlocal iskeyword+=@-@ + " Recomended code style, no tabs and 4-space indentation setlocal expandtab setlocal tabstop=8 @@ -21,7 +26,6 @@ setlocal shiftwidth=4 setlocal formatoptions-=t formatoptions+=croql setlocal suffixesadd=.zig,.zir -setlocal makeprg=zig\ build if has('comments') setlocal comments=:///,://!,://,:\\\\ @@ -44,7 +48,7 @@ if exists("*json_decode") && executable('zig') endif let b:undo_ftplugin = - \ 'setl et< ts< sts< sw< fo< sua< mp< com< cms< inex< inc< pa<' + \ 'setl isk< et< ts< sts< sw< fo< sua< mp< com< cms< inex< inc< pa<' let &cpo = s:cpo_orig unlet s:cpo_orig -- cgit v1.2.3