diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-05-16 12:39:47 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-05-16 12:39:47 +0200 |
commit | 3ec3217f0491e9ba8aa8ea02f7e454cd19a287ef (patch) | |
tree | 06fa2c8e003d252e1a537483aa6b93885e76bca9 /runtime | |
parent | 50157ef1c2e36d8696e79fd688bdd08312196bc6 (diff) | |
download | vim-git-3ec3217f0491e9ba8aa8ea02f7e454cd19a287ef.tar.gz |
Update runtime files
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/cmdline.txt | 10 | ||||
-rw-r--r-- | runtime/doc/eval.txt | 7 | ||||
-rw-r--r-- | runtime/doc/map.txt | 18 | ||||
-rw-r--r-- | runtime/doc/options.txt | 2 | ||||
-rw-r--r-- | runtime/doc/pattern.txt | 36 | ||||
-rw-r--r-- | runtime/doc/quickfix.txt | 6 | ||||
-rw-r--r-- | runtime/doc/repeat.txt | 19 | ||||
-rw-r--r-- | runtime/doc/starting.txt | 4 | ||||
-rw-r--r-- | runtime/doc/tags | 5 | ||||
-rw-r--r-- | runtime/doc/todo.txt | 30 | ||||
-rw-r--r-- | runtime/doc/version7.txt | 4 | ||||
-rw-r--r-- | runtime/doc/version8.txt | 4 | ||||
-rw-r--r-- | runtime/ftplugin/meson.vim | 1 | ||||
-rw-r--r-- | runtime/ftplugin/systemverilog.vim | 35 | ||||
-rw-r--r-- | runtime/indent/meson.vim | 1 | ||||
-rw-r--r-- | runtime/pack/dist/opt/termdebug/plugin/termdebug.vim | 6 | ||||
-rw-r--r-- | runtime/syntax/dts.vim | 54 | ||||
-rw-r--r-- | runtime/syntax/meson.vim | 53 |
18 files changed, 226 insertions, 69 deletions
diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index 68cb04000..2cd96d018 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -1,4 +1,4 @@ -*cmdline.txt* For Vim version 8.2. Last change: 2021 Apr 05 +*cmdline.txt* For Vim version 8.2. Last change: 2021 May 08 VIM REFERENCE MANUAL by Bram Moolenaar @@ -798,18 +798,20 @@ three lines: > 3:d<CR> is translated into: .,.+2d<CR> < -Visual Mode and Range *v_:* - *:star-visual-range* +Visual Mode and Range + *v_:* {Visual}: Starts a command-line with the Visual selected lines as a range. The code `:'<,'>` is used for this range, which makes it possible to select a similar line from the command-line history for repeating a command on different Visually selected lines. + +:* *:star* *:star-visual-range* When Visual mode was already ended, a short way to use the Visual area for a range is `:*`. This requires that "*" does not appear in 'cpo', see |cpo-star|. Otherwise you will have to type `:'<,'>` - + For when "*" is in 'cpo' see |:star-compatible|. ============================================================================== 5. Ex command-line flags *ex-flags* diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 920ee10b2..890943810 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 8.2. Last change: 2021 Apr 24 +*eval.txt* For Vim version 8.2. Last change: 2021 May 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -7591,6 +7591,9 @@ matchfuzzy({list}, {str} [, {dict}]) *matchfuzzy()* empty list is returned. If length of {str} is greater than 256, then returns an empty list. + Refer to |fuzzy-match| for more information about fuzzy + matching strings. + Example: > :echo matchfuzzy(["clay", "crow"], "cay") < results in ["clay"]. > @@ -9188,6 +9191,8 @@ searchpair({start}, {middle}, {end} [, {flags} [, {skip} and -1 returned. {skip} can be a string, a lambda, a funcref or a partial. Anything else makes the function fail. + In a `:def` function when the {skip} argument is a string + constant it is compiled into instructions. For {stopline} and {timeout} see |search()|. diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 13b2c2efc..970bbc923 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1,4 +1,4 @@ -*map.txt* For Vim version 8.2. Last change: 2021 Apr 23 +*map.txt* For Vim version 8.2. Last change: 2021 May 16 VIM REFERENCE MANUAL by Bram Moolenaar @@ -389,6 +389,22 @@ Overview of which map command works in which mode. More details below. :cmap :cnoremap :cunmap Command-line :tmap :tnoremap :tunmap Terminal-Job +Same information in a table: + *map-table* + Mode | Norm | Ins | Cmd | Vis | Sel | Opr | Term | Lang | ~ +Command +------+-----+-----+-----+-----+-----+------+------+ ~ +[nore]map | yes | - | - | yes | yes | yes | - | - | +n[nore]map | yes | - | - | - | - | - | - | - | +[nore]map! | - | yes | yes | - | - | - | - | - | +i[nore]map | - | yes | - | - | - | - | - | - | +c[nore]map | - | - | yes | - | - | - | - | - | +v[nore]map | - | - | - | yes | yes | - | - | - | +x[nore]map | - | - | - | yes | - | - | - | - | +s[nore]map | - | - | - | - | yes | - | - | - | +o[nore]map | - | - | - | - | - | yes | - | - | +t[nore]map | - | - | - | - | - | - | yes | - | +l[nore]map | - | yes | yes | - | - | - | - | yes | + COMMANDS MODES ~ Normal Visual+Select Operator-pending ~ diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 9cff98da7..4fbc014d3 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 8.2. Last change: 2021 Apr 28 +*options.txt* For Vim version 8.2. Last change: 2021 May 15 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index a5b9099e3..20fed5523 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -1,4 +1,4 @@ -*pattern.txt* For Vim version 8.2. Last change: 2021 Feb 16 +*pattern.txt* For Vim version 8.2. Last change: 2021 May 02 VIM REFERENCE MANUAL by Bram Moolenaar @@ -19,6 +19,7 @@ explanations are in chapter 27 |usr_27.txt|. 8. Composing characters |patterns-composing| 9. Compare with Perl patterns |perl-patterns| 10. Highlighting matches |match-highlight| +11. Fuzzy matching |fuzzy-match| ============================================================================== 1. Search commands *search-commands* @@ -1431,5 +1432,38 @@ Finally, these constructs are unique to Perl: are suggested to use ":match" for manual matching and ":2match" for another plugin. +============================================================================== +11. Fuzzy matching *fuzzy-match* + +Fuzzy matching refers to matching strings using a non-exact search string. +Fuzzy matching will match a string, if all the characters in the search string +are present anywhere in the string in the same order. Case is ignored. In a +matched string, other characters can be present between two consecutive +characters in the search string. If the search string has multiple words, then +each word is matched separately. So the words in the search string can be +present in any order in a string. + +Fuzzy matching assigns a score for each matched string based on the following +criteria: + - The number of sequentially matching characters. + - The number of characters (distance) between two consecutive matching + characters. + - Matches at the beginning of a word + - Matches after a camel case character or a path separator or a hyphen. + - The number of unmatched characters in a string. +The matching string with the highest score is returned first. + +For example, when you search for the "get pat" string using fuzzy matching, it +will match the strings "GetPattern", "PatternGet", "getPattern", "patGetter", +"getSomePattern", "MatchpatternGet" etc. + +The functions |matchfuzzy()| and |matchfuzzypos()| can be used to fuzzy search +a string in a List of strings. The matchfuzzy() function returns a List of +matching strings. The matchfuzzypos() functions returns the List of matches, +the matching positions and the fuzzy match scores. + +The "f" flag of `:vimgrep` enables fuzzy matching. + + vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index fcade001a..f94da7d2a 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -1,4 +1,4 @@ -*quickfix.txt* For Vim version 8.2. Last change: 2021 Apr 30 +*quickfix.txt* For Vim version 8.2. Last change: 2021 May 02 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1037,8 +1037,8 @@ commands can be combined to create a NewGrep command: > matching is used to find matching lines. In this case, {pattern} is treated as a literal string instead of a regular expression. See - |matchfuzzy()| for more info about fuzzy - matching. + |fuzzy-match| for more information about fuzzy + matching strings. |QuickFixCmdPre| and |QuickFixCmdPost| are triggered. A file that is opened for matching may use a buffer diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index 71b4e10de..18149fcf8 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -1,4 +1,4 @@ -*repeat.txt* For Vim version 8.2. Last change: 2021 Feb 13 +*repeat.txt* For Vim version 8.2. Last change: 2021 May 08 VIM REFERENCE MANUAL by Bram Moolenaar @@ -59,6 +59,11 @@ of area is used, see |visual-repeat|. :[range]v[global]/{pattern}/[cmd] Same as :g!. +Example: > + :g/^Obsolete/d _ +Using the underscore after `:d` avoids clobbering registers or the clipboard. +This also makes it faster. + Instead of the '/' which surrounds the {pattern}, you can use any other single byte character, but not an alphabetic character, '\', '"' or '|'. This is useful if you want to include a '/' in the search pattern or @@ -150,15 +155,12 @@ q Stops recording. (Implementation note: The 'q' that *@@* *E748* @@ Repeat the previous @{0-9a-z":*} [count] times. -:[addr]*{0-9a-z".=+} *:@* *:star* + *:@* :[addr]@{0-9a-z".=*+} Execute the contents of register {0-9a-z".=*+} as an Ex command. First set cursor at line [addr] (default is current line). When the last line in the register does not have a <CR> it will be added automatically when the 'e' flag is present in 'cpoptions'. - Note that the ":*" command is only recognized when the - '*' flag is present in 'cpoptions'. This is NOT the - default when 'nocompatible' is used. For ":@=" the last used expression is used. The result of evaluating the expression is executed as an Ex command. @@ -171,6 +173,13 @@ q Stops recording. (Implementation note: The 'q' that Future: Will execute the register for each line in the address range. +:[addr]*{0-9a-z".=+} *:star-compatible* + When '*' is present in 'cpoptions' |cpo-star|, use + ":*" in the same way as ":@". This is NOT the default + when 'nocompatible' is used. When the '*' flag is not + present in 'cpoptions', ":*" is an alias for ":'<,'>", + select the Visual area |:star|. + *:@:* :[addr]@: Repeat last command-line. First set cursor at line [addr] (default is current line). diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index e492c89a4..469ec0ca5 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -1,4 +1,4 @@ -*starting.txt* For Vim version 8.2. Last change: 2021 Feb 10 +*starting.txt* For Vim version 8.2. Last change: 2021 May 08 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1592,7 +1592,7 @@ VIMINFO FILE NAME *viminfo-file-name* file name given is "NONE" (all uppercase), no viminfo file is ever read or written. Also not for the commands below! - The 'viminfofile' option can be used like the "-i" argument. In fact, the - value form the "-i" argument is stored in the 'viminfofile' option. + value from the "-i" argument is stored in the 'viminfofile' option. - For the commands below, another file name can be given, overriding the default and the name given with 'viminfo' or "-i" (unless it's NONE). diff --git a/runtime/doc/tags b/runtime/doc/tags index cdaa66417..dd73ba2d3 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -3184,7 +3184,8 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX* :st starting.txt /*:st* :sta windows.txt /*:sta* :stag windows.txt /*:stag* -:star repeat.txt /*:star* +:star cmdline.txt /*:star* +:star-compatible repeat.txt /*:star-compatible* :star-visual-range cmdline.txt /*:star-visual-range* :start insert.txt /*:start* :startgreplace insert.txt /*:startgreplace* @@ -6691,6 +6692,7 @@ function-range-example eval.txt /*function-range-example* function-search-undo eval.txt /*function-search-undo* function_key intro.txt /*function_key* functions eval.txt /*functions* +fuzzy-match pattern.txt /*fuzzy-match* fvwm.vim syntax.txt /*fvwm.vim* fvwm2rc syntax.txt /*fvwm2rc* fvwmrc syntax.txt /*fvwmrc* @@ -7790,6 +7792,7 @@ map-return map.txt /*map-return* map-self-destroy tips.txt /*map-self-destroy* map-space_in_lhs map.txt /*map-space_in_lhs* map-space_in_rhs map.txt /*map-space_in_rhs* +map-table map.txt /*map-table* map-typing map.txt /*map-typing* map-which-keys map.txt /*map-which-keys* map.txt map.txt /*map.txt* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 955c3f6d9..1cfb9480e 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 8.2. Last change: 2021 Apr 29 +*todo.txt* For Vim version 8.2. Last change: 2021 May 15 VIM REFERENCE MANUAL by Bram Moolenaar @@ -39,13 +39,14 @@ browser use: https://github.com/vim/vim/issues/1234 -------------------- Known bugs and current work ----------------------- Vim9 - Make everything work: -- expandcmd() with `=expr` in filename uses legacy expression. -- eval_expr() in ex_cexpr() -- eval_expr() call in dbg_parsearg() and debuggy_find() -- compile_member() guesses the type, should figure out at runtime. -- compile "skip" argument of searchpair() +- function returning nothing should return void instead of zero - compile "expr" and "call" expression of a channel in channel_exe_cmd()? -- give an error for "echo Func()" if Func() does not return anything. +- Need some solution for dict function. Can we implement part of classes? +- A lambda without {} does not require a return type, using { return x } does. + That's unexpected, since the arguments are not required to have a type. + alt 1: not require a return type, figure it out from the common type of all + the return statements found + alt 2: also require argument types - Using "windo echo expr" does not accept a line break inside "expr" (in a :def function and at script level in a not executed block). #7681 - use CheckLegacyAndVim9Success(lines) in many more places @@ -239,6 +240,10 @@ Memory leak in test_alot with pyeval() (allocating partial) Memory leak in test_alot with expand() Memory leaks in test_channel? (or is it because of fork()) +":set &shellpipe" and ":set &shellredir" should use the logic from +initialization to figure out the default value from 'shell'. Add a test for +this. + test_arglist func Test_all_not_allowed_from_cmdwin() hangs on MS-Windows. Mapping with partial match not executed properly in GTK. (Ingo Karkat, #7082) @@ -249,6 +254,9 @@ Have another look at the implementation. Patch to implement the vimtutor with a plugin: #6414 Was originally written by Felipe Morales. +Request to use "." for the cursor column in search pattern \%<.c and \%<.v. +(#8179) + Adding "10" to 'spellsuggest' causes spell suggestions to become very slow. (#4087) Did patch 8.2.2379 help? Also, z= in German on a long word can take a very long time, but CTRL-C to @@ -276,6 +284,9 @@ Missing filetype test for bashrc, PKGBUILD, etc. Add an option to not fetch terminal codes in xterm, to avoid flicker when t_Co changes. +When using ":bwipe!" also get rid of references to be buffer, e.g. in the +jumplist and alternate file. + Add an option to start_timer() to return from the input loop with K_IGNORE. This is useful e.g. when a popup was created that disables mappings, we need to return from vgetc() to make this happen. #7011 @@ -293,6 +304,9 @@ MS-Windows: when writing undo file the infostreams are copied in mch_copy_file_attribute(), that seems unnecessary. (#7925) Add a flag to only copy attributes? +Make the jumplist behave like a tag stack. (#7738) Should there be a more +time bound navigation, like with undo? + Changing a capturing group to non-capturing changes the result: #7607 :echo matchstr('aaa bbb', '\(.\{-1,}\>\)\|.*') aaa @@ -1215,7 +1229,7 @@ Undo problem: "g-" doesn't go back, gets stuck. (Björn Linse, 2016 Jul 18) Add "unicode true" to NSIS installer. Doesn't work with Windows 95, which we no longer support. -Suppoert sort(l, 'F'), convert strings to float. (#7857) +Support sort(l, 'F'), convert strings to float. (#7857) sort() is not stable when using numeric/float sort (Nikolay Pavlov, 2016 Sep 4#1038) diff --git a/runtime/doc/version7.txt b/runtime/doc/version7.txt index 8d75ed6ca..823d49df3 100644 --- a/runtime/doc/version7.txt +++ b/runtime/doc/version7.txt @@ -1,4 +1,4 @@ -*version7.txt* For Vim version 8.2. Last change: 2020 Oct 25 +*version7.txt* For Vim version 8.2. Last change: 2021 May 13 VIM REFERENCE MANUAL by Bram Moolenaar @@ -9826,7 +9826,7 @@ Solution: Add AC_SYS_LARGEFILE to configure. (James Vega) Files: src/configure.in, src/config.h.in, src/auto/configure Patch 7.2.414 -Problem: CTRK-K <space> <space> does not produce 0xa0 as expected. (Tony +Problem: CTRL-K <space> <space> does not produce 0xa0 as expected. (Tony Mechelynck) Solution: Remove the Unicode range 0xe000 - 0xefff from digraphs, these are not valid characters. diff --git a/runtime/doc/version8.txt b/runtime/doc/version8.txt index ab4b7d806..313c38827 100644 --- a/runtime/doc/version8.txt +++ b/runtime/doc/version8.txt @@ -1,4 +1,4 @@ -*version8.txt* For Vim version 8.2. Last change: 2020 Dec 24 +*version8.txt* For Vim version 8.2. Last change: 2021 May 13 VIM REFERENCE MANUAL by Bram Moolenaar @@ -15341,7 +15341,7 @@ Solution: Link winpthread statically. (jmmerz, closes #1255, closes #1256) Files: src/Make_cyg_ming.mak Patch 8.0.0116 -Problem: When reading English help and using CTRl-] the language from +Problem: When reading English help and using CTRL-] the language from 'helplang' is used. Solution: Make help tag jumps keep the language. (Tatsuki, test by Hirohito Higashi, closes #1249) diff --git a/runtime/ftplugin/meson.vim b/runtime/ftplugin/meson.vim index e432ebf19..d48fa1dfd 100644 --- a/runtime/ftplugin/meson.vim +++ b/runtime/ftplugin/meson.vim @@ -1,6 +1,7 @@ " Vim filetype plugin file " Language: meson " License: VIM License +" Maintainer: Liam Beguin <liambeguin@gmail.com> " Original Author: Laurent Pinchart <laurent.pinchart@ideasonboard.com> " Last Change: 2018 Nov 27 diff --git a/runtime/ftplugin/systemverilog.vim b/runtime/ftplugin/systemverilog.vim index 4d0f565fc..e35042702 100644 --- a/runtime/ftplugin/systemverilog.vim +++ b/runtime/ftplugin/systemverilog.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: SystemVerilog " Maintainer: kocha <kocha.lsifrontend@gmail.com> -" Last Change: 12-Aug-2013. +" Last Change: 07-May-2021 if exists("b:did_ftplugin") finish @@ -9,3 +9,36 @@ endif " Behaves just like Verilog runtime! ftplugin/verilog.vim + +let s:cpo_save = &cpo +set cpo&vim + +" Add SystemVerilog keywords for matchit plugin. +if exists("loaded_matchit") + let b:match_words = + \ '\<begin\>:\<end\>,' . + \ '\<case\>\|\<casex\>\|\<casez\>:\<endcase\>,' . + \ '\<module\>:\<endmodule\>,' . + \ '\<if\>:`\@<!\<else\>,' . + \ '\<function\>:\<endfunction\>,' . + \ '`ifn\?def\>:`elsif\>:`else\>:`endif\>,' . + \ '\<task\>:\<endtask\>,' . + \ '\<specify\>:\<endspecify\>,' . + \ '\<config\>:\<endconfig\>,' . + \ '\<generate\>:\<endgenerate\>,' . + \ '\<fork\>:\<join\>\|\<join_any\>\|\<join_none\>,' . + \ '\<primitive\>:\<endprimitive\>,' . + \ '\<table\>:\<endtable\>,' . + \ '\<checker\>:\<endchecker\>,' . + \ '\<class\>:\<endclass\>,' . + \ '\<clocking\>:\<endclocking\>,' . + \ '\<gruop\>:\<endgruop\>,' . + \ '\<interface\>:\<endinterface\>,' . + \ '\<package\>:\<endpackage\>,' . + \ '\<program\>:\<endprogram\>,' . + \ '\<property\>:\<endproperty\>,' . + \ '\<sequence\>:\<endsequence\>' +endif + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/indent/meson.vim b/runtime/indent/meson.vim index f116781f7..549209ca3 100644 --- a/runtime/indent/meson.vim +++ b/runtime/indent/meson.vim @@ -2,6 +2,7 @@ " Language: Meson " License: VIM License " Maintainer: Nirbheek Chauhan <nirbheek.chauhan@gmail.com> +" Liam Beguin <liambeguin@gmail.com> " Original Authors: David Bustos <bustos@caltech.edu> " Bram Moolenaar <Bram@vim.org> " Last Change: 2019 Oct 18 diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim index 706a94b97..117322da5 100644 --- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim +++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim @@ -2,7 +2,7 @@ " " Author: Bram Moolenaar " Copyright: Vim license applies, see ":help license" -" Last Change: 2021 Jan 03 +" Last Change: 2021 May 16 " " WORK IN PROGRESS - Only the basics work " Note: On MS-Windows you need a recent version of gdb. The one included with @@ -228,7 +228,9 @@ func s:StartDebug_term(dict) endif let s:gdbwin = win_getid(winnr()) - " Set arguments to be run + " Set arguments to be run. First wait a bit to make detecting gdb a bit + " more reliable. + sleep 200m if len(proc_args) call term_sendkeys(s:gdbbuf, 'set args ' . join(proc_args) . "\r") endif diff --git a/runtime/syntax/dts.vim b/runtime/syntax/dts.vim index cd4bd776b..d75b9c178 100644 --- a/runtime/syntax/dts.vim +++ b/runtime/syntax/dts.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: dts/dtsi (device tree files) " Maintainer: Daniel Mack <vim@zonque.org> -" Last Change: 2013 Oct 20 +" Last Change: 2021 May 15 if exists("b:current_syntax") finish @@ -9,7 +9,7 @@ endif syntax region dtsComment start="/\*" end="\*/" syntax match dtsReference "&[[:alpha:][:digit:]_]\+" -syntax region dtsBinaryProperty start="\[" end="\]" +syntax region dtsBinaryProperty start="\[" end="\]" syntax match dtsStringProperty "\".*\"" syntax match dtsKeyword "/.\{-1,\}/" syntax match dtsLabel "^[[:space:]]*[[:alpha:][:digit:]_]\+:" @@ -18,6 +18,38 @@ syntax region dtsCellProperty start="<" end=">" contains=dtsReference,dtsBinar syntax region dtsCommentInner start="/\*" end="\*/" syntax match dtsCommentLine "//.*$" +" Accept %: for # (C99) +syn region cPreCondit start="^\s*\zs\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" keepend contains=cComment,cCommentL,cCppString,cCharacter,cCppParen,cParenError,cNumbers,cCommentError,cSpaceError +syn match cPreConditMatch display "^\s*\zs\(%:\|#\)\s*\(else\|endif\)\>" +if !exists("c_no_if0") + syn cluster cCppOutInGroup contains=cCppInIf,cCppInElse,cCppInElse2,cCppOutIf,cCppOutIf2,cCppOutElse,cCppInSkip,cCppOutSkip + syn region cCppOutWrapper start="^\s*\zs\(%:\|#\)\s*if\s\+0\+\s*\($\|//\|/\*\|&\)" end=".\@=\|$" contains=cCppOutIf,cCppOutElse,@NoSpell fold + syn region cCppOutIf contained start="0\+" matchgroup=cCppOutWrapper end="^\s*\(%:\|#\)\s*endif\>" contains=cCppOutIf2,cCppOutElse + if !exists("c_no_if0_fold") + syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0\+\s*\($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell fold + else + syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0\+\s*\($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell + endif + syn region cCppOutElse contained matchgroup=cCppOutWrapper start="^\s*\(%:\|#\)\s*\(else\|elif\)" end="^\s*\(%:\|#\)\s*endif\>"me=s-1 contains=TOP,cPreCondit + syn region cCppInWrapper start="^\s*\zs\(%:\|#\)\s*if\s\+0*[1-9]\d*\s*\($\|//\|/\*\||\)" end=".\@=\|$" contains=cCppInIf,cCppInElse fold + syn region cCppInIf contained matchgroup=cCppInWrapper start="\d\+" end="^\s*\(%:\|#\)\s*endif\>" contains=TOP,cPreCondit + if !exists("c_no_if0_fold") + syn region cCppInElse contained start="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0*[1-9]\d*\s*\($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2 fold + else + syn region cCppInElse contained start="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0*[1-9]\d*\s*\($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2 + endif + syn region cCppInElse2 contained matchgroup=cCppInWrapper start="^\s*\(%:\|#\)\s*\(else\|elif\)\([^/]\|/[^/*]\)*" end="^\s*\(%:\|#\)\s*endif\>"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell + syn region cCppOutSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppOutSkip + syn region cCppInSkip contained matchgroup=cCppInWrapper start="^\s*\(%:\|#\)\s*\(if\s\+\(\d\+\s*\($\|//\|/\*\||\|&\)\)\@!\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" containedin=cCppOutElse,cCppInIf,cCppInSkip contains=TOP,cPreProc +endif +syn region cIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+ +syn match cIncluded display contained "<[^>]*>" +syn match cInclude display "^\s*\zs\(%:\|#\)\s*include\>\s*["<]" contains=cIncluded +"syn match cLineSkip "\\$" +syn cluster cPreProcGroup contains=cPreCondit,cIncluded,cInclude,cDefine,cErrInParen,cErrInBracket,cUserLabel,cSpecial,cOctalZero,cCppOutWrapper,cCppInWrapper,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cString,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cParen,cBracket,cMulti,cBadBlock +syn region cDefine start="^\s*\zs\(%:\|#\)\s*\(define\|undef\)\>" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell +syn region cPreProc start="^\s*\zs\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell + hi def link dtsCellProperty Number hi def link dtsBinaryProperty Number hi def link dtsStringProperty String @@ -26,5 +58,21 @@ hi def link dtsLabel Label hi def link dtsNode Structure hi def link dtsReference Macro hi def link dtsComment Comment -hi def link dtsCommentInner Comment +hi def link dtsCommentInner Comment hi def link dtsCommentLine Comment + +hi def link cInclude Include +hi def link cPreProc PreProc +hi def link cDefine Macro +hi def link cIncluded cString +hi def link cString String + +hi def link cCppInWrapper cCppOutWrapper +hi def link cCppOutWrapper cPreCondit +hi def link cPreConditMatch cPreCondit +hi def link cPreCondit PreCondit +hi def link cCppOutSkip cCppOutIf2 + +hi def link cCppInElse2 cCppOutIf2 +hi def link cCppOutIf2 cCppOut +hi def link cCppOut Comment diff --git a/runtime/syntax/meson.vim b/runtime/syntax/meson.vim index 78de2ab89..7e6b565f1 100644 --- a/runtime/syntax/meson.vim +++ b/runtime/syntax/meson.vim @@ -2,6 +2,7 @@ " Language: Meson " License: VIM License " Maintainer: Nirbheek Chauhan <nirbheek.chauhan@gmail.com> +" Liam Beguin <liambeguin@gmail.com> " Last Change: 2019 Oct 18 " Credits: Zvezdan Petkovic <zpetkovic@acm.org> " Neil Schemenauer <nas@meson.ca> @@ -17,11 +18,7 @@ " let meson_space_error_highlight = 1 " -" For version 5.x: Clear all syntax items. -" For version 6.x: Quit when a syntax file was already loaded. -if version < 600 - syntax clear -elseif exists("b:current_syntax") +if exists("b:current_syntax") finish endif @@ -32,8 +29,9 @@ set cpo&vim " http://mesonbuild.com/Syntax.html syn keyword mesonConditional elif else if endif -syn keyword mesonRepeat foreach endforeach -syn keyword mesonOperator and not or +syn keyword mesonRepeat foreach endforeach +syn keyword mesonOperator and not or in +syn keyword mesonStatement continue break syn match mesonComment "#.*$" contains=mesonTodo,@Spell syn keyword mesonTodo FIXME NOTE NOTES TODO XXX contained @@ -117,10 +115,12 @@ syn keyword mesonBuiltin \ subdir \ subdir_done \ subproject + \ summary \ target_machine \ test \ vcs_tag \ warning + \ range if exists("meson_space_error_highlight") " trailing whitespace @@ -130,31 +130,20 @@ if exists("meson_space_error_highlight") syn match mesonSpaceError display "\t\+ " endif -if version >= 508 || !exists("did_meson_syn_inits") - if version <= 508 - let did_meson_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default highlight links. Can be overridden later. - HiLink mesonStatement Statement - HiLink mesonConditional Conditional - HiLink mesonRepeat Repeat - HiLink mesonOperator Operator - HiLink mesonComment Comment - HiLink mesonTodo Todo - HiLink mesonString String - HiLink mesonEscape Special - HiLink mesonNumber Number - HiLink mesonBuiltin Function - HiLink mesonConstant Number - if exists("meson_space_error_highlight") - HiLink mesonSpaceError Error - endif - - delcommand HiLink +" The default highlight links. Can be overridden later. +hi def link mesonStatement Statement +hi def link mesonConditional Conditional +hi def link mesonRepeat Repeat +hi def link mesonOperator Operator +hi def link mesonComment Comment +hi def link mesonTodo Todo +hi def link mesonString String +hi def link mesonEscape Special +hi def link mesonNumber Number +hi def link mesonBuiltin Function +hi def link mesonConstant Number +if exists("meson_space_error_higlight") + hi def link mesonSpaceError Error endif let b:current_syntax = "meson" |