From f64486b6b6b70a05b357229f86b35ab25d92636e Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 29 Jul 2019 01:51:37 +0200 Subject: vim-patch:790c18bfa5df Update runtime files https://github.com/vim/vim/commit/790c18bfa5dfeca51749b752dddc41e60cb3fa54 --- runtime/compiler/ocaml.vim | 18 +++++++++++++---- runtime/doc/autocmd.txt | 4 ++-- runtime/ftplugin/dune.vim | 20 +++++++++++++++++++ runtime/ftplugin/ocaml.vim | 48 ++++++++++++++++++++++++++++++++-------------- runtime/scripts.vim | 2 +- runtime/syntax/dune.vim | 46 ++++++++++++++++++++++++++++++++++++++++++++ runtime/syntax/ocaml.vim | 2 +- 7 files changed, 118 insertions(+), 22 deletions(-) create mode 100644 runtime/ftplugin/dune.vim create mode 100644 runtime/syntax/dune.vim diff --git a/runtime/compiler/ocaml.vim b/runtime/compiler/ocaml.vim index da15bce8fe..7f8a7eab67 100644 --- a/runtime/compiler/ocaml.vim +++ b/runtime/compiler/ocaml.vim @@ -1,7 +1,11 @@ " Vim Compiler File -" Compiler: ocaml -" Maintainer: See ftplugin/ocaml.vim (?) -" Last Change: June 2013 by Marc Weber +" Compiler: ocaml +" Maintainer: Markus Mottl +" URL: https://github.com/rgrinberg/vim-ocaml +" Last Change: +" 2017 Nov 26 - Improved error format (Markus Mottl) +" 2013 Aug 27 - Added a new OCaml error format (Markus Mottl) +" 2013 Jun 30 - Initial version (Marc Weber) " " Marc Weber's comments: " Setting makeprg doesn't make sense, because there is ocamlc, ocamlopt, @@ -17,7 +21,6 @@ " " So having it here makes people opt-in - if exists("current_compiler") finish endif @@ -28,6 +31,7 @@ set cpo&vim CompilerSet errorformat = \%EFile\ \"%f\"\\,\ line\ %l\\,\ characters\ %c-%*\\d:, + \%EFile\ \"%f\"\\,\ line\ %l\\,\ characters\ %c-%*\\d\ %.%#, \%EFile\ \"%f\"\\,\ line\ %l\\,\ character\ %c:%m, \%+EReference\ to\ unbound\ regexp\ name\ %m, \%Eocamlyacc:\ e\ -\ line\ %l\ of\ \"%f\"\\,\ %m, @@ -38,6 +42,12 @@ CompilerSet errorformat = \%X%*\\a[%*\\d]:\ Leaving\ directory\ `%f', \%D%*\\a:\ Entering\ directory\ `%f', \%X%*\\a:\ Leaving\ directory\ `%f', + \%D%*\\a[%*\\d]:\ Entering\ directory\ '%f', + \%X%*\\a[%*\\d]:\ Leaving\ directory\ '%f', + \%D%*\\a:\ Entering\ directory\ '%f', + \%X%*\\a:\ Leaving\ directory\ '%f', + \%DEntering\ directory\ '%f', + \%XLeaving\ directory\ '%f', \%DMaking\ %*\\a\ in\ %f let &cpo = s:cpo_save diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index a3f13034a8..a3a3c95a8f 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -397,8 +397,8 @@ BufFilePost After changing the name of the current buffer BufFilePre Before changing the name of the current buffer with the ":file" or ":saveas" command. *BufHidden* -BufHidden Just after a buffer has become hidden. That - is, when there are no longer windows that show +BufHidden Just before a buffer becomes hidden. That is, + when there are no longer windows that show the buffer, but the buffer is not unloaded or deleted. Not used for ":qa" or ":q" when exiting Vim. 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 +" Anton Kochkov +" 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 3ee7849063..e0d7efe997 100644 --- a/runtime/ftplugin/ocaml.vim +++ b/runtime/ftplugin/ocaml.vim @@ -5,12 +5,12 @@ " Pierre Vittet " Stefano Zacchiroli " Vincent Aravantinos -" 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 b:mw = '\:\:\(\\|;;\)' let b:mw = b:mw . ',\:\:\' -let b:mw = b:mw . ',\<\(for\|while\)\>:\:\,' +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 +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(, ) + " 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\+') diff --git a/runtime/scripts.vim b/runtime/scripts.vim index 8d460cd317..a690431014 100644 --- a/runtime/scripts.vim +++ b/runtime/scripts.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types in scripts " " Maintainer: Bram Moolenaar -" Last change: 2018 Feb 03 +" Last change: 2019 Jun 25 " This file is called by an autocommand for every file that has just been " loaded into a buffer. It checks if the type of file can be recognized by diff --git a/runtime/syntax/dune.vim b/runtime/syntax/dune.vim new file mode 100644 index 0000000000..f901813d24 --- /dev/null +++ b/runtime/syntax/dune.vim @@ -0,0 +1,46 @@ +" Language: Dune buildsystem +" Maintainer: Markus Mottl +" Anton Kochkov +" URL: https://github.com/rgrinberg/vim-ocaml +" Last Change: +" 2019 Feb 27 - Add newer keywords to the syntax (Simon Cruanes) +" 2018 May 8 - Check current_syntax (Kawahara Satoru) +" 2018 Mar 29 - Extend jbuild syntax with more keywords (Petter A. Urkedal) +" 2017 Sep 6 - Initial version (Etienne Millon) + +if exists("b:current_syntax") + finish +endif + +set syntax=lisp +syn case match + +" The syn-iskeyword setting lacks #,? from the iskeyword setting here. +" Clearing it avoids maintaining keyword characters in multiple places. +syn iskeyword clear + +syn keyword lispDecl jbuild_version library executable executables rule ocamllex ocamlyacc menhir alias install + +syn keyword lispKey name public_name synopsis modules libraries wrapped +syn keyword lispKey preprocess preprocessor_deps optional c_names cxx_names +syn keyword lispKey install_c_headers modes no_dynlink self_build_stubs_archive +syn keyword lispKey ppx_runtime_libraries virtual_deps js_of_ocaml link_flags +syn keyword lispKey javascript_files flags ocamlc_flags ocamlopt_flags pps staged_pps +syn keyword lispKey library_flags c_flags c_library_flags kind package action +syn keyword lispKey deps targets locks fallback +syn keyword lispKey inline_tests tests names + +syn keyword lispAtom true false + +syn keyword lispFunc cat chdir copy# diff? echo run setenv +syn keyword lispFunc ignore-stdout ignore-stderr ignore-outputs +syn keyword lispFunc with-stdout-to with-stderr-to with-outputs-to +syn keyword lispFunc write-file system bash + +syn cluster lispBaseListCluster add=duneVar +syn match duneVar '\${[@<^]}' containedin=lispSymbol +syn match duneVar '\${\k\+\(:\k\+\)\?}' containedin=lispSymbol + +hi def link duneVar Identifier + +let b:current_syntax = "dune" diff --git a/runtime/syntax/ocaml.vim b/runtime/syntax/ocaml.vim index 68c1feddae..06d8f416b5 100644 --- a/runtime/syntax/ocaml.vim +++ b/runtime/syntax/ocaml.vim @@ -4,7 +4,7 @@ " Maintainers: Markus Mottl " Karl-Heinz Sylla " Issac Trotts -" URL: http://www.ocaml.info/vim/syntax/ocaml.vim +" URL: https://github.com/rgrinberg/vim-ocaml " Last Change: 2012 May 12 - Added Dominique Pellé's spell checking patch (MM) " 2012 Feb 01 - Improved module path highlighting (MM) " 2010 Oct 11 - Added highlighting of lnot (MM, thanks to Erick Matsen) -- cgit From 80dda6892612de8405744b549aa2c2578a82a1b5 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 29 Jul 2019 01:58:17 +0200 Subject: vim-patch:ba3ff539303c Update runtime files https://github.com/vim/vim/commit/ba3ff539303c7bb6e46a6802dce3c7b2e55284e0 --- runtime/autoload/dist/ft.vim | 2 +- runtime/doc/change.txt | 2 +- runtime/doc/cmdline.txt | 1 - runtime/doc/eval.txt | 6 +-- runtime/doc/indent.txt | 5 +- runtime/doc/quickfix.txt | 2 +- runtime/doc/syntax.txt | 3 ++ runtime/doc/windows.txt | 4 ++ runtime/indent/html.vim | 2 +- runtime/indent/raml.vim | 12 +++++ runtime/indent/xml.vim | 6 ++- runtime/syntax/debchangelog.vim | 4 +- runtime/syntax/debsources.vim | 4 +- runtime/syntax/raml.vim | 106 ++++++++++++++++++++++++++++++++++++++++ 14 files changed, 143 insertions(+), 16 deletions(-) create mode 100644 runtime/indent/raml.vim create mode 100644 runtime/syntax/raml.vim diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim index 6ed39cb9f1..a97bad3b56 100644 --- a/runtime/autoload/dist/ft.vim +++ b/runtime/autoload/dist/ft.vim @@ -126,7 +126,7 @@ endfunc " This function checks if one of the first ten lines start with a '@'. In " that case it is probably a change file. " If the first line starts with # or ! it's probably a ch file. -" If a line has "main", "include", "//" ir "/*" it's probably ch. +" If a line has "main", "include", "//" or "/*" it's probably ch. " Otherwise CHILL is assumed. func dist#ft#FTchange() let lnum = 1 diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index 912231bfcd..13af2b05ce 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -800,7 +800,7 @@ the |substitute()| function with the following exceptions: - magic is always set without regard to 'magic'. - A ~ inserts a tilde literally. - and \r inserts a carriage-return (CTRL-M). - - \ does not have a special meaning. it's just one of \x. + - \ does not have a special meaning. It's just one of \x. Examples: > :s/a\|b/xxx\0xxx/g modifies "a b" to "xxxaxxx xxxbxxx" diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index 5f4f128329..119fd924f1 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -499,7 +499,6 @@ that see the '"' as part of their argument: :autocmd :bufdo :cexpr (and the like) - :call :cdo (and the like) :command :cscope (and the like) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 752e368925..70e6895a75 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -147,10 +147,10 @@ function() or funcref(). When calling the function the Dictionary and/or arguments will be passed to the function. Example: > let Cb = function('Callback', ['foo'], myDict) - call Cb() + call Cb('bar') This will invoke the function as if using: > - call myDict.Callback('foo') + call myDict.Callback('foo', 'bar') Note that binding a function to a Dictionary also happens when the function is a member of the Dictionary: > @@ -8819,7 +8819,7 @@ win_getid([{win} [, {tab}]]) *win_getid()* Get the |window-ID| for the specified window. When {win} is missing use the current window. With {win} this is the window number. The top window has - number 1. Use `win_getid(winnr())` for the current window. + number 1. Without {tab} use the current tab, otherwise the tab with number {tab}. The first tab has number one. Return zero if the window cannot be found. diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt index 6820b9c240..952033d1b8 100644 --- a/runtime/doc/indent.txt +++ b/runtime/doc/indent.txt @@ -585,8 +585,9 @@ The basics for using flexible indenting are explained in section |30.3| of the user manual. If you want to write your own indent file, it must set the 'indentexpr' -option. Setting the 'indentkeys' option is often useful. See the -$VIMRUNTIME/indent directory for examples. +option. Setting the 'indentkeys' option is often useful. +See the $VIMRUNTIME/indent/README.txt file for hints. +See the $VIMRUNTIME/indent directory for examples. REMARKS ABOUT SPECIFIC INDENT FILES ~ diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index 7b9c418a46..7255af36e9 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -889,7 +889,7 @@ commands can be combined to create a NewGrep command: > 'smartcase' is not used. If {pattern} is empty (e.g. // is specified), the last used search pattern is used. |last-pattern| - +:{count}vim[grep] ... When a number is put before the command this is used as the maximum number of matches to find. Use ":1vimgrep pattern file" to find only the first. diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 1373aff891..4564d84955 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -917,6 +917,9 @@ to the respective variable. Example: > To disable them use ":unlet". Example: > :unlet c_comment_strings +An alternative is to switch to the C++ highlighting: > + :set filetype=cpp + Variable Highlight ~ *c_gnu* GNU gcc specific items *c_comment_strings* strings and numbers inside a comment diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index 243060a617..ac9e1f48fe 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -64,6 +64,10 @@ will not change within a Vim session. The |win_getid()| and |win_id2tabwin()| functions can be used to convert between the window/tab number and the identifier. There is also the window number, which may change whenever windows are opened or closed, see |winnr()|. +The window number is only valid in one specific tab. The window ID is valid +across tabs. For most functions that take a window ID or a window number, the +window number only applies to the current tab, while the window ID can refer +to a window in any tab. Each buffer has a unique number and the number will not change within a Vim session. The |bufnr()| and |bufname()| functions can be used to convert diff --git a/runtime/indent/html.vim b/runtime/indent/html.vim index 6c866594c5..bece6614b8 100644 --- a/runtime/indent/html.vim +++ b/runtime/indent/html.vim @@ -625,7 +625,7 @@ func! s:CSSIndent() return eval(b:hi_css1indent) endif - " If the current line starts with "}" align with it's match. + " If the current line starts with "}" align with its match. if curtext =~ '^\s*}' call cursor(v:lnum, 1) try diff --git a/runtime/indent/raml.vim b/runtime/indent/raml.vim new file mode 100644 index 0000000000..73756ae7de --- /dev/null +++ b/runtime/indent/raml.vim @@ -0,0 +1,12 @@ +" Vim indent file +" Language: RAML (RESTful API Modeling Language) +" Maintainer: mucheng +" License: VIM LICENSE +" Latest Revision: 2018-11-03 + +if exists("b:did_indent") + finish +endif + +" Same as yaml indenting. +runtime! indent/yaml.vim diff --git a/runtime/indent/xml.vim b/runtime/indent/xml.vim index dcafb467a6..7afcc89b7f 100644 --- a/runtime/indent/xml.vim +++ b/runtime/indent/xml.vim @@ -2,7 +2,9 @@ " Repository: https://github.com/chrisbra/vim-xml-ftplugin " Maintainer: Christian Brabandt " Previous Maintainer: Johannes Zellner -" Last Change: 20180724 - Correctly indent xml comments https://github.com/vim/vim/issues/3200 +" Last Change: 20181022 - Do not overwrite indentkeys setting +" https://github.com/chrisbra/vim-xml-ftplugin/issues/1 +" 20180724 - Correctly indent xml comments https://github.com/vim/vim/issues/3200 " Notes: 1) does not indent pure non-xml code (e.g. embedded scripts) " 2) will be confused by unbalanced tags in comments " or CDATA sections. @@ -19,7 +21,7 @@ set cpo&vim " [-- local settings (must come before aborting the script) --] setlocal indentexpr=XmlIndentGet(v:lnum,1) -setlocal indentkeys=o,O,*,<>>,<<>,/,{,} +setlocal indentkeys=o,O,*,<>>,<<>,/,{,},!^F if !exists('b:xml_indent_open') let b:xml_indent_open = '.\{-}<\a' diff --git a/runtime/syntax/debchangelog.vim b/runtime/syntax/debchangelog.vim index edaaf6128f..ce0339522b 100644 --- a/runtime/syntax/debchangelog.vim +++ b/runtime/syntax/debchangelog.vim @@ -3,7 +3,7 @@ " Maintainer: Debian Vim Maintainers " Former Maintainers: Gerfried Fuchs " Wichert Akkerman -" Last Change: 2018 May 03 +" Last Change: 2018 Oct 30 " URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debchangelog.vim " Standard syntax initialization @@ -21,7 +21,7 @@ let s:binNMU='binary-only=yes' syn match debchangelogName contained "^[[:alnum:]][[:alnum:].+-]\+ " exe 'syn match debchangelogFirstKV contained "; \('.s:urgency.'\|'.s:binNMU.'\)"' exe 'syn match debchangelogOtherKV contained ", \('.s:urgency.'\|'.s:binNMU.'\)"' -syn match debchangelogTarget contained "\v %(frozen|unstable|sid|%(testing|%(old)=stable)%(-proposed-updates|-security)=|experimental|squeeze-%(backports%(-sloppy)=|volatile|lts|security)|%(wheezy|jessie)%(-backports%(-sloppy)=|-security)=|stretch%(-backports|-security)=|%(devel|precise|trusty|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic)%(-%(security|proposed|updates|backports|commercial|partner))=)+" +syn match debchangelogTarget contained "\v %(frozen|unstable|sid|%(testing|%(old)=stable)%(-proposed-updates|-security)=|experimental|squeeze-%(backports%(-sloppy)=|volatile|lts|security)|%(wheezy|jessie)%(-backports%(-sloppy)=|-security)=|stretch%(-backports|-security)=|%(devel|precise|trusty|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco)%(-%(security|proposed|updates|backports|commercial|partner))=)+" syn match debchangelogVersion contained "(.\{-})" syn match debchangelogCloses contained "closes:\_s*\(bug\)\=#\=\_s\=\d\+\(,\_s*\(bug\)\=#\=\_s\=\d\+\)*" syn match debchangelogLP contained "\clp:\s\+#\d\+\(,\s*#\d\+\)*" diff --git a/runtime/syntax/debsources.vim b/runtime/syntax/debsources.vim index 74e8d42d1c..4b2194125d 100644 --- a/runtime/syntax/debsources.vim +++ b/runtime/syntax/debsources.vim @@ -2,7 +2,7 @@ " Language: Debian sources.list " Maintainer: Debian Vim Maintainers " Former Maintainer: Matthijs Mohlmann -" Last Change: 2018 Aug 11 +" Last Change: 2018 Oct 30 " URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debsources.vim " Standard syntax initialization @@ -25,7 +25,7 @@ let s:supported = [ \ 'oldstable', 'stable', 'testing', 'unstable', 'experimental', \ 'wheezy', 'jessie', 'stretch', 'sid', 'rc-buggy', \ - \ 'trusty', 'xenial', 'bionic', 'cosmic', 'devel' + \ 'trusty', 'xenial', 'bionic', 'cosmic', 'disco', 'devel' \ ] let s:unsupported = [ \ 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato', diff --git a/runtime/syntax/raml.vim b/runtime/syntax/raml.vim new file mode 100644 index 0000000000..062a71c81b --- /dev/null +++ b/runtime/syntax/raml.vim @@ -0,0 +1,106 @@ +" Vim syntax file +" Language: RAML (RESTful API Modeling Language) +" Maintainer: Eric Hopkins +" URL: https://github.com/in3d/vim-raml +" License: Same as Vim +" Last Change: 2018-11-03 + +if exists("b:current_syntax") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +syn keyword ramlTodo contained TODO FIXME XXX NOTE + +syn region ramlComment display oneline start='\%(^\|\s\)#' end='$' + \ contains=ramlTodo,@Spell + +syn region ramlVersion display oneline start='#%RAML' end='$' + +syn match ramlNodeProperty '!\%(![^\\^% ]\+\|[^!][^:/ ]*\)' + +syn match ramlAnchor '&.\+' + +syn match ramlAlias '\*.\+' + +syn match ramlDelimiter '[-,:]' +syn match ramlBlock '[\[\]{}>|]' +syn match ramlOperator '[?+-]' +syn match ramlKey '\h\+\(?\)\?\ze\s*:' +syn match ramlKey '\w\+\(\s\+\w\+\)*\(?\)\?\ze\s*:' +syn match routeKey '\/\w\+\(\s\+\w\+\)*\ze\s*:' +syn match routeKey 'application\/\w\+\ze\s*:' +syn match routeParamKey '\/{\w\+}*\ze\s*:' + +syn region ramlString matchgroup=ramlStringDelimiter + \ start=+\s"+ skip=+\\"+ end=+"+ + \ contains=ramlEscape +syn region ramlString matchgroup=ramlStringDelimiter + \ start=+\s'+ skip=+''+ end=+'+ + \ contains=ramlStringEscape +syn region ramlParameter matchgroup=ramlParameterDelimiter + \ start=+<<+ skip=+''+ end=+>>+ +syn match ramlEscape contained display +\\[\\"abefnrtv^0_ NLP]+ +syn match ramlEscape contained display '\\x\x\{2}' +syn match ramlEscape contained display '\\u\x\{4}' +syn match ramlEscape contained display '\\U\x\{8}' +syn match ramlEscape display '\\\%(\r\n\|[\r\n]\)' +syn match ramlStringEscape contained +''+ + +syn match ramlNumber display + \ '\<[+-]\=\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=' +syn match ramlNumber display '0\o\+' +syn match ramlNumber display '0x\x\+' +syn match ramlNumber display '([+-]\=[iI]nf)' +syn match ramlNumber display '(NaN)' + +syn match ramlConstant '\<[~yn]\>' +syn keyword ramlConstant true True TRUE false False FALSE +syn keyword ramlConstant yes Yes on ON no No off OFF +syn keyword ramlConstant null Null NULL nil Nil NIL + +syn keyword httpVerbs get post put delete head patch options +syn keyword ramlTypes string number integer date boolean file + +syn match ramlTimestamp '\d\d\d\d-\%(1[0-2]\|\d\)-\%(3[0-2]\|2\d\|1\d\|\d\)\%( \%([01]\d\|2[0-3]\):[0-5]\d:[0-5]\d.\d\d [+-]\%([01]\d\|2[0-3]\):[0-5]\d\|t\%([01]\d\|2[0-3]\):[0-5]\d:[0-5]\d.\d\d[+-]\%([01]\d\|2[0-3]\):[0-5]\d\|T\%([01]\d\|2[0-3]\):[0-5]\d:[0-5]\d.\dZ\)\=' + +syn region ramlDocumentHeader start='---' end='$' contains=ramlDirective +syn match ramlDocumentEnd '\.\.\.' + +syn match ramlDirective contained '%[^:]\+:.\+' + +hi def link ramlVersion String +hi def link routeInterpolation String +hi def link ramlInterpolation Constant +hi def link ramlTodo Todo +hi def link ramlComment Comment +hi def link ramlDocumentHeader PreProc +hi def link ramlDocumentEnd PreProc +hi def link ramlDirective Keyword +hi def link ramlNodeProperty Type +hi def link ramlAnchor Type +hi def link ramlAlias Type +hi def link ramlBlock Operator +hi def link ramlOperator Operator +hi def link routeParamKey SpecialChar +hi def link ramlKey Identifier +hi def link routeKey SpecialChar +hi def link ramlParameterDelimiter Type +hi def link ramlParameter Type +hi def link ramlString String +hi def link ramlStringDelimiter ramlString +hi def link ramlEscape SpecialChar +hi def link ramlStringEscape SpecialChar +hi def link ramlNumber Number +hi def link ramlConstant Constant +hi def link ramlTimestamp Number +hi def link httpVerbs Statement +hi def link ramlTypes Type +hi def link ramlDelimiter Delimiter + +let b:current_syntax = "raml" + +let &cpo = s:cpo_save +unlet s:cpo_save -- cgit From 28a681d37d320ec66b7dc1039795faa8b4b895a1 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 29 Jul 2019 02:03:18 +0200 Subject: vim-patch:f0d58efc9dc4 Update runtime files. https://github.com/vim/vim/commit/f0d58efc9dc46be37c629cbc99b4125448ca39fd --- runtime/autoload/tohtml.vim | 122 +++++++++++++++++++++------------------ runtime/doc/indent.txt | 22 +++---- runtime/doc/motion.txt | 2 +- runtime/doc/options.txt | 11 ++-- runtime/doc/pattern.txt | 2 +- runtime/doc/syntax.txt | 12 ++-- runtime/doc/tagsrch.txt | 4 +- runtime/plugin/tohtml.vim | 137 ++++++++++++++++++++++++-------------------- runtime/syntax/2html.vim | 93 ++++++++++++++++++++++++------ 9 files changed, 244 insertions(+), 161 deletions(-) diff --git a/runtime/autoload/tohtml.vim b/runtime/autoload/tohtml.vim index d972ad63fe..2d874c690d 100644 --- a/runtime/autoload/tohtml.vim +++ b/runtime/autoload/tohtml.vim @@ -1,6 +1,6 @@ " Vim autoload file for the tohtml plugin. " Maintainer: Ben Fritz -" Last Change: 2013 Sep 03 +" Last Change: 2018 Nov 11 " " Additional contributors: " @@ -544,12 +544,16 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{ " add required javascript in reverse order so we can just call append again " and again without adjusting {{{ - " insert script closing tag - call append(style_start, [ - \ '', - \ s:settings.use_xhtml ? '//]]>' : '-->', - \ "" - \ ]) + let s:uses_script = s:settings.dynamic_folds || s:settings.line_ids || !empty(s:settings.prevent_copy) + + " insert script closing tag if needed + if s:uses_script + call append(style_start, [ + \ '', + \ s:settings.use_xhtml ? '//]]>' : '-->', + \ "" + \ ]) + endif " insert script which corrects the size of small input elements in " prevent_copy mode. See 2html.vim for details on why this is needed and how @@ -575,55 +579,61 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{ \ '}' \ ]) endif - " + " insert javascript to get IDs from line numbers, and to open a fold before " jumping to any lines contained therein - call append(style_start, [ - \ " /* Always jump to new location even if the line was hidden inside a fold, or", - \ " * we corrected the raw number to a line ID.", - \ " */", - \ " if (lineElem) {", - \ " lineElem.scrollIntoView(true);", - \ " }", - \ " return true;", - \ "}", - \ "if ('onhashchange' in window) {", - \ " window.onhashchange = JumpToLine;", - \ "}" - \ ]) - if s:settings.dynamic_folds + if s:settings.line_ids + call append(style_start, [ + \ " /* Always jump to new location even if the line was hidden inside a fold, or", + \ " * we corrected the raw number to a line ID.", + \ " */", + \ " if (lineElem) {", + \ " lineElem.scrollIntoView(true);", + \ " }", + \ " return true;", + \ "}", + \ "if ('onhashchange' in window) {", + \ " window.onhashchange = JumpToLine;", + \ "}" + \ ]) + + if s:settings.dynamic_folds + call append(style_start, [ + \ "", + \ " /* navigate upwards in the DOM tree to open all folds containing the line */", + \ " var node = lineElem;", + \ " while (node && node.id != 'vimCodeElement".s:settings.id_suffix."')", + \ " {", + \ " if (node.className == 'closed-fold')", + \ " {", + \ " /* toggle open the fold ID (remove window ID) */", + \ " toggleFold(node.id.substr(4));", + \ " }", + \ " node = node.parentNode;", + \ " }", + \ ]) + endif + endif + + if s:settings.line_ids call append(style_start, [ \ "", - \ " /* navigate upwards in the DOM tree to open all folds containing the line */", - \ " var node = lineElem;", - \ " while (node && node.id != 'vimCodeElement".s:settings.id_suffix."')", - \ " {", - \ " if (node.className == 'closed-fold')", - \ " {", - \ " /* toggle open the fold ID (remove window ID) */", - \ " toggleFold(node.id.substr(4));", - \ " }", - \ " node = node.parentNode;", + \ "/* function to open any folds containing a jumped-to line before jumping to it */", + \ "function JumpToLine()", + \ "{", + \ " var lineNum;", + \ " lineNum = window.location.hash;", + \ " lineNum = lineNum.substr(1); /* strip off '#' */", + \ "", + \ " if (lineNum.indexOf('L') == -1) {", + \ " lineNum = 'L'+lineNum;", + \ " }", + \ " if (lineNum.indexOf('W') == -1) {", + \ " lineNum = 'W1'+lineNum;", \ " }", + \ " var lineElem = document.getElementById(lineNum);" \ ]) endif - call append(style_start, [ - \ "", - \ "/* function to open any folds containing a jumped-to line before jumping to it */", - \ "function JumpToLine()", - \ "{", - \ " var lineNum;", - \ " lineNum = window.location.hash;", - \ " lineNum = lineNum.substr(1); /* strip off '#' */", - \ "", - \ " if (lineNum.indexOf('L') == -1) {", - \ " lineNum = 'L'+lineNum;", - \ " }", - \ " if (lineNum.indexOf('W') == -1) {", - \ " lineNum = 'W1'+lineNum;", - \ " }", - \ " lineElem = document.getElementById(lineNum);" - \ ]) " Insert javascript to toggle matching folds open and closed in all windows, " if dynamic folding is active. @@ -648,11 +658,13 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{ \ ]) endif - " insert script tag; javascript is always needed for the line number - " normalization for URL hashes - call append(style_start, [ - \ "" - \ ]) +" insert script closing tag if needed +if s:uses_script + call extend(s:lines, [ + \ '', + \ s:settings.use_xhtml ? '//]]>' : '-->', + \ "" + \ ]) +endif call extend(s:lines, [""]) if !empty(s:settings.prevent_copy) @@ -1525,10 +1570,22 @@ while s:lnum <= s:end if s:settings.expand_tabs let s:offset = 0 let s:idx = stridx(s:expandedtab, "\t") + let s:tablist = split(&vts,',') + if empty(s:tablist) + let s:tablist = [ &ts ] + endif + let s:tabidx = 0 + let s:tabwidth = 0 while s:idx >= 0 + while s:startcol+s:idx > s:tabwidth + s:tablist[s:tabidx] + let s:tabwidth += s:tablist[s:tabidx] + if s:tabidx < len(s:tablist)-1 + let s:tabidx = s:tabidx+1 + endif + endwhile if has("multi_byte_encoding") if s:startcol + s:idx == 1 - let s:i = &ts + let s:i = s:tablist[s:tabidx] else if s:idx == 0 let s:prevc = matchstr(s:line, '.\%' . (s:startcol + s:idx + s:offset) . 'c') @@ -1536,11 +1593,11 @@ while s:lnum <= s:end let s:prevc = matchstr(s:expandedtab, '.\%' . (s:idx + 1) . 'c') endif let s:vcol = virtcol([s:lnum, s:startcol + s:idx + s:offset - len(s:prevc)]) - let s:i = &ts - (s:vcol % &ts) + let s:i = s:tablist[s:tabidx] - (s:vcol - s:tabwidth) endif let s:offset -= s:i - 1 else - let s:i = &ts - ((s:idx + s:startcol - 1) % &ts) + let s:i = s:tablist[s:tabidx] - ((s:idx + s:startcol - 1) - s:tabwidth) endif let s:expandedtab = substitute(s:expandedtab, '\t', repeat(' ', s:i), '') let s:idx = stridx(s:expandedtab, "\t") -- cgit From ab2cfd24e72f6cbcbc4fcea596eead189f690091 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 29 Jul 2019 02:09:53 +0200 Subject: vim-patch:b730f0c7ba36 Update runtime files https://github.com/vim/vim/commit/b730f0c7ba36492d795f081b19bbcb85cdf0f50f --- runtime/doc/options.txt | 4 +- runtime/doc/syntax.txt | 2 - runtime/doc/usr_41.txt | 28 +++++++++++--- runtime/indent/testdir/matlab.in | 17 +++++++++ runtime/indent/testdir/matlab.ok | 17 +++++++++ runtime/syntax/sh.vim | 81 +++++++++++++++++++++------------------- runtime/syntax/tex.vim | 10 ++--- runtime/syntax/vim.vim | 2 +- 8 files changed, 108 insertions(+), 53 deletions(-) create mode 100644 runtime/indent/testdir/matlab.in create mode 100644 runtime/indent/testdir/matlab.ok diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 4378e22117..cb396eea38 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -5626,8 +5626,8 @@ A jump table for the options with a short description can be found at |Q_op|. After this option has been set successfully, Vim will source the files "spell/LANG.vim" in 'runtimepath'. "LANG" is the value of 'spelllang' - up to the first character that is not an ASCII letter and not a dash. - Also see |set-spc-auto|. + up to the first character that is not an ASCII letter or number and + not a dash. Also see |set-spc-auto|. *'spellsuggest'* *'sps'* diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index a377d57a5a..ae119f6fdd 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -752,8 +752,6 @@ When 1, generate XHTML 1.0 instead (XML compliant HTML). :let g:html_use_xhtml = 1 < - vim:tw=78:sw=4:ts=8:sts=4:ft=help:norl:ai:noet: - ABEL *abel.vim* *ft-abel-syntax* ABEL highlighting provides some user-defined options. To enable them, assign diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index def781c109..360932126f 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -612,6 +612,7 @@ String manipulation: *string-functions* repeat() repeat a string multiple times eval() evaluate a string expression execute() execute an Ex command and get the output + trim() trim characters from a string List manipulation: *list-functions* get() get an item without error for wrong index @@ -798,6 +799,9 @@ Buffers, windows and the argument list: bufwinnr() get the window number of a specific buffer winbufnr() get the buffer number of a specific window getbufline() get a list of lines from the specified buffer + setbufline() replace a line in the specified buffer + appendbufline() append a list of lines in the specified buffer + deletebufline() delete lines from a specified buffer win_findbuf() find windows containing a buffer win_getid() get window ID of a window win_gotoid() go to window with ID @@ -808,6 +812,8 @@ Buffers, windows and the argument list: getwininfo() get a list with window information getchangelist() get a list of change list entries getjumplist() get a list of jump list entries + swapinfo() information about a swap file + swapname() get the swap file path of a buffer Command line: *command-line-functions* getcmdline() get the current command line @@ -906,6 +912,7 @@ Window size and position: *window-size-functions* winheight() get height of a specific window winwidth() get width of a specific window win_screenpos() get screen position of a window + winlayout() get layout of windows in a tab page winrestcmd() return command to restore window sizes winsaveview() get view of current window winrestview() restore saved view of current window @@ -928,6 +935,7 @@ Signs: *sign-functions* Testing: *test-functions* assert_equal() assert that two expressions values are equal + assert_equalfile() assert that two file contents are equal assert_notequal() assert that two expressions values are not equal assert_inrange() assert that an expression is inside a range assert_match() assert that a pattern matches the value @@ -940,7 +948,21 @@ Testing: *test-functions* Timers: *timer-functions* timer_start() create a timer + timer_pause() pause or unpause a timer timer_stop() stop a timer + timer_stopall() stop all timers + timer_info() get information about timers + +Tags: *tag-functions* + taglist() get list of matching tags + tagfiles() get a list of tags files + gettagstack() get the tag stack of a window + settagstack() modify the tag stack of a window + +Prompt Buffer: *promptbuffer-functions* + prompt_setcallback() set prompt callback for a buffer + prompt_setinterrupt() set interrupt callback for a buffer + prompt_setprompt() set the prompt text for a buffer Various: *various-functions* mode() get current editing mode @@ -969,15 +991,11 @@ Various: *various-functions* wordcount() get byte/word/char count of buffer - taglist() get list of matching tags - tagfiles() get a list of tags files - gettagstack() get the tag stack - settagstack() modify the tag stack - luaeval() evaluate Lua expression py3eval() evaluate Python expression (|+python3|) pyeval() evaluate Python expression (|+python|) pyxeval() evaluate |python_x| expression + debugbreak() interrupt a program being debugged ============================================================================== *41.7* Defining a function diff --git a/runtime/indent/testdir/matlab.in b/runtime/indent/testdir/matlab.in new file mode 100644 index 0000000000..1a2bc83d4b --- /dev/null +++ b/runtime/indent/testdir/matlab.in @@ -0,0 +1,17 @@ +% vim: set ft=matlab sw=4 : + +% START_INDENT +if true +disp foo +elseif false +disp bar +end +% END_INDENT + +% START_INDENT +try +statements +catch exception +statements +end +% END_INDENT diff --git a/runtime/indent/testdir/matlab.ok b/runtime/indent/testdir/matlab.ok new file mode 100644 index 0000000000..88e1d86b06 --- /dev/null +++ b/runtime/indent/testdir/matlab.ok @@ -0,0 +1,17 @@ +% vim: set ft=matlab sw=4 : + +% START_INDENT +if true + disp foo +elseif false + disp bar +end +% END_INDENT + +% START_INDENT +try + statements +catch exception + statements +end +% END_INDENT diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim index 5e0d1fd76a..9eed594b8c 100644 --- a/runtime/syntax/sh.vim +++ b/runtime/syntax/sh.vim @@ -2,8 +2,8 @@ " Language: shell (sh) Korn shell (ksh) bash (sh) " Maintainer: Charles E. Campbell " Previous Maintainer: Lennart Schultz -" Last Change: Sep 04, 2018 -" Version: 182 +" Last Change: Nov 23, 2018 +" Version: 185 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH " For options and settings, please use: :help ft-sh-syntax " This file includes many ideas from Eric Brunet (eric.brunet@ens.fr) @@ -144,12 +144,12 @@ endif syn cluster shHereBeginList contains=@shCommandSubList syn cluster shHereList contains=shBeginHere,shHerePayload syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload -syn cluster shIdList contains=shCommandSub,shCommandSubBQ,shWrapLineOperator,shSetOption,shComment,shDeref,shDerefSimple,shHereString,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr +syn cluster shIdList contains=shCommandSub,shCommandSubBQ,shWrapLineOperator,shSetOption,shComment,shDeref,shDerefSimple,shHereString,shNumber,shOperator,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr syn cluster shIfList contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo syn cluster shLoopList contains=@shCaseList,@shErrorList,shCaseEsac,shConditional,shDblBrace,shExpr,shFor,shForPP,shIf,shOption,shSet,shTest,shTestOpr,shTouch syn cluster shPPSRightList contains=shComment,shDeref,shDerefSimple,shEscape,shPosnParm syn cluster shSubShList contains=@shCommandSubList,shCommandSubBQ,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator -syn cluster shTestList contains=shCharClass,shCommandSub,shCommandSubBQ,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shSpecialDQ,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr +syn cluster shTestList contains=shArithmetic,shCharClass,shCommandSub,shCommandSubBQ,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shSpecialDQ,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr syn cluster shNoZSList contains=shSpecialNoZS syn cluster shForList contains=shTestOpr,shNumber,shDerefSimple,shDeref,shCommandSub,shCommandSubBQ,shArithmetic @@ -292,7 +292,9 @@ endif "====== syn match shWrapLineOperator "\\$" syn region shCommandSubBQ start="`" skip="\\\\\|\\." end="`" contains=shBQComment,@shCommandSubList -syn match shEscape contained '\%(^\)\@!\%(\\\\\)*\\.' nextgroup=shSingleQuote,shDoubleQuote,shComment +"see ksh13 +"syn match shEscape contained '\%(^\)\@!\%(\\\\\)*\\.' nextgroup=shSingleQuote,shDoubleQuote,shComment +syn match shEscape contained '\%(^\)\@!\%(\\\\\)*\\.' nextgroup=shComment " $() and $(()): {{{1 " $(..) is not supported by sh (Bourne shell). However, apparently @@ -379,22 +381,22 @@ syn match shBQComment contained "#.\{-}\ze`" contains=@shCommentGroup " Here Documents: {{{1 " ========================================= -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc01 start="<<\s*\\\=\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc01 end="^\z1\s*$" contains=@shDblQuoteList -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc02 start="<<\s*\"\z([^ \t|>]\+\)\"" matchgroup=shHereDoc02 end="^\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc03 start="<<-\s*\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc03 end="^\s*\z1\s*$" contains=@shDblQuoteList +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc01 start="<<\s*\\\=\z([^ \t|>]\+\)" matchgroup=shHereDoc01 end="^\z1\s*$" contains=@shDblQuoteList +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc02 start="<<\s*\"\z([^"]\+\)\"" matchgroup=shHereDoc02 end="^\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc03 start="<<-\s*\z([^ \t|>]\+\)" matchgroup=shHereDoc03 end="^\s*\z1\s*$" contains=@shDblQuoteList ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc04 start="<<-\s*'\z([^']\+\)'" matchgroup=shHereDoc04 end="^\s*\z1\s*$" ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc05 start="<<\s*'\z([^']\+\)'" matchgroup=shHereDoc05 end="^\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc06 start="<<-\s*\"\z([^ \t|>]\+\)\"" matchgroup=shHereDoc06 end="^\s*\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc07 start="<<\s*\\\_$\_s*\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc07 end="^\z1\s*$" contains=@shDblQuoteList -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc08 start="<<\s*\\\_$\_s*'\z([^ \t0-9|>]\+\)'" matchgroup=shHereDoc08 end="^\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc09 start="<<\s*\\\_$\_s*\"\z([^ \t0-9|>]\+\)\"" matchgroup=shHereDoc09 end="^\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc10 start="<<-\s*\\\_$\_s*\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc10 end="^\s*\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc11 start="<<-\s*\\\_$\_s*\\\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc11 end="^\s*\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc12 start="<<-\s*\\\_$\_s*'\z([^ \t|>]\+\)'" matchgroup=shHereDoc12 end="^\s*\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc13 start="<<-\s*\\\_$\_s*\"\z([^ \t|>]\+\)\"" matchgroup=shHereDoc13 end="^\s*\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc14 start="<<\\\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc14 end="^\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc15 start="<<-\s*\\\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc15 end="^\s*\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc16 start="<<-\s*\\\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc15 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc06 start="<<-\s*\"\z([^"]\+\)\"" matchgroup=shHereDoc06 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc07 start="<<\s*\\\_$\_s*\z([^ \t|>]\+\)" matchgroup=shHereDoc07 end="^\z1\s*$" contains=@shDblQuoteList +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc08 start="<<\s*\\\_$\_s*'\z([^ \t|>]\+\)'" matchgroup=shHereDoc08 end="^\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc09 start="<<\s*\\\_$\_s*\"\z([^ \t|>]\+\)\"" matchgroup=shHereDoc09 end="^\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc10 start="<<-\s*\\\_$\_s*\z([^ \t|>]\+\)" matchgroup=shHereDoc10 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc11 start="<<-\s*\\\_$\_s*\\\z([^ \t|>]\+\)" matchgroup=shHereDoc11 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc12 start="<<-\s*\\\_$\_s*'\z([^']\+\)'" matchgroup=shHereDoc12 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc13 start="<<-\s*\\\_$\_s*\"\z([^"]\+\)\"" matchgroup=shHereDoc13 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc14 start="<<\\\z([^ \t|>]\+\)" matchgroup=shHereDoc14 end="^\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc15 start="<<-\s*\\\z([^ \t|>]\+\)" matchgroup=shHereDoc15 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc16 start="<<-\s*\\\z([^ \t|>]\+\)" matchgroup=shHereDoc15 end="^\s*\z1\s*$" " Here Strings: {{{1 " ============= @@ -407,18 +409,19 @@ endif "============= syn match shSetOption "\s\zs[-+][a-zA-Z0-9]\+\>" contained syn match shVariable "\<\([bwglsav]:\)\=[a-zA-Z0-9.!@_%+,]*\ze=" nextgroup=shVarAssign -syn match shVarAssign "=" contained nextgroup=shCmdParenRegion,shPattern,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shSingleQuote,shExSingleQuote +syn match shVarAssign "=" contained nextgroup=shCmdParenRegion,shPattern,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shSingleQuote,shExSingleQuote,shVar +syn match shVar contained "\h\w*" syn region shAtExpr contained start="@(" end=")" contains=@shIdList if exists("b:is_bash") - syn match shSet "^\s*set\ze\s*$" - syn region shSetList oneline matchgroup=shSet start="\<\(declare\|typeset\|local\|export\|unset\)\>\ze[^/]" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+#\|=" contains=@shIdList - syn region shSetList oneline matchgroup=shSet start="\\ze[^/]" end="\ze[;|#)]\|$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+=" contains=@shIdList nextgroup=shComment + syn match shSet "^\s*set\ze\s\+$" + syn region shSetList oneline matchgroup=shSet start="\<\%(declare\|local\|export\)\>\ze[/a-zA-Z_]\@!" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+#\|=" contains=@shIdList + syn region shSetList oneline matchgroup=shSet start="\<\%(set\|unset\)\>[/a-zA-Z_]\@!" end="\ze[;|#)]\|$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+=" contains=@shIdList nextgroup=shComment elseif exists("b:is_kornshell") || exists("b:is_posix") - syn match shSet "^\s*set\ze\s*$" - syn region shSetList oneline matchgroup=shSet start="\<\(typeset\|export\|unset\)\>\ze[^/]" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList - syn region shSetList oneline matchgroup=shSet start="\\ze[^/]" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList + syn match shSet "^\s*set\ze\s\+$" + syn region shSetList oneline matchgroup=shSet start="\<\(export\)\>\ze[/]\@!" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList + syn region shSetList oneline matchgroup=shSet start="\<\%(set\|unset\>\)\ze[/a-zA-Z_]\@!" end="\ze[;|#)]\|$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList nextgroup=shComment else - syn region shSetList oneline matchgroup=shSet start="\<\(set\|export\|unset\)\>\ze[^/]" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList + syn region shSetList oneline matchgroup=shSet start="\<\(set\|export\|unset\)\>\ze[/a-zA-Z_]\@!" end="\ze[;|#)]\|$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList endif " Functions: {{{1 @@ -523,12 +526,12 @@ if exists("b:is_bash") " bash : ${parameter//pattern/string} " bash : ${parameter//pattern} syn match shDerefPPS contained '/\{1,2}' nextgroup=shDerefPPSleft - syn region shDerefPPSleft contained start='.' skip=@\%(\\\\\)*\\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPPSright contains=@shCommandSubList - syn region shDerefPPSright contained start='.' skip=@\%(\\\\\)\+@ end='\ze}' contains=@shPPSRightList + syn region shDerefPPSleft contained start='.' skip=@\%(\\\\\)*\\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPPSright contains=@shCommandSubList + syn region shDerefPPSright contained start='.' skip=@\%(\\\\\)\+@ end='\ze}' contains=@shPPSRightList " bash : ${parameter/#substring/replacement} syn match shDerefPSR contained '/#' nextgroup=shDerefPSRleft,shDoubleQuote,shSingleQuote - syn region shDerefPSRleft contained start='[^"']' skip=@\%(\\\\\)*\\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPSRright + syn region shDerefPSRleft contained start='[^"']' skip=@\%(\\\\\)*\\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPSRright syn region shDerefPSRright contained start='.' skip=@\%(\\\\\)\+@ end='\ze}' endif @@ -546,8 +549,9 @@ endif " Additional ksh Keywords and Aliases: {{{1 " =================================== -if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix") - syn keyword shStatement bg builtin disown enum export false fg getconf getopts hist jobs let printf sleep true typeset unalias unset whence +if exists("b:is_kornshell") || exists("b:is_posix") + syn keyword shStatement bg builtin disown enum export false fg getconf getopts hist jobs let printf sleep true unalias whence + syn keyword shStatement typeset skipwhite nextgroup=shSetOption syn keyword shStatement autoload compound fc float functions hash history integer nameref nohup r redirect source stop suspend times type if exists("b:is_posix") syn keyword shStatement command @@ -557,12 +561,13 @@ if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix") " Additional bash Keywords: {{{1 " ===================== - if exists("b:is_bash") -" syn keyword shStatement bind builtin dirs disown enable help logout popd pushd shopt source -syn keyword shStatement bind builtin caller compopt declare dirs disown enable export help local logout mapfile popd pushd readarray shopt source typeset unset - else - syn keyword shStatement login newgrp - endif +elseif exists("b:is_bash") + syn keyword shStatement bg builtin disown export false fg getopts jobs let printf sleep true unalias + syn keyword shStatement typeset nextgroup=shSetOption + syn keyword shStatement fc hash history source suspend times type + syn keyword shStatement bind builtin caller compopt declare dirs disown enable export help logout mapfile popd pushd readarray shopt source typeset +else + syn keyword shStatement login newgrp endif " Synchronization: {{{1 diff --git a/runtime/syntax/tex.vim b/runtime/syntax/tex.vim index 18c3a04877..3969cd4777 100644 --- a/runtime/syntax/tex.vim +++ b/runtime/syntax/tex.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: TeX " Maintainer: Charles E. Campbell -" Last Change: Sep 09, 2018 -" Version: 110 +" Last Change: Nov 02, 2018 +" Version: 111 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX " " Notes: {{{1 @@ -159,9 +159,9 @@ syn cluster texFoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,tex syn cluster texBoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texBoldStyle,texBoldItalStyle,texNoSpell syn cluster texItalGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texItalStyle,texItalBoldStyle,texNoSpell if !s:tex_nospell - syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,@Spell - syn cluster texMatchNMGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcherNM,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,@Spell - syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texStyleStatement,@Spell,texStyleMatcher + syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texBoldStyle,texBoldItalStyle,texItalStyle,texItalBoldStyle,texZone,texInputFile,texOption,@Spell + syn cluster texMatchNMGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcherNM,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texBoldStyle,texBoldItalStyle,texItalStyle,texItalBoldStyle,texZone,texInputFile,texOption,@Spell + syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texBoldStyle,texBoldItalStyle,texItalStyle,texItalBoldStyle,texZone,texInputFile,texOption,texStyleStatement,texStyleMatcher,@Spell else syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption syn cluster texMatchNMGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcherNM,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 444b6d8d17..31e81c76f8 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -273,7 +273,7 @@ syn match vimEnvvar "\${\I\i*}" syn region vimEscapeBrace oneline contained transparent start="[^\\]\(\\\\\)*\[\zs\^\=\]\=" skip="\\\\\|\\\]" end="]"me=e-1 syn match vimPatSepErr contained "\\)" syn match vimPatSep contained "\\|" -syn region vimPatSepZone oneline contained matchgroup=vimPatSepZ start="\\%\=\ze(" skip="\\\\" end="\\)\|[^\]['"]" contains=@vimStringGroup +syn region vimPatSepZone oneline contained matchgroup=vimPatSepZ start="\\%\=\ze(" skip="\\\\" end="\\)\|[^\\]['"]" contains=@vimStringGroup syn region vimPatRegion contained transparent matchgroup=vimPatSepR start="\\[z%]\=(" end="\\)" contains=@vimSubstList oneline syn match vimNotPatSep contained "\\\\" syn cluster vimStringGroup contains=vimEscapeBrace,vimPatSep,vimNotPatSep,vimPatSepErr,vimPatSepZone,@Spell -- cgit From c8f34a9a3efa6e260e97c9c064f7e6cb8a099aa9 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 29 Jul 2019 02:37:38 +0200 Subject: vim-patch:d47d52232bf2 Update runtime files. https://github.com/vim/vim/commit/d47d52232bf21036c5c89081458be7eaf2630d24 --- runtime/autoload/xmlformat.vim | 16 +++++---- runtime/doc/digraph.txt | 13 +++++--- runtime/doc/eval.txt | 9 +++-- runtime/ftplugin/xml.vim | 8 ++--- runtime/indent/cs.vim | 74 +++++++++++++++++++++++++++++++++++++----- runtime/indent/html.vim | 17 +++++----- runtime/indent/tcl.vim | 50 +++++++++++++++++++++------- runtime/indent/testdir/html.in | 26 +++++++++++++++ runtime/indent/testdir/html.ok | 26 +++++++++++++++ runtime/indent/testdir/tcl.in | 19 +++++++++++ runtime/indent/testdir/tcl.ok | 19 +++++++++++ runtime/indent/testdir/xml.in | 32 ++++++++++++++++++ runtime/indent/testdir/xml.ok | 32 ++++++++++++++++++ runtime/mswin.vim | 4 +-- runtime/syntax/apache.vim | 4 +-- runtime/syntax/cs.vim | 39 ++++++++++++---------- runtime/syntax/tasm.vim | 4 +-- 17 files changed, 322 insertions(+), 70 deletions(-) create mode 100644 runtime/indent/testdir/html.in create mode 100644 runtime/indent/testdir/html.ok create mode 100644 runtime/indent/testdir/tcl.in create mode 100644 runtime/indent/testdir/tcl.ok create mode 100644 runtime/indent/testdir/xml.in create mode 100644 runtime/indent/testdir/xml.ok diff --git a/runtime/autoload/xmlformat.vim b/runtime/autoload/xmlformat.vim index f227b5ee25..ea89401977 100644 --- a/runtime/autoload/xmlformat.vim +++ b/runtime/autoload/xmlformat.vim @@ -1,9 +1,9 @@ " Vim plugin for formatting XML -" Last Change: Thu, 22 May 2018 21:26:55 +0100 -" Version: 0.1 -" Author: Christian Brabandt -" Repository: https://github.com/chrisbra/vim-xml-ftplugin -" License: VIM License +" Last Change: Thu, 07 Dec 2018 +" Version: 0.1 +" Author: Christian Brabandt +" Repository: https://github.com/chrisbra/vim-xml-ftplugin +" License: VIM License " Documentation: see :h xmlformat.txt (TODO!) " --------------------------------------------------------------------- " Load Once: {{{1 @@ -85,7 +85,11 @@ func! s:Trim(item) endfunc " Check if tag is a new opening tag {{{1 func! s:StartTag(tag) - return a:tag =~? '^\s*<[^/?]' + let is_comment = s:IsComment(a:tag) + return a:tag =~? '^\s*<[^/?]' && !is_comment +endfunc +func! s:IsComment(tag) + return a:tag =~? ' + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/runtime/indent/testdir/xml.ok b/runtime/indent/testdir/xml.ok new file mode 100644 index 0000000000..a8e2c92a16 --- /dev/null +++ b/runtime/indent/testdir/xml.ok @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/runtime/mswin.vim b/runtime/mswin.vim index 5ec21491fe..2b04c1aea3 100644 --- a/runtime/mswin.vim +++ b/runtime/mswin.vim @@ -1,9 +1,9 @@ " Set options and add mapping such that Vim behaves a lot like MS-Windows " " Maintainer: Bram Moolenaar -" Last change: 2017 Oct 28 +" Last Change: 2018 Dec 07 -" bail out if this isn't wanted (mrsvim.vim uses this). +" Bail out if this isn't wanted. if exists("g:skip_loading_mswin") && g:skip_loading_mswin finish endif diff --git a/runtime/syntax/apache.vim b/runtime/syntax/apache.vim index e2315db0d7..71babfba36 100644 --- a/runtime/syntax/apache.vim +++ b/runtime/syntax/apache.vim @@ -3,7 +3,7 @@ " Maintainer: David Necas (Yeti) " License: This file can be redistribued and/or modified under the same terms " as Vim itself. -" Last Change: 2014-03-04 +" Last Change: 2018-12-06 " Notes: Last synced with apache-2.2.3, version 1.x is no longer supported " TODO: see particular FIXME's scattered through the file " make it really linewise? @@ -159,7 +159,7 @@ syn keyword apacheOption inherit syn keyword apacheDeclaration BrowserMatch BrowserMatchNoCase SetEnvIf SetEnvIfNoCase syn keyword apacheDeclaration LoadFile LoadModule syn keyword apacheDeclaration CheckSpelling CheckCaseOnly -syn keyword apacheDeclaration SSLCACertificateFile SSLCACertificatePath SSLCADNRequestFile SSLCADNRequestPath SSLCARevocationFile SSLCARevocationPath SSLCertificateChainFile SSLCertificateFile SSLCertificateKeyFile SSLCipherSuite SSLCryptoDevice SSLEngine SSLHonorCipherOrder SSLMutex SSLOptions SSLPassPhraseDialog SSLProtocol SSLProxyCACertificateFile SSLProxyCACertificatePath SSLProxyCARevocationFile SSLProxyCARevocationPath SSLProxyCipherSuite SSLProxyEngine SSLProxyMachineCertificateFile SSLProxyMachineCertificatePath SSLProxyProtocol SSLProxyVerify SSLProxyVerifyDepth SSLRandomSeed SSLRequire SSLRequireSSL SSLSessionCache SSLSessionCacheTimeout SSLUserName SSLVerifyClient SSLVerifyDepth +syn keyword apacheDeclaration SSLCACertificateFile SSLCACertificatePath SSLCADNRequestFile SSLCADNRequestPath SSLCARevocationFile SSLCARevocationPath SSLCertificateChainFile SSLCertificateFile SSLCertificateKeyFile SSLCipherSuite SSLCompression SSLCryptoDevice SSLEngine SSLFIPS SSLHonorCipherOrder SSLInsecureRenegotiation SSLMutex SSLOptions SSLPassPhraseDialog SSLProtocol SSLProxyCACertificateFile SSLProxyCACertificatePath SSLProxyCARevocationFile SSLProxyCARevocationPath SSLProxyCheckPeerCN SSLProxyCheckPeerExpire SSLProxyCipherSuite SSLProxyEngine SSLProxyMachineCertificateChainFile SSLProxyMachineCertificateFile SSLProxyMachineCertificatePath SSLProxyProtocol SSLProxyVerify SSLProxyVerifyDepth SSLRandomSeed SSLRenegBufferSize SSLRequire SSLRequireSSL SSLSessionCache SSLSessionCacheTimeout SSLSessionTicketKeyFile SSLSessionTickets SSLStrictSNIVHostCheck SSLUserName SSLVerifyClient SSLVerifyDepth syn match apacheOption "[+-]\?\<\(StdEnvVars\|CompatEnvVars\|ExportCertData\|FakeBasicAuth\|StrictRequire\|OptRenegotiate\)\>" syn keyword apacheOption builtin sem syn match apacheOption "\(file\|exec\|egd\|dbm\|shm\):" diff --git a/runtime/syntax/cs.vim b/runtime/syntax/cs.vim index 116afe0b72..1652cb63c3 100644 --- a/runtime/syntax/cs.vim +++ b/runtime/syntax/cs.vim @@ -3,7 +3,7 @@ " Maintainer: Nick Jensen " Former Maintainers: Anduin Withers " Johannes Zellner -" Last Change: 2018-06-29 +" Last Change: 2018-11-26 " Filenames: *.cs " License: Vim (see :h license) " Repository: https://github.com/nickspoons/vim-cs @@ -11,12 +11,12 @@ " REFERENCES: " [1] ECMA TC39: C# Language Specification (WD13Oct01.doc) -if exists("b:current_syntax") - finish +if exists('b:current_syntax') + finish endif -let s:cs_cpo_save = &cpo -set cpo&vim +let s:save_cpo = &cpoptions +set cpoptions&vim syn keyword csType bool byte char decimal double float int long object sbyte short string T uint ulong ushort var void dynamic @@ -34,7 +34,7 @@ syn keyword csException try catch finally throw when syn keyword csLinq ascending by descending equals from group in into join let on orderby select where syn keyword csAsync async await -syn keyword csUnspecifiedStatement as base checked event fixed in is lock nameof operator out params ref sizeof stackalloc this typeof unchecked unsafe using +syn keyword csUnspecifiedStatement as base checked event fixed in is lock nameof operator out params ref sizeof stackalloc this unchecked unsafe using syn keyword csUnsupportedStatement add remove value syn keyword csUnspecifiedKeyword explicit implicit @@ -44,10 +44,16 @@ syn match csContextualStatement /\[^:]\+:/me=s+5 +" Operators +syn keyword csTypeOf typeof contained +syn region csTypeOfStatement start="typeof(" end=")" contains=csType, csTypeOf + " Punctuation syn match csBraces "[{}\[\]]" display syn match csParens "[()]" display -syn match csOpSymbols "[+\-><=]\{1,2}" display +syn match csOpSymbols "[+\-=]\{1,2}" display +syn match csOpSymbols "[><]\{2}" display +syn match csOpSymbols "\s\zs[><]\ze\_s" display syn match csOpSymbols "[!><+\-*/]=" display syn match csOpSymbols "[!*/^]" display syn match csOpSymbols "=>" display @@ -144,17 +150,18 @@ syn cluster csAll contains=csCharacter,csClassType,csComment,csContextualStateme " The default highlighting. hi def link csType Type -hi def link csNewType Type hi def link csClassType Type hi def link csIsType Type -hi def link csStorage StorageClass -hi def link csClass StorageClass +hi def link csStorage Structure +hi def link csClass Structure hi def link csRepeat Repeat hi def link csConditional Conditional hi def link csLabel Label hi def link csModifier StorageClass hi def link csConstant Constant hi def link csException Exception +hi def link csTypeOf Operator +hi def link csTypeOfStatement Typedef hi def link csUnspecifiedStatement Statement hi def link csUnsupportedStatement Statement hi def link csUnspecifiedKeyword Keyword @@ -164,16 +171,12 @@ hi def link csIsAs Keyword hi def link csAsync Keyword hi def link csContextualStatement Statement hi def link csOperatorError Error -hi def link csInterfaceDeclaration Include hi def link csTodo Todo hi def link csComment Comment -hi def link csEndColon Statement hi def link csOpSymbols Operator -hi def link csLogicSymbols Boolean -hi def link csBraces Function -hi def link csParens Operator +hi def link csLogicSymbols Operator hi def link csSpecialError Error hi def link csSpecialCharError Error @@ -200,9 +203,9 @@ hi def link csXmlCommentLeader Comment hi def link csXmlComment Comment hi def link csXmlTag Statement -let b:current_syntax = "cs" +let b:current_syntax = 'cs' -let &cpo = s:cs_cpo_save -unlet s:cs_cpo_save +let &cpoptions = s:save_cpo +unlet s:save_cpo " vim: vts=16,28 diff --git a/runtime/syntax/tasm.vim b/runtime/syntax/tasm.vim index c9fc8186d0..1d6e570752 100644 --- a/runtime/syntax/tasm.vim +++ b/runtime/syntax/tasm.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: TASM: turbo assembler by Borland " Maintaner: FooLman of United Force -" Last Change: 2012 Feb 03 by Thilo Six +" Last Change: 2012 Feb 03 by Thilo Six, and 2018 Nov 27. " quit when a syntax file was already loaded if exists("b:current_syntax") @@ -109,7 +109,7 @@ hi def link tasmComment Comment hi def link tasmLabel Label -let b:curret_syntax = "tasm" +let b:current_syntax = "tasm" let &cpo = s:cpo_save unlet s:cpo_save -- cgit From aa680f6acb84b876584cbe5c958d50c692154c75 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 29 Jul 2019 02:42:51 +0200 Subject: vim-patch:9d87a37ee9d8 Update runtime files. https://github.com/vim/vim/commit/9d87a37ee9d87f5bdbc779bc940d5f1e6f055d0a --- runtime/doc/change.txt | 6 +- runtime/doc/eval.txt | 2 +- runtime/doc/help.txt | 21 +++-- runtime/doc/map.txt | 20 +++-- runtime/doc/repeat.txt | 5 +- runtime/doc/syntax.txt | 47 +++++----- runtime/doc/usr_41.txt | 2 +- runtime/indent/falcon.vim | 2 +- runtime/indent/matlab.vim | 187 ++++++++++++++++++++++++--------------- runtime/indent/testdir/matlab.in | 63 +++++++++++++ runtime/indent/testdir/matlab.ok | 63 +++++++++++++ runtime/indent/testdir/tcl.in | 2 +- runtime/indent/testdir/tcl.ok | 20 ++--- runtime/indent/testdir/xml.in | 2 +- runtime/indent/testdir/xml.ok | 40 ++++----- runtime/indent/xml.vim | 116 ++++++++++++++++-------- runtime/syntax/abap.vim | 13 ++- 17 files changed, 416 insertions(+), 195 deletions(-) diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index 13af2b05ce..ee70e95ab2 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -886,9 +886,9 @@ When the result is a |List| then the items are joined with separating line breaks. Thus each item becomes a line, except that they can contain line breaks themselves. -The whole matched text can be accessed with "submatch(0)". The text matched -with the first pair of () with "submatch(1)". Likewise for further -sub-matches in (). +The |submatch()| function can be used to obtain matched text. The whole +matched text can be accessed with "submatch(0)". The text matched with the +first pair of () with "submatch(1)". Likewise for further sub-matches in (). Be careful: The separation character must not appear in the expression! Consider using a character like "@" or ":". There is no problem if the result diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index d72b845ecd..95aa4647d9 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -4698,7 +4698,7 @@ gettagstack([{nr}]) *gettagstack()* getwinpos([{timeout}]) *getwinpos()* The result is a list with two numbers, the result of - getwinposx() and getwinposy() combined: + getwinposx() and getwinposy() combined: [x-pos, y-pos] {timeout} can be used to specify how long to wait in msec for a response from the terminal. When omitted 100 msec is used. diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt index 7fcf08e2a1..a2e1962ce5 100644 --- a/runtime/doc/help.txt +++ b/runtime/doc/help.txt @@ -106,7 +106,6 @@ Basic editing ~ |scroll.txt| scrolling the text in the window |insert.txt| Insert and Replace mode |change.txt| deleting and replacing text -|indent.txt| automatic indenting for C and other languages |undo.txt| Undo and Redo |repeat.txt| repeating commands, Vim scripts and debugging |visual.txt| using the Visual mode (selecting a text area) @@ -119,30 +118,36 @@ Advanced editing ~ |pattern.txt| regexp patterns and search commands |map.txt| key mapping and abbreviations |tagsrch.txt| tags and special searches -|quickfix.txt| commands for a quick edit-compile-fix cycle |windows.txt| commands for using multiple windows and buffers |tabpage.txt| commands for using multiple tab pages -|syntax.txt| syntax highlighting |spell.txt| spell checking |diff.txt| working with two to four versions of the same file |autocmd.txt| automatically executing commands on an event -|filetype.txt| settings done specifically for a type of file |eval.txt| expression evaluation, conditional commands |fold.txt| hide (fold) ranges of lines Special issues ~ |print.txt| printing |remote.txt| using Vim as a server or client + +Programming language support ~ +|indent.txt| automatic indenting for C and other languages +|syntax.txt| syntax highlighting +|textprop.txt| Attaching properties to text for highlighting or other +|filetype.txt| settings done specifically for a type of file +|quickfix.txt| commands for a quick edit-compile-fix cycle +|ft_ada.txt| Ada (the programming language) support +|ft_rust.txt| Filetype plugin for Rust +|ft_sql.txt| about the SQL filetype plugin + +Language support ~ |digraph.txt| list of available digraphs |mbyte.txt| multi-byte text support |mlang.txt| non-English language support +|rileft.txt| right-to-left editing mode |arabic.txt| Arabic language support and editing |hebrew.txt| Hebrew language support and editing |russian.txt| Russian language support and editing -|ft_ada.txt| Ada (the programming language) support -|ft_rust.txt| Filetype plugin for Rust -|ft_sql.txt| about the SQL filetype plugin -|rileft.txt| right-to-left editing mode GUI ~ |gui.txt| Graphical User Interface (GUI) diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 74c9a2a003..53b9f36ba0 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1190,7 +1190,7 @@ reported if any are supplied). However, it is possible to specify that the command can take arguments, using the -nargs attribute. Valid cases are: -nargs=0 No arguments are allowed (the default) - -nargs=1 Exactly one argument is required, it includes spaces + -nargs=1 Exactly one argument is required, it includes spaces -nargs=* Any number of arguments are allowed (0, 1, or many), separated by white space -nargs=? 0 or 1 arguments are allowed @@ -1213,8 +1213,9 @@ defined, not where it is invoked! Example: Executing script2.vim will result in "None" being echoed. Not what you intended! Calling a function may be an alternative. -Completion behavior *:command-completion* *E179* - *E180* *E181* *:command-complete* + Completion behavior ~ + *:command-completion* *E179* *E180* *E181* + *:command-complete* By default, the arguments of user defined commands do not undergo completion. However, by specifying one or the other of the following attributes, argument completion can be enabled: @@ -1335,12 +1336,13 @@ which by default correspond to the current line, last line and the whole buffer, relate to arguments, (loaded) buffers, windows or tab pages. Possible values are: - -addr=lines Range of lines (this is the default) - -addr=arguments Range for arguments - -addr=buffers Range for buffers (also not loaded buffers) - -addr=loaded_buffers Range for loaded buffers - -addr=windows Range for windows - -addr=tabs Range for tab pages + -addr=lines Range of lines (this is the default) + -addr=arguments Range for arguments + -addr=buffers Range for buffers (also not loaded buffers) + -addr=loaded_buffers Range for loaded buffers + -addr=windows Range for windows + -addr=tabs Range for tab pages + -addr=other other kind of range Special cases *:command-bang* *:command-bar* diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index 0a552a1309..d4eb3f0f6e 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -306,7 +306,10 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. ||. :scr[iptnames][!] {scriptId} *:script* - Edit script {scriptId}. Suggested name is ":script". + Edit script {scriptId}. Although ":scriptnames name" + works, using ":script name" is recommended. + When the current buffer can't be |abandon|ed and the ! + is not present, the command fails. *:fini* *:finish* *E168* :fini[sh] Stop sourcing a script. Can only be used in a Vim diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index ae119f6fdd..b710829d40 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -346,20 +346,9 @@ Upon loading a file, Vim finds the relevant syntax file as follows: syntax. ============================================================================== -4. Syntax file remarks *:syn-file-remarks* +4. Conversion to HTML *2html.vim* *convert-to-HTML* - *b:current_syntax-variable* -Vim stores the name of the syntax that has been loaded in the -"b:current_syntax" variable. You can use this if you want to load other -settings, depending on which syntax is active. Example: > - :au BufReadPost * if b:current_syntax == "csh" - :au BufReadPost * do-some-things - :au BufReadPost * endif - - -2HTML *2html.vim* *convert-to-HTML* - -This is not a syntax file itself, but a script that converts the current +2html is not a syntax file itself, but a script that converts the current window into HTML. Vim opens a new window in which it builds the HTML file. After you save the resulting file, you can view it with any browser. The @@ -751,6 +740,18 @@ When 1, generate XHTML 1.0 instead (XML compliant HTML). > :let g:html_use_xhtml = 1 < +============================================================================== +5. Syntax file remarks *:syn-file-remarks* + + *b:current_syntax-variable* +Vim stores the name of the syntax that has been loaded in the +"b:current_syntax" variable. You can use this if you want to load other +settings, depending on which syntax is active. Example: > + :au BufReadPost * if b:current_syntax == "csh" + :au BufReadPost * do-some-things + :au BufReadPost * endif + + ABEL *abel.vim* *ft-abel-syntax* @@ -3440,7 +3441,7 @@ The syntax script for zsh allows for syntax-based folding: > :let g:zsh_fold_enable = 1 ============================================================================== -5. Defining a syntax *:syn-define* *E410* +6. Defining a syntax *:syn-define* *E410* Vim understands three types of syntax items: @@ -3799,7 +3800,7 @@ DEFINING REGIONS *:syn-region* *:syn-start* *:syn-skip* *:syn-end* The maximum number of syntax groups is 19999. ============================================================================== -6. :syntax arguments *:syn-arguments* +7. :syntax arguments *:syn-arguments* The :syntax commands that define syntax items take a number of arguments. The common ones are explained here. The arguments may be given in any order @@ -4120,7 +4121,7 @@ IMPLICIT CONCEAL *:syn-conceal-implicit* Show either "syntax conceal on" or "syntax conceal off" (translated). ============================================================================== -7. Syntax patterns *:syn-pattern* *E401* *E402* +8. Syntax patterns *:syn-pattern* *E401* *E402* In the syntax commands, a pattern must be surrounded by two identical characters. This is like it works for the ":s" command. The most common to @@ -4298,7 +4299,7 @@ Note that only matches within a single line can be used. Multi-line matches cannot be referred to. ============================================================================== -8. Syntax clusters *:syn-cluster* *E400* +9. Syntax clusters *:syn-cluster* *E400* :sy[ntax] cluster {cluster-name} [contains={group-name}..] [add={group-name}..] @@ -4344,7 +4345,7 @@ This also has implications for nested clusters: > The maximum number of clusters is 9767. ============================================================================== -9. Including syntax files *:syn-include* *E397* +10. Including syntax files *:syn-include* *E397* It is often useful for one language's syntax file to include a syntax file for a related language. Depending on the exact relationship, this can be done in @@ -4385,7 +4386,7 @@ two different ways: The maximum number of includes is 999. ============================================================================== -10. Synchronizing *:syn-sync* *E403* *E404* +11. Synchronizing *:syn-sync* *E403* *E404* Vim wants to be able to start redrawing in any position in the document. To make this possible it needs to know the syntax state at the position where @@ -4577,7 +4578,7 @@ You can clear specific sync patterns with: > :syntax sync clear {sync-group-name} .. ============================================================================== -11. Listing syntax items *:syntax* *:sy* *:syn* *:syn-list* +12. Listing syntax items *:syntax* *:sy* *:syn* *:syn-list* This command lists all the syntax items: > @@ -5090,7 +5091,7 @@ Without the "default" in the C syntax file, the highlighting would be overruled when the syntax file is loaded. ============================================================================== -14. Cleaning up *:syn-clear* *E391* +15. Cleaning up *:syn-clear* *E391* If you want to clear the syntax stuff for the current buffer, you can use this command: > @@ -5180,7 +5181,7 @@ syntax/syncolor.vim files are loaded: them. ============================================================================== -15. Highlighting tags *tag-highlight* +16. Highlighting tags *tag-highlight* If you want to highlight all the tags in your file, you can use the following mappings. @@ -5215,7 +5216,7 @@ And put these lines in your vimrc: > autocmd BufRead,BufNewFile *.[ch] endif ============================================================================== -16. Window-local syntax *:ownsyntax* +17. Window-local syntax *:ownsyntax* Normally all windows on a buffer share the same syntax settings. It is possible, however, to set a particular window on a file to have its own diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 360932126f..eb50dc421a 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -995,7 +995,7 @@ Various: *various-functions* py3eval() evaluate Python expression (|+python3|) pyeval() evaluate Python expression (|+python|) pyxeval() evaluate |python_x| expression - debugbreak() interrupt a program being debugged + debugbreak() interrupt a program being debugged ============================================================================== *41.7* Defining a function diff --git a/runtime/indent/falcon.vim b/runtime/indent/falcon.vim index b34e7cfd47..664ad61aa5 100644 --- a/runtime/indent/falcon.vim +++ b/runtime/indent/falcon.vim @@ -368,7 +368,7 @@ function FalconGetIndent(...) return indent('.') endif else - call cursor(clnum, vcol) + call cursor(clnum, 0) " FIXME: column was vcol end endif diff --git a/runtime/indent/matlab.vim b/runtime/indent/matlab.vim index 6a31624389..d2818a18ea 100644 --- a/runtime/indent/matlab.vim +++ b/runtime/indent/matlab.vim @@ -1,74 +1,121 @@ -" Matlab indent file -" Language: Matlab -" Maintainer: Christophe Poucet -" Last Change: 6 January, 2001 - -" Only load this indent file when no other was loaded. -if exists("b:did_indent") - finish -endif +" Vim indent file +" Language: MATLAB +" Maintainer: Axel Forsman +" Previous maintainer: Christophe Poucet + +" Only load if no other indent file is loaded +if exists('b:did_indent') | finish | endif let b:did_indent = 1 -" Some preliminary setting -setlocal indentkeys=!,o,O=end,=case,=else,=elseif,=otherwise,=catch - - -setlocal indentexpr=GetMatlabIndent(v:lnum) - -" Only define the function once. -if exists("*GetMatlabIndent") - finish -endif - -function GetMatlabIndent(lnum) - " Give up if this line is explicitly joined. - if getline(a:lnum - 1) =~ '\\$' - return -1 - endif - - " Search backwards for the first non-empty line. - let plnum = a:lnum - 1 - while plnum > 0 && getline(plnum) =~ '^\s*$' - let plnum = plnum - 1 - endwhile - - if plnum == 0 - " This is the first non-empty line, use zero indent. - return 0 - endif - - let curind = indent(plnum) - - " If the current line is a stop-block statement... - if getline(v:lnum) =~ '^\s*\(end\|else\|elseif\|case\|otherwise\|catch\)\>' - " See if this line does not follow the line right after an openblock - if getline(plnum) =~ '^\s*\(for\|if\|else\|elseif\|case\|while\|switch\|try\|otherwise\|catch\)\>' - " See if the user has already dedented - elseif indent(v:lnum) > curind - shiftwidth() - " If not, recommend one dedent - let curind = curind - shiftwidth() - else - " Otherwise, trust the user - return -1 - endif -" endif - - " If the previous line opened a block - elseif getline(plnum) =~ '^\s*\(for\|if\|else\|elseif\|case\|while\|switch\|try\|otherwise\|catch\)\>' - " See if the user has already indented - if indent(v:lnum) < curind + shiftwidth() - "If not, recommend indent - let curind = curind + shiftwidth() - else - " Otherwise, trust the user - return -1 - endif - endif - - - - " If we got to here, it means that the user takes the standardversion, so we return it - return curind +setlocal indentexpr=GetMatlabIndent() +setlocal indentkeys=!,o,O,e,0=end,0=elseif,0=case,0=otherwise,0=catch,0=function,0=elsei + +" The value of the Function indenting format in +" MATLAB Editor/Debugger Language Preferences. +" The possible values are 0 for Classic, 1 for Indent nested functions +" and 2 for Indent all functions (default). +let b:MATLAB_function_indent = get(g:, 'MATLAB_function_indent', 2) +" The previous value of b:changedtick +let b:MATLAB_lasttick = -1 +" The previously indented line +let b:MATLAB_lastline = -1 +" Whether the line above was a line continuation +let b:MATLAB_waslc = 0 +let b:MATLAB_bracketlevel = 0 + +" Only define the function once +if exists("*GetMatlabIndent") | finish | endif + +let s:keepcpo = &cpo +set cpo&vim + +let s:end = '\\%([^(]*)\)\@!' " Array indexing heuristic +let s:open_pat = 'for\|if\|parfor\|spmd\|switch\|try\|while\|classdef\|properties\|methods\|events\|enumeration' +let s:dedent_pat = '\C^\s*\zs\<\%(end\|else\|elseif\|catch\|\(case\|otherwise\|function\)\)\>' +let s:start_pat = '\C\<\%(function\|' . s:open_pat . '\)\>' +let s:bracket_pair_pat = '\(\[\|{\)\|\(\]\|}\)' +let s:zflag = has('patch-7.4.984') ? 'z' : '' + +" Returns whether a comment or string envelops the specified column. +function! s:IsCommentOrString(lnum, col) + return synIDattr(synID(a:lnum, a:col, 1), "name") =~# 'matlabComment\|matlabMultilineComment\|matlabString' +endfunction + +" Returns whether the specified line continues on the next line. +function! s:IsLineContinuation(lnum) + let l = getline(a:lnum) | let c = -3 + while 1 + let c = match(l, '\.\{3}', c + 3) + if c == -1 | return 0 + elseif !s:IsCommentOrString(a:lnum, c) | return 1 | endif + endwhile +endfunction + +function! s:SubmatchCount(lnum, pattern, ...) + let endcol = a:0 >= 1 ? a:1 : 1 / 0 | let x = [0, 0, 0, 0] + call cursor(a:lnum, 1) + while 1 + let [lnum, c, submatch] = searchpos(a:pattern, 'cpe' . s:zflag, a:lnum) + if !submatch || c >= endcol | break | endif + if !s:IsCommentOrString(lnum, c) | let x[submatch - 2] += 1 | endif + if cursor(0, c + 1) == -1 || col('.') == c | break | endif + endwhile + return x +endfunction + +function! s:GetOpenCloseCount(lnum, pattern, ...) + let counts = call('s:SubmatchCount', [a:lnum, a:pattern] + a:000) + return counts[0] - counts[1] +endfunction + +function! GetMatlabIndent() + let prevlnum = prevnonblank(v:lnum - 1) + + if b:MATLAB_lasttick != b:changedtick || b:MATLAB_lastline != prevlnum + " Recalculate bracket count (only have to check same block and line above) + let b:MATLAB_bracketlevel = 0 + let previndent = indent(prevlnum) | let l = prevlnum + while 1 + let l = prevnonblank(l - 1) | let indent = indent(l) + if l <= 0 || previndent < indent | break | endif + let b:MATLAB_bracketlevel += s:GetOpenCloseCount(l, s:bracket_pair_pat) + if previndent != indent | break | endif + endwhile + + let b:MATLAB_waslc = s:IsLineContinuation(prevlnum - 1) + endif + " If line above was blank it can impossibly have been a LC + let above_lc = b:MATLAB_lasttick == b:changedtick && prevlnum != v:lnum - 1 && b:MATLAB_lastline == prevlnum ? 0 : s:IsLineContinuation(v:lnum - 1) + + let pair_pat = '\C\<\(' . s:open_pat . '\|' + \ . (b:MATLAB_function_indent == 1 ? '^\@= 1 ? 'function\|' : '') + \ . '\|\%(^\s*\)\@<=\%(else\|elseif\|case\|otherwise\|catch\)\)\>' + \ . '\|\S\s*\zs\(' . s:end . '\)' + let [open, close, b_open, b_close] = prevlnum ? s:SubmatchCount(prevlnum, + \ pair_pat . '\|' . s:bracket_pair_pat) : [0, 0, 0, 0] + let curbracketlevel = b:MATLAB_bracketlevel + b_open - b_close + + call cursor(v:lnum, 1) + let submatch = search(s:dedent_pat, 'cp' . s:zflag, v:lnum) + if submatch && !s:IsCommentOrString(v:lnum, col('.')) + " Align end, et cetera with start of block + let [lnum, col] = searchpairpos(s:start_pat, '', '\C' . s:end, 'bW', 's:IsCommentOrString(line("."), col("."))') + let result = lnum ? indent(lnum) + shiftwidth() * (s:GetOpenCloseCount(lnum, pair_pat, col) + submatch == 2) : 0 + else + " Count how many blocks the previous line opens/closes + " Line continuations/brackets indent once per statement + let result = indent(prevlnum) + shiftwidth() * (open - close + \ + (b:MATLAB_bracketlevel ? -!curbracketlevel : !!curbracketlevel) + \ + (curbracketlevel <= 0) * (above_lc - b:MATLAB_waslc)) + endif + + let b:MATLAB_waslc = above_lc + let b:MATLAB_bracketlevel = curbracketlevel + let b:MATLAB_lasttick = b:changedtick + let b:MATLAB_lastline = v:lnum + return result endfunction -" vim:sw=2 +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/indent/testdir/matlab.in b/runtime/indent/testdir/matlab.in index 1a2bc83d4b..5bba1a56dd 100644 --- a/runtime/indent/testdir/matlab.in +++ b/runtime/indent/testdir/matlab.in @@ -15,3 +15,66 @@ catch exception statements end % END_INDENT + +% START_INDENT +if true, ... +if true +disp hello +end +end +% END_INDENT + +% START_INDENT +switch a +case expr +if true, foo; end +disp hello +otherwise +disp bar +end +% END_INDENT + +% START_INDENT +if true +A(1:end - 1) +disp foo +end +% END_INDENT + +% START_INDENT +A = [{ +} +] ... +disp foo +disp bar +% END_INDENT + +% START_INDENT +% INDENT_EXE let b:MATLAB_function_indent = 0 +function foo +disp foo +function nested +disp bar +end +end +% END_INDENT + +% START_INDENT +% INDENT_EXE let b:MATLAB_function_indent = 1 +function foo +disp foo +function nested +disp bar +end +end +% END_INDENT + +% START_INDENT +% INDENT_EXE let b:MATLAB_function_indent = 2 +function foo +disp foo +function nested +disp bar +end +end +% END_INDENT diff --git a/runtime/indent/testdir/matlab.ok b/runtime/indent/testdir/matlab.ok index 88e1d86b06..b1112263b2 100644 --- a/runtime/indent/testdir/matlab.ok +++ b/runtime/indent/testdir/matlab.ok @@ -15,3 +15,66 @@ catch exception statements end % END_INDENT + +% START_INDENT +if true, ... + if true + disp hello + end +end +% END_INDENT + +% START_INDENT +switch a + case expr + if true, foo; end + disp hello + otherwise + disp bar +end +% END_INDENT + +% START_INDENT +if true + A(1:end - 1) + disp foo +end +% END_INDENT + +% START_INDENT +A = [{ + } + ] ... + disp foo +disp bar +% END_INDENT + +% START_INDENT +% INDENT_EXE let b:MATLAB_function_indent = 0 +function foo +disp foo + function nested + disp bar + end +end +% END_INDENT + +% START_INDENT +% INDENT_EXE let b:MATLAB_function_indent = 1 +function foo +disp foo + function nested + disp bar + end +end +% END_INDENT + +% START_INDENT +% INDENT_EXE let b:MATLAB_function_indent = 2 +function foo + disp foo + function nested + disp bar + end +end +% END_INDENT diff --git a/runtime/indent/testdir/tcl.in b/runtime/indent/testdir/tcl.in index 3ef4ebc0a8..c769d5bf5e 100644 --- a/runtime/indent/testdir/tcl.in +++ b/runtime/indent/testdir/tcl.in @@ -1,4 +1,4 @@ -# vim: set filetype=tcl shiftwidth=4 tabstop=4: +# vim: set filetype=tcl shiftwidth=4 tabstop=8 expandtab : # START_INDENT proc abc {} { diff --git a/runtime/indent/testdir/tcl.ok b/runtime/indent/testdir/tcl.ok index 0fb52e782f..77f24e9044 100644 --- a/runtime/indent/testdir/tcl.ok +++ b/runtime/indent/testdir/tcl.ok @@ -1,19 +1,19 @@ -# vim: set filetype=tcl shiftwidth=4 tabstop=4: +# vim: set filetype=tcl shiftwidth=4 tabstop=8 expandtab : # START_INDENT proc abc {} { - set a 5 - if {[some_cmd]==1} { - foreach i [list {1 2 3}] { - # Does this comment affect anything? - puts $i - } - } + set a 5 + if {[some_cmd]==1} { + foreach i [list {1 2 3}] { + # Does this comment affect anything? + puts $i + } + } } command_with_a_long_time -arg1 "First" \ - -arg2 "Second" \ - -arg3 "Third" + -arg2 "Second" \ + -arg3 "Third" puts "Move indent back after line continuation is complete" # END_INDENT diff --git a/runtime/indent/testdir/xml.in b/runtime/indent/testdir/xml.in index d184681c86..b6333340e2 100644 --- a/runtime/indent/testdir/xml.in +++ b/runtime/indent/testdir/xml.in @@ -1,4 +1,4 @@ - + diff --git a/runtime/indent/testdir/xml.ok b/runtime/indent/testdir/xml.ok index a8e2c92a16..529198572a 100644 --- a/runtime/indent/testdir/xml.ok +++ b/runtime/indent/testdir/xml.ok @@ -1,32 +1,32 @@ - + - - - - - - + + + + + + - - - + + + - - - - - - + + + + + + diff --git a/runtime/indent/xml.vim b/runtime/indent/xml.vim index 7afcc89b7f..bc64aacfe1 100644 --- a/runtime/indent/xml.vim +++ b/runtime/indent/xml.vim @@ -1,15 +1,21 @@ -" Language: xml -" Repository: https://github.com/chrisbra/vim-xml-ftplugin -" Maintainer: Christian Brabandt -" Previous Maintainer: Johannes Zellner -" Last Change: 20181022 - Do not overwrite indentkeys setting -" https://github.com/chrisbra/vim-xml-ftplugin/issues/1 -" 20180724 - Correctly indent xml comments https://github.com/vim/vim/issues/3200 -" Notes: 1) does not indent pure non-xml code (e.g. embedded scripts) -" 2) will be confused by unbalanced tags in comments -" or CDATA sections. -" 2009-05-26 patch by Nikolai Weibull -" TODO: implement pre-like tags, see xml_indent_open / xml_indent_close +" Language: xml +" Repository: https://github.com/chrisbra/vim-xml-ftplugin +" Last Changed: Dec 07th, 2018 +" Maintainer: Christian Brabandt +" Previous Maintainer: Johannes Zellner +" Last Change: +" 20181116 - Fix indentation when tags start with a colon or an underscore +" https://github.com/vim/vim/pull/926 +" 20181022 - Do not overwrite indentkeys setting +" https://github.com/chrisbra/vim-xml-ftplugin/issues/1 +" 20180724 - Correctly indent xml comments https://github.com/vim/vim/issues/3200 +" +" Notes: +" 1) does not indent pure non-xml code (e.g. embedded scripts) +" 2) will be confused by unbalanced tags in comments +" or CDATA sections. +" 2009-05-26 patch by Nikolai Weibull +" TODO: implement pre-like tags, see xml_indent_open / xml_indent_close " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -20,11 +26,12 @@ let s:keepcpo= &cpo set cpo&vim " [-- local settings (must come before aborting the script) --] +" Attention: Parameter use_syntax_check is used by the docbk.vim indent script setlocal indentexpr=XmlIndentGet(v:lnum,1) setlocal indentkeys=o,O,*,<>>,<<>,/,{,},!^F if !exists('b:xml_indent_open') - let b:xml_indent_open = '.\{-}<\a' + let b:xml_indent_open = '.\{-}<[:A-Z_a-z]' " pre tag, e.g.
" let b:xml_indent_open = '.\{-}<[/]\@!\(address\)\@!' endif @@ -40,7 +47,7 @@ unlet s:keepcpo " [-- finish, if the function already exists --] if exists('*XmlIndentGet') - finish + finish endif let s:keepcpo= &cpo @@ -53,13 +60,13 @@ endfun " [-- check if it's xml --] fun! XmlIndentSynCheck(lnum) - if '' != &syntax - let syn1 = synIDattr(synID(a:lnum, 1, 1), 'name') - let syn2 = synIDattr(synID(a:lnum, strlen(getline(a:lnum)) - 1, 1), 'name') - if '' != syn1 && syn1 !~ 'xml' && '' != syn2 && syn2 !~ 'xml' - " don't indent pure non-xml code - return 0 - endif + if &syntax != '' + let syn1 = synIDattr(synID(a:lnum, 1, 1), 'name') + let syn2 = synIDattr(synID(a:lnum, strlen(getline(a:lnum)) - 1, 1), 'name') + if syn1 != '' && syn1 !~ 'xml' && syn2 != '' && syn2 !~ 'xml' + " don't indent pure non-xml code + return 0 + endif endif return 1 endfun @@ -68,41 +75,72 @@ endfun fun! XmlIndentSum(lnum, style, add) let line = getline(a:lnum) if a:style == match(line, '^\s*XmlIndentWithPattern(line, b:xml_indent_open) - \ - XmlIndentWithPattern(line, b:xml_indent_close) - \ - XmlIndentWithPattern(line, '.\{-}/>'))) + a:add + return (shiftwidth() * + \ (XmlIndentWithPattern(line, b:xml_indent_open) + \ - XmlIndentWithPattern(line, b:xml_indent_close) + \ - XmlIndentWithPattern(line, '.\{-}/>'))) + a:add else - return a:add + return a:add endif endfun +" Main indent function fun! XmlIndentGet(lnum, use_syntax_check) " Find a non-empty line above the current line. - let lnum = prevnonblank(a:lnum - 1) + let plnum = prevnonblank(a:lnum - 1) + " Find previous line with a tag (regardless whether open or closed) + let ptag = search('.\{-}<[/:A-Z_a-z]', 'bnw') " Hit the start of the file, use zero indent. - if lnum == 0 - return 0 + if plnum == 0 + return 0 endif + let syn_name = '' if a:use_syntax_check - let check_lnum = XmlIndentSynCheck(lnum) - let check_alnum = XmlIndentSynCheck(a:lnum) - if 0 == check_lnum || 0 == check_alnum - return indent(a:lnum) - elseif -1 == check_lnum || -1 == check_alnum - return -1 - endif + let check_lnum = XmlIndentSynCheck(plnum) + let check_alnum = XmlIndentSynCheck(a:lnum) + if check_lnum == 0 || check_alnum == 0 + return indent(a:lnum) + endif + let syn_name = synIDattr(synID(a:lnum, strlen(getline(a:lnum)) - 1, 1), 'name') endif - let ind = XmlIndentSum(lnum, -1, indent(lnum)) - let ind = XmlIndentSum(a:lnum, 0, ind) + if syn_name =~ 'Comment' + return XmlIndentComment(a:lnum) + endif + " Get indent from previous tag line + let ind = XmlIndentSum(ptag, -1, indent(ptag)) + " Determine indent from current line + let ind = XmlIndentSum(a:lnum, 0, ind) return ind endfun +" return indent for a commented line, +" the middle part might be indented on additional level +func! XmlIndentComment(lnum) + let ptagopen = search(b:xml_indent_open, 'bnw') + let ptagclose = search(b:xml_indent_close, 'bnw') + if getline(a:lnum) =~ '' + " end of comment, same as start of comment + return indent(search('