diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index 9c320df274..e8ca9ba7a0 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -961,9 +961,9 @@ inside of strings can change! Also see 'softtabstop' option. > 5. Copying and moving text *copy-move* *quote* -"{a-zA-Z0-9.%#:-"} Use register {a-zA-Z0-9.%#:-"} for next delete, yank - or put (use uppercase character to append with - delete and yank) ({.%#:} only work with put). +"{register} Use {register} for next delete, yank or put. Use + an uppercase character to append with delete and yank. + Registers ".", "%", "#" and ":" only work with put. *:reg* *:registers* :reg[isters] Display the type and contents of all numbered and diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index 110a4a1b46..10fcd69c28 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -577,6 +577,7 @@ followed by another Vim command: :read ! :scscope :sign + :terminal :vglobal :windo :write ! diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index c14af9001c..5470aab2b7 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2641,7 +2641,7 @@ arglistid([{winnr} [, {tabnr}]]) {winnr} can be the window number or the |window-ID|. *argv()* -argv([{nr} [, {winid}]) +argv([{nr} [, {winid}]]) The result is the {nr}th file in the argument list. See |arglist|. "argv(0)" is the first one. Example: > :let i = 0 diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index 367227b68f..cc8545862f 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -235,8 +235,7 @@ tag char note action in Normal mode ~ 2 filter Nmove text through the {filter} command |!!| !!{filter} 2 filter N lines through the {filter} command -|quote| "{a-zA-Z0-9.%#:-"} use register {a-zA-Z0-9.%#:-"} for next - delete, yank or put (uppercase to append) +|quote| "{register} use {register} for next delete, yank or put ({.%#:} only work with put) |#| # 1 search backward for the Nth occurrence of the ident under the cursor diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 9815ba4ce5..452dc3cc66 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1417,7 +1417,7 @@ The valid escape sequences are (See the '-bang' attribute) Expands to a ! if the command was executed with a ! modifier, otherwise expands to nothing. - ** + ** *:command-modifiers* The command modifiers, if specified. Otherwise, expands to nothing. Supported modifiers are |:aboveleft|, |:belowright|, |:botright|, |:browse|, |:confirm|, |:hide|, |:keepalt|, diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index d8d2ad5ae7..d38691a59e 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -153,7 +153,7 @@ q Stops recording. [addr] (default is current line). :[addr]@ *:@@* -:[addr]@@ Repeat the previous :@{0-9a-z"}. First set cursor at +:[addr]@@ Repeat the previous :@{register}. First set cursor at line [addr] (default is current line). ============================================================================== diff --git a/runtime/doc/usr_08.txt b/runtime/doc/usr_08.txt index 559ca6f1ef..8e69307a94 100644 --- a/runtime/doc/usr_08.txt +++ b/runtime/doc/usr_08.txt @@ -401,7 +401,7 @@ Another way to start in diff mode can be done from inside Vim. Edit the "main.c" file, then make a split and show the differences: > :edit main.c - :vertical diffsplit main.c~ + :vertical diffsplit main.c~ The ":vertical" command is used to make the window split vertically. If you omit this, you will get a horizontal split. diff --git a/runtime/doc/usr_10.txt b/runtime/doc/usr_10.txt index c47fc1d886..5365f90314 100644 --- a/runtime/doc/usr_10.txt +++ b/runtime/doc/usr_10.txt @@ -687,7 +687,7 @@ with any motion command, with text objects and in Visual mode. lowercase. This can be shortened to "guu". "gUgU" is shortened to "gUU" and "g~g~" to "g~~". Example: > - g~~ + g~~ < Some GIRLS have Fun ----> sOME girls HAVE fUN ~ ============================================================================== diff --git a/runtime/syntax/debchangelog.vim b/runtime/syntax/debchangelog.vim index 8d282da445..7321e90b30 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: 2020 Feb 02 +" Last Change: 2020 Apr 27 " URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debchangelog.vim " Standard syntax initialization @@ -24,7 +24,7 @@ let s:supported = [ \ 'wheezy', 'jessie', 'stretch', 'buster', 'bullseye', 'bookworm', \ 'sid', 'rc-buggy', \ - \ 'trusty', 'xenial', 'bionic', 'eoan', 'focal', 'devel' + \ 'trusty', 'xenial', 'bionic', 'eoan', 'focal', 'groovy', 'devel' \ ] let s:unsupported = [ \ 'frozen', 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato', diff --git a/runtime/syntax/debsources.vim b/runtime/syntax/debsources.vim index e97d3274ba..b594443119 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: 2020 Feb 02 +" Last Change: 2020 Apr 27 " URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debsources.vim " Standard syntax initialization @@ -26,7 +26,7 @@ let s:supported = [ \ 'wheezy', 'jessie', 'stretch', 'buster', 'bullseye', 'bookworm', \ 'sid', 'rc-buggy', \ - \ 'trusty', 'xenial', 'bionic', 'eoan', 'focal', 'devel' + \ 'trusty', 'xenial', 'bionic', 'eoan', 'focal', 'groovy', 'devel' \ ] let s:unsupported = [ \ 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato', diff --git a/runtime/syntax/lex.vim b/runtime/syntax/lex.vim index 9e0b307d68..dff70eb3b7 100644 --- a/runtime/syntax/lex.vim +++ b/runtime/syntax/lex.vim @@ -1,22 +1,19 @@ " Vim syntax file -" Language: Lex +" Language: Lex and Flex " Maintainer: Charles E. Campbell -" Last Change: Aug 31, 2016 -" Version: 17 -" URL: http://mysite.verizon.net/astronaut/vim/index.html#SYNTAX_LEX -" -" Option: -" lex_uses_cpp : if this variable exists, then C++ is loaded rather than C +" Contributor: Robert A. van Engelen +" Last Change: Apr 24, 2020 +" Version: 18 " quit when a syntax file was already loaded if exists("b:current_syntax") finish endif -" Read the C/C++ syntax to start with -let s:Cpath= fnameescape(expand(":p:h").(exists("g:lex_uses_cpp")? "/cpp.vim" : "/c.vim")) +" Read the C++ syntax to start with +let s:Cpath= fnameescape(expand(":p:h")."/cpp.vim") if !filereadable(s:Cpath) - for s:Cpath in split(globpath(&rtp,(exists("g:lex_uses_cpp")? "syntax/cpp.vim" : "syntax/c.vim")),"\n") + for s:Cpath in split(globpath(&rtp,"syntax/cpp.vim"),"\n") if filereadable(fnameescape(s:Cpath)) let s:Cpath= fnameescape(s:Cpath) break @@ -29,115 +26,163 @@ exe "syn include @lexCcode ".s:Cpath " --- Lex stuff --- " --- ========= --- -" Options Section -syn match lexOptions '^%\s*option\>.*$' contains=lexPatString +" Definitions +" %% +" Rules +" %% +" User Code +" +" --- ======= --- +" --- Example --- +" --- ======= --- +" +" // this is a valid lex file +" // indented initial code block +" #include +" %{ +" // initial code block +" #include +" const char *sep = ""; +" %} +" %option outfile="scanner.c" noyywrap nodefault +" %x COMMENT +" id [A-Za-z_][A-Za-z0-9_]* +" %% +" // indented initial action code block +" printf("BEGIN"); +" {id} printf("%s%s", sep, yytext); sep = ""; +" . | +" \n { sep = "\n"; } +" "/*" { BEGIN COMMENT; } +" "//".* { } +" { +" "*/" { BEGIN INITIAL; } +" .|\n +" } +" <*><> { // end of file +" printf("\nEND\n"); +" yyterminate(); +" } +" %% +" void scan() +" { +" while (yylex()) +" continue; +" } +" /* main program */ +" int main() +" { +" scan(); +" } -" Abbreviations Section +" Definitions Section with initial code blocks, abbreviations, options, states if has("folding") - syn region lexAbbrvBlock fold start="^\(\h\+\s\|%{\)" end="^\ze%%$" skipnl nextgroup=lexPatBlock contains=lexAbbrv,lexInclude,lexAbbrvComment,lexStartState + syn region lexAbbrvBlock fold start="^\S" end="^\ze%%" skipnl nextgroup=lexPatBlock contains=lexOptions,lexAbbrv,lexInitialCodeBlock,lexInclude,lexAbbrvComment,lexStartState else - syn region lexAbbrvBlock start="^\(\h\+\s\|%{\)" end="^\ze%%$" skipnl nextgroup=lexPatBlock contains=lexAbbrv,lexInclude,lexAbbrvComment,lexStartState + syn region lexAbbrvBlock start="^\S" end="^\ze%%" skipnl nextgroup=lexPatBlock contains=lexOptions,lexAbbrv,lexInitialCodeBlock,lexInclude,lexAbbrvComment,lexStartState endif -syn match lexAbbrv "^\I\i*\s"me=e-1 skipwhite contained nextgroup=lexAbbrvRegExp -syn match lexAbbrv "^%[sx]" contained -syn match lexAbbrvRegExp "\s\S.*$"lc=1 contained nextgroup=lexAbbrv,lexInclude +syn match lexOptions "^%\a\+\(\s.*\|[^{]*\)$" contains=lexOptionsEq,lexPatString,lexSlashQuote,lexBrace,lexSlashBrace +syn match lexOptionsEq "=" skipwhite contained +syn match lexAbbrv "^\I\i*\s"me=e-1 skipwhite contained nextgroup=lexAbbrvPat +syn match lexAbbrvPat "\s\S.*$"lc=1 contained contains=lexPatAbbrv,lexPatString,lexSlashQuote,lexBrace,lexSlashBrace nextgroup=lexAbbrv,lexInclude +syn match lexStartState "^%\(xs\?\|s\)\(t\(a\(t\(e\?\)\?\)\?\)\?\)\?\(\s\+\I\i*\)\+\s*$" contained contains=lexStartStateCmd +syn match lexStartStateCmd '^%\(xs\?\|s\)\(t\(a\(t\(e\?\)\?\)\?\)\?\)\?' contained if has("folding") - syn region lexInclude fold matchgroup=lexSep start="^%{" end="%}" contained contains=@lexCcode - syn region lexAbbrvComment fold start="^\s\+/\*" end="\*/" contains=@Spell - syn region lexAbbrvComment fold start="\%^/\*" end="\*/" contains=@Spell - syn region lexStartState fold matchgroup=lexAbbrv start="^%\a\+" end="$" contained + syn region lexInitialCodeBlock fold start="^\s\+" end="^\S"me=e-1 contains=@lexCcode + syn region lexInclude fold matchgroup=lexSep start="^%\a*{" end="^%\?}" contained contains=@lexCcode,lexCFunctions + syn region lexAbbrvComment fold start="^\s*//" end="$" contains=@Spell + syn region lexAbbrvComment fold start="^\s*/\*" end="\*/" contains=@Spell else - syn region lexInclude matchgroup=lexSep start="^%{" end="%}" contained contains=@lexCcode - syn region lexAbbrvComment start="^\s\+/\*" end="\*/" contains=@Spell - syn region lexAbbrvComment start="\%^/\*" end="\*/" contains=@Spell - syn region lexStartState matchgroup=lexAbbrv start="^%\a\+" end="$" contained + syn region lexInitialCodeBlock start="^\s\+" end="^\S"me=e-1 contains=@lexCcode + syn region lexInclude matchgroup=lexSep start="^%\a*{" end="^%\?}" contained contains=@lexCcode,lexCFunctions + syn region lexAbbrvComment start="^\s*//" end="$" contains=@Spell + syn region lexAbbrvComment start="^\s*/\*" end="\*/" contains=@Spell endif -"%% : Patterns {Actions} +" Rules Section with patterns and actions if has("folding") - syn region lexPatBlock fold matchgroup=Todo start="^%%$" matchgroup=Todo end="^%\ze%$" skipnl skipwhite nextgroup=lexFinalCodeBlock contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatInclude - syn region lexPat fold start=+\S+ skip="\\\\\|\\." end="\s"me=e-1 skipwhite contained nextgroup=lexMorePat,lexPatSep,lexPattern contains=lexPatTag,lexPatString,lexSlashQuote,lexBrace - syn region lexPatInclude fold matchgroup=lexSep start="^%{" end="%}" contained contains=lexPatCode - syn region lexBrace fold start="\[" skip=+\\\\\|\\+ end="]" contained - syn region lexPatString fold matchgroup=String start=+"+ skip=+\\\\\|\\"+ matchgroup=String end=+"+ contained + syn region lexPatBlock fold matchgroup=Todo start="^%%" matchgroup=Todo end="^\ze%%" skipnl skipwhite nextgroup=lexFinalCodeBlock contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatSep,lexPatInclude + syn region lexPat fold start="\S" skip="\\\\\|\\\s" end="\ze\(\s*$\|\s\+\(\h\|{\W\|{$\|[-+*]\|//\|/\*\)\)" skipwhite contained nextgroup=lexMorePat,lexPatSep,lexPatEnd contains=lexPatTag,lexPatString,lexSlashQuote,lexPatAbbrv,lexBrace,lexSlashBrace + syn region lexPatInclude fold matchgroup=lexSep start="^%{" end="^%}" contained contains=@lexCcode + syn region lexBrace fold matchgroup=Character start="\[" skip="\\.\|\[:\a\+:\]\|\[\.\a\+\.\]\|\[=.=\]" end="\]" contained + syn region lexPatString fold matchgroup=String start=+"+ skip=+\\\\\|\\"+ matchgroup=String end=+"+ contained else - syn region lexPatBlock matchgroup=Todo start="^%%$" matchgroup=Todo end="^%%$" skipnl skipwhite nextgroup=lexFinalCodeBlock contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatInclude - syn region lexPat start=+\S+ skip="\\\\\|\\." end="\s"me=e-1 skipwhite contained nextgroup=lexMorePat,lexPatSep,lexPattern contains=lexPatTag,lexPatString,lexSlashQuote,lexBrace - syn region lexPatInclude matchgroup=lexSep start="^%{" end="%}" contained contains=lexPatCode - syn region lexBrace start="\[" skip=+\\\\\|\\+ end="]" contained - syn region lexPatString matchgroup=String start=+"+ skip=+\\\\\|\\"+ matchgroup=String end=+"+ contained + syn region lexPatBlock matchgroup=Todo start="^%%" matchgroup=Todo end="^\ze%%" skipnl skipwhite nextgroup=lexFinalCodeBlock contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatSep,lexPatInclude + syn region lexPat start="\S" skip="\\\\\|\\\s" end="\ze\(\s*$\|\s\+\(\h\|{\W\|{$\|[-+*]\|//\|/\*\)\)" skipwhite contained nextgroup=lexMorePat,lexPatSep,lexPatEnd contains=lexPatTag,lexPatString,lexSlashQuote,lexPatAbbrv,lexBrace,lexSlashBrace + syn region lexPatInclude matchgroup=lexSep start="^%{" end="^%}" contained contains=@lexCcode + syn region lexBrace matchgroup=Character start="\[" skip="\\.\|\[:\a\+:\]\|\[\.\a\+\.\]\|\[=.=\]" end="\]" contained + syn region lexPatString matchgroup=String start=+"+ skip=+\\\\\|\\"+ matchgroup=String end=+"+ contained endif -syn match lexPatTag "^<\I\i*\(,\I\i*\)*>" contained nextgroup=lexPat,lexPatTag,lexMorePat,lexPatSep -syn match lexPatTagZone "^<\I\i*\(,\I\i*\)*>\s\+\ze{" contained nextgroup=lexPatTagZoneStart -syn match lexPatTag +^<\I\i*\(,\I\i*\)*>*\(\\\\\)*\\"+ contained nextgroup=lexPat,lexPatTag,lexMorePat,lexPatSep - -" Lex Patterns -syn region lexPattern start='[^ \t{}]' end="$" contained contains=lexPatRange -syn region lexPatRange matchgroup=Delimiter start='\[' skip='\\\\\|\\.' end='\]' contains=lexEscape -syn match lexEscape '\%(\\\\\)*\\.' contained +syn match lexPatAbbrv "{\I\i*}"hs=s+1,he=e-1 contained +syn match lexPatTag "^<\^\?\(\I\i*\|\*\)\(,\^\?\(\I\i*\|\*\)\)*>" contained nextgroup=lexPat,lexMorePat,lexPatSep,lexPatEnd +syn match lexPatTagZone "^<\^\?\(\I\i*\|\*\)\(,\^\?\(\I\i*\|\*\)\)*>\s*{$"me=e-1 contained nextgroup=lexPatTagZoneStart if has("folding") - syn region lexPatTagZoneStart matchgroup=lexPatTag fold start='{' end='}' contained contains=lexPat,lexPatComment - syn region lexPatComment start="\s\+/\*" end="\*/" fold skipnl contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell + syn region lexPatTagZoneStart fold matchgroup=lexPatTag start='{$' end='^}' skipnl skipwhite contained contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatSep,lexPatInclude + syn region lexPatComment fold start="//" end="$" skipnl contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell + syn region lexPatComment fold start="/\*" end="\*/" skipnl contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell else - syn region lexPatTagZoneStart matchgroup=lexPatTag start='{' end='}' contained contains=lexPat,lexPatComment - syn region lexPatComment start="\s\+/\*" end="\*/" skipnl contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell + syn region lexPatTagZoneStart matchgroup=lexPatTag start='{' end='^}' skipnl skipwhitecontained contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatSep,lexPatInclude + syn region lexPatComment start="//" end="$" skipnl contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell + syn region lexPatComment start="/\*" end="\*/" skipnl contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell endif -syn match lexPatCodeLine "[^{\[].*" contained contains=@lexCcode -syn match lexMorePat "\s*|\s*$" skipnl contained nextgroup=lexPat,lexPatTag,lexPatComment -syn match lexPatSep "\s\+" contained nextgroup=lexMorePat,lexPatCode,lexPatCodeLine +syn match lexPatEnd "\s*$" skipnl contained +syn match lexPatCodeLine "[^{\[].*" contained contains=@lexCcode,lexCFunctions +syn match lexMorePat "\s*|\s*$" skipnl contained nextgroup=lexPat,lexPatTag,lexPatComment +syn match lexPatSep "\s\+" contained nextgroup=lexMorePat,lexPatCode,lexPatCodeLine syn match lexSlashQuote +\(\\\\\)*\\"+ contained +syn match lexSlashBrace +\(\\\\\)*\\\[+ contained if has("folding") - syn region lexPatCode matchgroup=Delimiter start="{" end="}" fold skipnl contained contains=@lexCcode,lexCFunctions + syn region lexPatCode fold matchgroup=Delimiter start="{" end="}" skipnl contained contains=@lexCcode,lexCFunctions else - syn region lexPatCode matchgroup=Delimiter start="{" end="}" skipnl contained contains=@lexCcode,lexCFunctions + syn region lexPatCode matchgroup=Delimiter start="{" end="}" skipnl contained contains=@lexCcode,lexCFunctions endif -" Lex "functions" which may appear in C/C++ code blocks -syn keyword lexCFunctions BEGIN input unput woutput yyleng yylook yytext -syn keyword lexCFunctions ECHO output winput wunput yyless yymore yywrap +" User Code Section with final code block +syn region lexFinalCodeBlock matchgroup=Todo start="^%%" end="\%$" contained contains=@lexCcode -" %% -" lexAbbrevBlock -" %% -" lexPatBlock -" %% -" lexFinalCodeBlock -syn region lexFinalCodeBlock matchgroup=Todo start="%$"me=e-1 end="\%$" contained contains=@lexCcode +" Lex macros which may appear in C/C++ code blocks +syn keyword lexCFunctions BEGIN ECHO REJECT yytext YYText yyleng YYLeng yymore yyless yywrap yylook +syn keyword lexCFunctions yyrestart yyterminate yylineno yycolumno yyin yyout +syn keyword lexCFunctions input unput output winput wunput woutput +syn keyword lexCFunctions yyinput yyunput yyoutput yywinput yywunput yywoutput " includes several ALLBUTs; these have to be treated so as to exclude lex* groups -syn cluster cParenGroup add=lex.* +syn cluster cParenGroup add=lex.* syn cluster cDefineGroup add=lex.* syn cluster cPreProcGroup add=lex.* -syn cluster cMultiGroup add=lex.* +syn cluster cMultiGroup add=lex.* " Synchronization syn sync clear syn sync minlines=500 syn sync match lexSyncPat grouphere lexPatBlock "^%[a-zA-Z]" syn sync match lexSyncPat groupthere lexPatBlock "^<$" -syn sync match lexSyncPat groupthere lexPatBlock "^%%$" +syn sync match lexSyncPat groupthere lexPatBlock "^%%" " The default highlighting. if !exists("skip_lex_syntax_inits") hi def link lexAbbrvComment lexPatComment - hi def link lexAbbrvRegExp Macro - hi def link lexAbbrv SpecialChar - hi def link lexBrace lexPat - hi def link lexCFunctions Function - hi def link lexCstruct cStructure - hi def link lexMorePat SpecialChar - hi def link lexOptions PreProc + hi def link lexAbbrvPat lexPat + hi def link lexAbbrv Special + hi def link lexBrace lexPat + hi def link lexCFunctions PreProc + hi def link lexMorePat Special + hi def link lexOptions PreProc + hi def link lexOptionsEq Operator hi def link lexPatComment Comment hi def link lexPat Function - hi def link lexPatString Function - hi def link lexPatTag Special + hi def link lexPatString lexPat + hi def link lexPatAbbrv Special + hi def link lexPatTag Statement hi def link lexPatTagZone lexPatTag hi def link lexSep Delimiter hi def link lexSlashQuote lexPat - hi def link lexStartState Statement + hi def link lexSlashBrace lexPat + hi def link lexStartState lexPatTag + hi def link lexStartStateCmd Special endif let b:current_syntax = "lex" -" vim:ts=10 +" vim:ts=8