diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-07-04 17:22:06 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-07-04 17:22:06 +0200 |
commit | 790c18bfa5dfeca51749b752dddc41e60cb3fa54 (patch) | |
tree | 2a9e58a44299c06ebee566a43055754720dfc415 /runtime/ftplugin | |
parent | 6bf2c6264b5ebbe4981751840c5a8b69da08e744 (diff) |
Update runtime files
Diffstat (limited to 'runtime/ftplugin')
-rw-r--r-- | runtime/ftplugin/dune.vim | 20 | ||||
-rw-r--r-- | runtime/ftplugin/ocaml.vim | 52 |
2 files changed, 56 insertions, 16 deletions
diff --git a/runtime/ftplugin/dune.vim b/runtime/ftplugin/dune.vim new file mode 100644 index 0000000000..8b1f8b4125 --- /dev/null +++ b/runtime/ftplugin/dune.vim @@ -0,0 +1,20 @@ +" Language: Dune buildsystem +" Maintainer: Markus Mottl <markus.mottl@gmail.com> +" Anton Kochkov <anton.kochkov@gmail.com> +" URL: https://github.com/rgrinberg/vim-ocaml +" Last Change: +" 2018 Nov 3 - Added commentstring (Markus Mottl) +" 2017 Sep 6 - Initial version (Etienne Millon) + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin=1 + +set lisp + +" Comment string +setl commentstring=;\ %s +setl comments=:; + +setl iskeyword+=#,?,.,/ diff --git a/runtime/ftplugin/ocaml.vim b/runtime/ftplugin/ocaml.vim index ae41422497..e0d7efe997 100644 --- a/runtime/ftplugin/ocaml.vim +++ b/runtime/ftplugin/ocaml.vim @@ -5,12 +5,12 @@ " Pierre Vittet <pierre-vittet@pvittet.com> " Stefano Zacchiroli <zack@bononia.it> " Vincent Aravantinos <firstname.name@imag.fr> -" URL: http://www.ocaml.info/vim/ftplugin/ocaml.vim +" URL: https://github.com/rgrinberg/vim-ocaml " Last Change: +" 2013 Oct 27 - Added commentstring (MM) " 2013 Jul 26 - load default compiler settings (MM) " 2013 Jul 24 - removed superfluous efm-setting (MM) " 2013 Jul 22 - applied fixes supplied by Hirotaka Hamada (MM) -" 2013 Mar 15 - Improved error format (MM) if exists("b:did_ftplugin") finish @@ -37,6 +37,10 @@ endif let s:cposet=&cpoptions set cpo&vim +" Comment string +setlocal comments= +setlocal commentstring=(*%s*) + " Add mappings, unless the user didn't want this. if !exists("no_plugin_maps") && !exists("no_ocaml_maps") " (un)commenting @@ -60,16 +64,39 @@ if !exists("no_plugin_maps") && !exists("no_ocaml_maps") endif " Let % jump between structure elements (due to Issac Trotts) -let b:mw = '' -let b:mw = b:mw . ',\<let\>:\<and\>:\(\<in\>\|;;\)' +let b:mw = '\<let\>:\<and\>:\(\<in\>\|;;\)' let b:mw = b:mw . ',\<if\>:\<then\>:\<else\>' -let b:mw = b:mw . ',\<\(for\|while\)\>:\<do\>:\<done\>,' +let b:mw = b:mw . ',\<\(for\|while\)\>:\<do\>:\<done\>' let b:mw = b:mw . ',\<\(object\|sig\|struct\|begin\)\>:\<end\>' let b:mw = b:mw . ',\<\(match\|try\)\>:\<with\>' let b:match_words = b:mw let b:match_ignorecase=0 +function! s:OcpGrep(bang,args) abort + let grepprg = &l:grepprg + let grepformat = &l:grepformat + let shellpipe = &shellpipe + try + let &l:grepprg = "ocp-grep -c never" + setlocal grepformat=%f:%l:%m + if &shellpipe ==# '2>&1| tee' || &shellpipe ==# '|& tee' + let &shellpipe = "| tee" + endif + execute 'grep! '.a:args + if empty(a:bang) && !empty(getqflist()) + return 'cfirst' + else + return '' + endif + finally + let &l:grepprg = grepprg + let &l:grepformat = grepformat + let &shellpipe = shellpipe + endtry +endfunction +command! -bar -bang -complete=file -nargs=+ Ocpgrep exe s:OcpGrep(<q-bang>, <q-args>) + " switching between interfaces (.mli) and implementations (.ml) if !exists("g:did_ocaml_switch") let g:did_ocaml_switch = 1 @@ -97,15 +124,8 @@ endif " Folding support " Get the modeline because folding depends on indentation -let s:s = line2byte(line('.'))+col('.')-1 -if search('^\s*(\*:o\?caml:') - let s:modeline = getline(".") -else - let s:modeline = "" -endif -if s:s > 0 - exe 'goto' s:s -endif +let lnum = search('^\s*(\*:o\?caml:', 'n') +let s:modeline = lnum? getline(lnum): "" " Get the indentation params let s:m = matchstr(s:modeline,'default\s*=\s*\d\+') @@ -372,8 +392,8 @@ endfunction endfun " This variable contain a dictionnary of list. Each element of the dictionnary - " represent an annotation system. An annotation system is a list with: - " - annotation file name as its key + " represent an annotation system. An annotation system is a list with : + " - annotation file name as it's key " - annotation file path as first element of the contained list " - build path as second element of the contained list " - annot_file_last_mod (contain the date of .annot file) as third element |