From 87a26c5bf169bafbee837e2323f24cfb07e35250 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Tue, 21 Dec 2021 14:41:23 +0100 Subject: Update --- ftplugin/ocaml.vim | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) (limited to 'ftplugin/ocaml.vim') 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") -- cgit v1.2.3