From 87a26c5bf169bafbee837e2323f24cfb07e35250 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Tue, 21 Dec 2021 14:41:23 +0100 Subject: Update --- ftplugin/8th.vim | 10 +++--- ftplugin/aap.vim | 13 +++++-- ftplugin/clojure.vim | 4 +-- ftplugin/diff.vim | 11 ++++-- ftplugin/dosini.vim | 2 +- ftplugin/dune.vim | 4 ++- ftplugin/erlang.vim | 22 ++++++++++++ ftplugin/git.vim | 45 ------------------------ ftplugin/gitcommit.vim | 46 ++++++++++--------------- ftplugin/gitrebase.vim | 13 +++---- ftplugin/indent.vim | 7 ++-- ftplugin/kotlin.vim | 21 ++++++++++++ ftplugin/mail.vim | 10 +++++- ftplugin/meson.vim | 23 +++++++++++-- ftplugin/nginx.vim | 4 +++ ftplugin/nsis.vim | 4 +-- ftplugin/oasis.vim | 6 ++++ ftplugin/ocaml.vim | 38 +++++++++++++------- ftplugin/ocamlbuild_tags.vim | 6 ++++ ftplugin/omake.vim | 2 ++ ftplugin/ruby.vim | 40 ++++++++++++--------- ftplugin/sexplib.vim | 2 ++ ftplugin/systemverilog.vim | 2 +- ftplugin/toml.vim | 14 ++++---- ftplugin/unison.vim | 11 ++++++ ftplugin/vb.vim | 82 +++++++++++++++++++++++++++++--------------- ftplugin/zig.vim | 8 +++-- ftplugin/zimbu.vim | 61 +++++++++++++++++++++++++++++--- 28 files changed, 339 insertions(+), 172 deletions(-) delete mode 100644 ftplugin/git.vim create mode 100644 ftplugin/unison.vim (limited to 'ftplugin') diff --git a/ftplugin/8th.vim b/ftplugin/8th.vim index e9a63dc1..c7dce2b3 100644 --- a/ftplugin/8th.vim +++ b/ftplugin/8th.vim @@ -5,9 +5,10 @@ endif " Vim ftplugin file " Language: 8th " Version: any -" Last Change: 2015/11/08 +" Last Change: 2021 Sep 20 +" Last Change: 2021/09/20 " Maintainer: Ron Aaron -" URL: https://8th-dev.com/ +" URL: https://8th-dev.com/ " Filetypes: *.8th " NOTE: 8th allows any non-whitespace in a name, so you need to do: " setlocal iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255 @@ -18,12 +19,13 @@ if exists("b:did_8thplugin") finish endif -" Don't load another plugin for this buffer +" Don't load another 8th plugin for this buffer let b:did_8thplugin = 1 setlocal ts=2 sts=2 sw=2 et -setlocal com=s1:/*,mb:*,ex:*/,:\|,:\\ +setlocal com=s1:/*,mb:*,ex:*/,b:--,be:\\ setlocal fo=tcrqol setlocal matchpairs+=\::; setlocal iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255 setlocal suffixesadd=.8th +let b:undo_ftplugin = "setlocal ts< sts< sw< et< com< fo< mps< isk< sua<" diff --git a/ftplugin/aap.vim b/ftplugin/aap.vim index 3a8f1cbb..40f4597b 100644 --- a/ftplugin/aap.vim +++ b/ftplugin/aap.vim @@ -5,7 +5,7 @@ endif " Vim filetype plugin file " Language: Aap recipe " Maintainer: Bram Moolenaar -" Last Change: 2013 Apr 05 +" Last Change: 2021 Nov 14 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -15,8 +15,9 @@ endif " Don't load another plugin for this buffer let b:did_ftplugin = 1 -" Reset 'formatoptions', 'comments' and 'expandtab' to undo this plugin. -let b:undo_ftplugin = "setl fo< com< et<" +" Reset 'formatoptions', 'comments', 'commentstring' and 'expandtab' to undo +" this plugin. +let b:undo_ftplugin = "setl fo< com< cms< et<" " Set 'formatoptions' to break comment lines but not other lines, " and insert the comment leader when hitting or using "o". @@ -24,6 +25,12 @@ setlocal fo-=t fo+=croql " Set 'comments' to format dashed lists in comments. setlocal comments=s:#\ -,m:#\ \ ,e:#,n:#,fb:- +setlocal commentstring=#\ %s " Expand tabs to spaces to avoid trouble. setlocal expandtab + +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter = "Aap Recipe Files (*.aap)\t*.aap\nAll Files (*.*)\t*.*\n" + let b:undo_ftplugin .= " | unlet! b:browsefilter" +endif diff --git a/ftplugin/clojure.vim b/ftplugin/clojure.vim index 2c2882e3..7fe81f9d 100644 --- a/ftplugin/clojure.vim +++ b/ftplugin/clojure.vim @@ -68,8 +68,8 @@ if exists('loaded_matchit') let b:undo_ftplugin .= ' | unlet! b:match_words b:match_skip' endif -" Win32 can filter files in the browse dialog -if has("gui_win32") && !exists("b:browsefilter") +" Filter files in the browse dialog +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter = "Clojure Source Files (*.clj)\t*.clj\n" . \ "ClojureScript Source Files (*.cljs)\t*.cljs\n" . \ "Java Source Files (*.java)\t*.java\n" . diff --git a/ftplugin/diff.vim b/ftplugin/diff.vim index c7d8cefc..feaefc57 100644 --- a/ftplugin/diff.vim +++ b/ftplugin/diff.vim @@ -5,7 +5,7 @@ endif " Vim filetype plugin file " Language: Diff " Maintainer: Bram Moolenaar -" Last Change: 2020 Jul 18 +" Last Change: 2021 Nov 14 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -13,10 +13,15 @@ if exists("b:did_ftplugin") endif let b:did_ftplugin = 1 -let b:undo_ftplugin = "setl modeline<" +let b:undo_ftplugin = "setl modeline< commentstring<" " Don't use modelines in a diff, they apply to the diffed file setlocal nomodeline " If there are comments they start with # -let &commentstring = "# %s" +let &l:commentstring = "# %s" + +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter = "Diff Files (*.diff)\t*.diff\nPatch Files (*.patch)\t*.h\nAll Files (*.*)\t*.*\n" + let b:undo_ftplugin .= " | unlet! b:browsefilter" +endif diff --git a/ftplugin/dosini.vim b/ftplugin/dosini.vim index fc739a01..5ee9a5e0 100644 --- a/ftplugin/dosini.vim +++ b/ftplugin/dosini.vim @@ -3,7 +3,7 @@ if polyglot#init#is_disabled(expand(':p'), 'dosini', 'ftplugin/dosini.vim endif " Vim filetype plugin file -" Language: Configuration File (ini file) for MSDOS/MS Windows +" Language: Configuration File (ini file) for MS-DOS/MS Windows " Previous Maintainer: Nikolai Weibull " Latest Revision: 2008-07-09 diff --git a/ftplugin/dune.vim b/ftplugin/dune.vim index 4f78d7c6..c89e40d2 100644 --- a/ftplugin/dune.vim +++ b/ftplugin/dune.vim @@ -15,10 +15,12 @@ if exists("b:did_ftplugin") endif let b:did_ftplugin=1 -set lisp +setl lisp " Comment string setl commentstring=;\ %s setl comments=n:; setl iskeyword+=#,?,.,/ + +let b:undo_ftplugin = "setlocal lisp< cms< com< isk<" diff --git a/ftplugin/erlang.vim b/ftplugin/erlang.vim index 798f1ded..85f57209 100644 --- a/ftplugin/erlang.vim +++ b/ftplugin/erlang.vim @@ -34,6 +34,28 @@ setlocal commentstring=%%s setlocal formatoptions+=ro +if get(g:, 'erlang_extend_path', 1) + " typical erlang.mk paths + let &l:path = join([ + \ 'deps/*/include', + \ 'deps/*/src', + \ 'deps/*/test', + \ 'deps/*/apps/*/include', + \ 'deps/*/apps/*/src', + \ &g:path], ',') + " typical rebar3 paths + let &l:path = join([ + \ 'apps/*/include', + \ 'apps/*/src', + \ '_build/default/lib/*/src', + \ '_build/default/*/include', + \ &l:path], ',') + " typical erlang paths + let &l:path = join(['include', 'src', 'test', &l:path], ',') + + set wildignore+=*/.erlang.mk/*,*.beam +endif + setlocal suffixesadd=.erl,.hrl let &l:include = '^\s*-\%(include\|include_lib\)\s*("\zs\f*\ze")' diff --git a/ftplugin/git.vim b/ftplugin/git.vim deleted file mode 100644 index 9a5ac16c..00000000 --- a/ftplugin/git.vim +++ /dev/null @@ -1,45 +0,0 @@ -if polyglot#init#is_disabled(expand(':p'), 'git', 'ftplugin/git.vim') - finish -endif - -" Vim filetype plugin -" Language: generic git output -" Maintainer: Tim Pope -" Last Change: 2019 Dec 05 - -" Only do this when not done yet for this buffer -if (exists("b:did_ftplugin")) - finish -endif -let b:did_ftplugin = 1 - -if !exists('b:git_dir') - 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[\/][^\/]\+\>') - elseif expand('%:p') =~# '\.git\>' - let b:git_dir = matchstr(expand('%:p'),'.*\.git\>') - elseif $GIT_DIR != '' - let b:git_dir = $GIT_DIR - endif - if (has('win32') || has('win64')) && exists('b:git_dir') - let b:git_dir = substitute(b:git_dir,'\\','/','g') - endif -endif - -if exists('*shellescape') && exists('b:git_dir') && b:git_dir != '' - if b:git_dir =~# '/\.git$' " Not a bare repository - let &l:path = escape(fnamemodify(b:git_dir,':h'),'\, ').','.&l:path - endif - let &l:path = escape(b:git_dir,'\, ').','.&l:path - let &l:keywordprg = 'git --git-dir='.shellescape(b:git_dir).' show' -else - setlocal keywordprg=git\ show -endif -if has('gui_running') && &guioptions !~# '!' - let &l:keywordprg = substitute(&l:keywordprg,'^git\>','git --no-pager','') -endif - -setlocal includeexpr=substitute(v:fname,'^[^/]\\+/','','') -let b:undo_ftplugin = "setl keywordprg< path< includeexpr<" diff --git a/ftplugin/gitcommit.vim b/ftplugin/gitcommit.vim index caa96db8..56e72973 100644 --- a/ftplugin/gitcommit.vim +++ b/ftplugin/gitcommit.vim @@ -12,60 +12,50 @@ if (exists("b:did_ftplugin")) finish endif -runtime! ftplugin/git.vim let b:did_ftplugin = 1 -setlocal comments=:# commentstring=#\ %s -setlocal include=^\+\+\+ setlocal nomodeline tabstop=8 formatoptions+=tl textwidth=72 setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=q formatoptions+=n setlocal formatlistpat+=\\\|^\\s*[-*+]\\s\\+ +setlocal include=^+++ +setlocal includeexpr=substitute(v:fname,'^[bi]/','','') -let b:undo_ftplugin = 'setl modeline< tabstop< formatoptions< tw< com< cms< formatlistpat<' +let b:undo_ftplugin = 'setl modeline< tabstop< formatoptions< tw< com< cms< formatlistpat< inc< inex<' -if exists("g:no_gitcommit_commands") || v:version < 700 - finish -endif +let s:l = search('\C\m^[#;@!$%^&|:] -\{24,\} >8 -\{24,\}$', 'cnW', '', 100) +let &l:comments = ':' . (matchstr(getline(s:l ? s:l : '$'), '^[#;@!$%^&|:]\S\@!') . '#')[0] +let &l:commentstring = &l:comments[1] . ' %s' +unlet s:l -if !exists("b:git_dir") - let b:git_dir = expand("%:p:h") +if exists("g:no_gitcommit_commands") + finish endif -command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(0,b:git_dir,) +command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(0, ) let b:undo_ftplugin = b:undo_ftplugin . "|delc DiffGitCached" -function! s:diffcomplete(A,L,P) +function! s:diffcomplete(A, L, P) abort let args = "" if a:P <= match(a:L." -- "," -- ")+3 let args = args . "-p\n--stat\n--shortstat\n--summary\n--patch-with-stat\n--no-renames\n-B\n-M\n-C\n" end - if exists("b:git_dir") && a:A !~ '^-' - let tree = fnamemodify(b:git_dir,':h') - if strpart(getcwd(),0,strlen(tree)) == tree - let args = args."\n".system("git diff --cached --name-only") - endif + if a:A !~ '^-' && !empty(getftype('.git')) + let args = args."\n".system("git diff --cached --name-only") endif return args endfunction -function! s:gitdiffcached(bang,gitdir,...) - let tree = fnamemodify(a:gitdir,':h') +function! s:gitdiffcached(bang, ...) abort let name = tempname() - let git = "git" - if strpart(getcwd(),0,strlen(tree)) != tree - let git .= " --git-dir=".(exists("*shellescape") ? shellescape(a:gitdir) : '"'.a:gitdir.'"') - endif if a:0 - let extra = join(map(copy(a:000),exists("*shellescape") ? 'shellescape(v:val)' : "'\"'.v:val.'\"'")) + let extra = join(map(copy(a:000), 'shellescape(v:val)')) else let extra = "-p --stat=".&columns endif - call system(git." diff --cached --no-color --no-ext-diff ".extra." > ".(exists("*shellescape") ? shellescape(name) : name)) - exe "pedit ".(exists("*fnameescape") ? fnameescape(name) : name) + call system("git diff --cached --no-color --no-ext-diff ".extra." > ".shellescape(name)) + exe "pedit " . fnameescape(name) wincmd P - let b:git_dir = a:gitdir - command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(0,b:git_dir,) - nnoremap q :q + command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(0, ) setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git endfunction diff --git a/ftplugin/gitrebase.vim b/ftplugin/gitrebase.vim index 7163f916..285f76a4 100644 --- a/ftplugin/gitrebase.vim +++ b/ftplugin/gitrebase.vim @@ -12,15 +12,13 @@ if (exists("b:did_ftplugin")) finish endif -runtime! ftplugin/git.vim let b:did_ftplugin = 1 -setlocal comments=:# commentstring=#\ %s formatoptions-=t +let &l:comments = ':' . (matchstr(getline('$'), '^[#;@!$%^&|:]\S\@!') . '#')[0] +let &l:commentstring = &l:comments[1] . ' %s' +setlocal formatoptions-=t setlocal nomodeline -if !exists("b:undo_ftplugin") - let b:undo_ftplugin = "" -endif -let b:undo_ftplugin = b:undo_ftplugin."|setl com< cms< fo< ml<" +let b:undo_ftplugin = "setl com< cms< fo< ml<" function! s:choose(word) abort s/^\(\w\+\>\)\=\(\s*\)\ze\x\{4,40\}\>/\=(strlen(submatch(1)) == 1 ? a:word[0] : a:word) . substitute(submatch(2),'^$',' ','')/e @@ -45,8 +43,7 @@ if exists("g:no_plugin_maps") || exists("g:no_gitrebase_maps") finish endif -nnoremap K col('.') < 7 && expand('cword>') =~ '\X' && getline('.') =~ '^\w\+\s\+\x\+\>' ? 'wK' : 'K' nnoremap :=v:count1Cycle nnoremap :=v:count1Cycle! -let b:undo_ftplugin = b:undo_ftplugin . "|exe 'nunmap K'|exe 'nunmap '|exe 'nunmap '" +let b:undo_ftplugin = b:undo_ftplugin . "|exe 'nunmap '|exe 'nunmap '" diff --git a/ftplugin/indent.vim b/ftplugin/indent.vim index 89a779c4..094dcd9e 100644 --- a/ftplugin/indent.vim +++ b/ftplugin/indent.vim @@ -3,9 +3,10 @@ if polyglot#init#is_disabled(expand(':p'), 'indent', 'ftplugin/indent.vim endif " Vim filetype plugin file -" Language: indent(1) configuration file -" Previous Maintainer: Nikolai Weibull -" Latest Revision: 2008-07-09 +" Language: indent(1) configuration file +" Maintainer: Doug Kearns +" Previous Maintainer: Nikolai Weibull +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/ftplugin/kotlin.vim b/ftplugin/kotlin.vim index ca0b35fc..e6677fdf 100644 --- a/ftplugin/kotlin.vim +++ b/ftplugin/kotlin.vim @@ -2,8 +2,29 @@ if polyglot#init#is_disabled(expand(':p'), 'kotlin', 'ftplugin/kotlin.vim finish endif +" Vim filetype plugin file +" Language: Kotlin +" Maintainer: Alexander Udalov +" URL: https://github.com/udalov/kotlin-vim +" Last Change: 7 November 2021 + if exists('b:did_ftplugin') | finish | endif let b:did_ftplugin = 1 +let s:save_cpo = &cpo +set cpo&vim + setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// setlocal commentstring=//\ %s + +setlocal formatoptions-=t formatoptions+=croqnl +silent! setlocal formatoptions+=j + +setlocal includeexpr=substitute(v:fname,'\\.','/','g') +setlocal suffixesadd=.kt + +let b:undo_ftplugin = "setlocal comments< commentstring< ". + \ "formatoptions< includeexpr< suffixesadd<" + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/ftplugin/mail.vim b/ftplugin/mail.vim index 6e4e9a4f..e621acca 100644 --- a/ftplugin/mail.vim +++ b/ftplugin/mail.vim @@ -5,7 +5,7 @@ endif " Vim filetype plugin file " Language: Mail " Maintainer: Bram Moolenaar -" Last Change: 2012 Nov 20 +" Last Change: 2021 Oct 23 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -30,6 +30,14 @@ setlocal fo+=tcql " Add n:> to 'comments, in case it was removed elsewhere setlocal comments+=n:> +" .eml files are universally formatted with DOS line-endings, per RFC5322. +" If the file was not DOS the it will be marked as changed, which is probably +" a good thing. +if expand('%:e') ==? 'eml' + let b:undo_ftplugin .= " fileformat=" .. &fileformat + setlocal fileformat=dos +endif + " Add mappings, unless the user doesn't want this. if !exists("no_plugin_maps") && !exists("no_mail_maps") " Quote text by inserting "> " diff --git a/ftplugin/meson.vim b/ftplugin/meson.vim index 79ff47c6..a3608522 100644 --- a/ftplugin/meson.vim +++ b/ftplugin/meson.vim @@ -16,9 +16,28 @@ set cpo&vim setlocal commentstring=#\ %s setlocal comments=:# +setlocal formatoptions+=croql formatoptions-=t -setlocal shiftwidth=2 -setlocal softtabstop=2 +let b:undo_ftplugin = "setl com< cms< fo<" + +if get(g:, "meson_recommended_style", 1) + setlocal expandtab + setlocal shiftwidth=2 + setlocal softtabstop=2 + let b:undo_ftplugin .= " | setl et< sts< sw<" +endif + +if exists("loaded_matchit") && !exists("b:match_words") + let b:match_words = '\:\:\:\,' . + \ '\:\:\:\' + let b:undo_ftplugin .= " | unlet! b:match_words" +endif + +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter = "Meson Build Files (meson.build)\tmeson.build\n" . + \ "All Files (*.*)\t*.*\n" + let b:undo_ftplugin .= " | unlet! b:browsefilter" +endif let &cpo = s:keepcpo unlet s:keepcpo diff --git a/ftplugin/nginx.vim b/ftplugin/nginx.vim index 45442242..61b8a760 100644 --- a/ftplugin/nginx.vim +++ b/ftplugin/nginx.vim @@ -2,4 +2,8 @@ if polyglot#init#is_disabled(expand(':p'), 'nginx', 'ftplugin/nginx.vim') finish endif +setlocal comments=:# setlocal commentstring=#\ %s +setlocal formatoptions+=croql formatoptions-=t + +let b:undo_ftplugin = "setl fo< cms< com<" diff --git a/ftplugin/nsis.vim b/ftplugin/nsis.vim index ab54e5d3..2a387b4a 100644 --- a/ftplugin/nsis.vim +++ b/ftplugin/nsis.vim @@ -7,7 +7,7 @@ endif " Maintainer: Ken Takata " URL: https://github.com/k-takata/vim-nsis " Previous Maintainer: Nikolai Weibull -" Last Change: 2018-01-26 +" Last Change: 2021-10-18 if exists("b:did_ftplugin") finish @@ -19,7 +19,6 @@ set cpo&vim let b:did_ftplugin = 1 let b:undo_ftplugin = "setl com< cms< fo< def< inc<" - \ " | unlet! b:match_ignorecase b:match_words" setlocal comments=s1:/*,mb:*,ex:*/,b:#,:; commentstring=;\ %s setlocal formatoptions-=t formatoptions+=croql @@ -41,6 +40,7 @@ if exists("loaded_matchit") \ '\${MementoSection}:\${MementoSectionEnd},' . \ '!if\%(\%(macro\)\?n\?def\)\?\>:!else\>:!endif\>,' . \ '!macro\>:!macroend\>' + let b:undo_ftplugin .= " | unlet! b:match_ignorecase b:match_words" endif let &cpo = s:cpo_save diff --git a/ftplugin/oasis.vim b/ftplugin/oasis.vim index ad7dd1a5..7c5771db 100644 --- a/ftplugin/oasis.vim +++ b/ftplugin/oasis.vim @@ -2,6 +2,12 @@ if polyglot#init#is_disabled(expand(':p'), 'ocaml', 'ftplugin/oasis.vim') finish endif +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin=1 setlocal comments=:# setlocal commentstring=#\ %s + +let b:undo_ftplugin = "com< cms<" diff --git a/ftplugin/ocaml.vim b/ftplugin/ocaml.vim index 6ce2adcb..858e4fd4 100644 --- a/ftplugin/ocaml.vim +++ b/ftplugin/ocaml.vim @@ -46,6 +46,8 @@ setlocal comments=sr:(*\ ,mb:\ ,ex:*) setlocal comments^=sr:(**,mb:\ \ ,ex:*) setlocal commentstring=(*%s*) +let b:undo_ftplugin = "setlocal com< cms<" + " Add mappings, unless the user didn't want this. if !exists("no_plugin_maps") && !exists("no_ocaml_maps") " (un)commenting @@ -54,6 +56,11 @@ if !exists("no_plugin_maps") && !exists("no_ocaml_maps") xmap c BUncomOn nmap C LUncomOff xmap C BUncomOff + let b:undo_ftplugin .= + \ " | silent! execute 'nunmap c'" . + \ " | silent! execute 'xunmap c'" . + \ " | silent! execute 'nunmap C'" . + \ " | silent! execute 'xunmap C'" endif nnoremap LUncomOn gI(* *) @@ -66,17 +73,27 @@ if !exists("no_plugin_maps") && !exists("no_ocaml_maps") nmap t OCamlPrintType xmap t OCamlPrintType + + let b:undo_ftplugin .= + \ " | silent! execute 'nunmap s'" . + \ " | silent! execute 'nunmap S'" . + \ " | silent! execute 'nunmap t'" . + \ " | silent! execute 'xunmap t'" endif -" Let % jump between structure elements (due to Issac Trotts) -let b:mw = '\:\:\(\\|;;\)' -let b:mw = b:mw . ',\:\:\' -let b:mw = b:mw . ',\<\(for\|while\)\>:\:\' -let b:mw = b:mw . ',\<\(object\|sig\|struct\|begin\)\>:\' -let b:mw = b:mw . ',\<\(match\|try\)\>:\' -let b:match_words = b:mw +if exists("loaded_matchit") && !exists("b:match_words") + " Let % jump between structure elements (due to Issac Trotts) + let b:mw = '\:\:\(\\|;;\)' + let b:mw = b:mw . ',\:\:\' + let b:mw = b:mw . ',\<\(for\|while\)\>:\:\' + let b:mw = b:mw . ',\<\(object\|sig\|struct\|begin\)\>:\' + let b:mw = b:mw . ',\<\(match\|try\)\>:\' + let b:match_words = b:mw + + let b:match_ignorecase=0 -let b:match_ignorecase=0 + let b:undo_ftplugin .= " | unlet! b:match_ignorecase b:match_words" +endif function! s:OcpGrep(bang,args) abort let grepprg = &l:grepprg @@ -154,12 +171,9 @@ endif if exists("g:ocaml_folding") setlocal foldmethod=expr setlocal foldexpr=OMLetFoldLevel(v:lnum) + let b:undo_ftplugin .= " | setlocal fdm< fde<" endif -let b:undo_ftplugin = "setlocal efm< foldmethod< foldexpr<" - \ . "| unlet! b:mw b:match_words b:match_ignorecase" - - " - Only definitions below, executed once ------------------------------------- if exists("*OMLetFoldLevel") diff --git a/ftplugin/ocamlbuild_tags.vim b/ftplugin/ocamlbuild_tags.vim index 5e83406d..5eecc1ce 100644 --- a/ftplugin/ocamlbuild_tags.vim +++ b/ftplugin/ocamlbuild_tags.vim @@ -2,6 +2,12 @@ if polyglot#init#is_disabled(expand(':p'), 'ocaml', 'ftplugin/ocamlbuild_ finish endif +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin=1 setlocal comments=:# setlocal commentstring=#\ %s + +let b:undo_ftplugin = "com< cms<" diff --git a/ftplugin/omake.vim b/ftplugin/omake.vim index 59e11101..fe99ea15 100644 --- a/ftplugin/omake.vim +++ b/ftplugin/omake.vim @@ -26,3 +26,5 @@ setlocal expandtab " Including files. let &l:include = '^\s*include' + +let b:undo_ftplugin = "fo< com< cms< et< inc<" diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 1c6f828f..fcf346a0 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -90,8 +90,14 @@ endfunction function! s:build_path(path) abort let path = join(map(copy(a:path), 'v:val ==# "." ? "" : v:val'), ',') - if &g:path !~# '\v^%(\.,)=%(/%(usr|emx)/include,)=,$' - let path = substitute(&g:path,',,$',',','') . ',' . path + if &g:path =~# '\v^%(\.,)=%(/%(usr|emx)/include,)=,$' + let path = path . ',.,,' + elseif &g:path =~# ',\.,,$' + let path = &g:path[0:-4] . path . ',.,,' + elseif &g:path =~# ',,$' + let path = &g:path[0:-2] . path . ',,' + else + let path = substitute(&g:path, '[^,]\zs$', ',', '') . path endif return path endfunction @@ -167,6 +173,8 @@ let b:undo_ftplugin .= "| sil! cunmap | sil! cunmap