Merge remote-tracking branch 'vim/master'

This commit is contained in:
ichizok
2022-01-10 10:51:14 +09:00
139 changed files with 3143 additions and 1862 deletions
+13 -8
View File
@@ -1,4 +1,4 @@
*builtin.txt* For Vim version 8.2. Last change: 2021 Dec 28
*builtin.txt* For Vim version 8.2. Last change: 2022 Jan 08
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2435,7 +2435,7 @@ filter({expr1}, {expr2}) *filter()*
For each item in {expr1} evaluate {expr2} and when the result
is zero or false remove the item from the |List| or
|Dictionary|. Similarly for each byte in a |Blob| and each
charactor in a |String|.
character in a |String|.
{expr2} must be a |string| or |Funcref|.
@@ -2466,7 +2466,9 @@ filter({expr1}, {expr2}) *filter()*
return a:idx % 2 == 1
endfunc
call filter(mylist, function('Odd'))
< It is shorter when using a |lambda|: >
< It is shorter when using a |lambda|. In |Vim9| syntax: >
call filter(myList, (idx, val) => idx * val <= 42)
< In legacy script syntax: >
call filter(myList, {idx, val -> idx * val <= 42})
< If you do not use "val" you can leave it out: >
call filter(myList, {idx -> idx % 2 == 1})
@@ -2744,8 +2746,10 @@ funcref({name} [, {arglist}] [, {dict}])
function {name} is redefined later.
Unlike |function()|, {name} must be an existing user function.
Also for autoloaded functions. {name} cannot be a builtin
function.
It only works for an autoloaded function if it has already
been loaded (to avoid mistakenly loading the autoload script
when only intending to use the function name, use |function()|
instead). {name} cannot be a builtin function.
Can also be used as a |method|: >
GetFuncname()->funcref([arg])
@@ -4738,7 +4742,7 @@ js_encode({expr}) *js_encode()*
Can also be used as a |method|: >
GetObject()->js_encode()
json_decode({string}) *json_decode()*
json_decode({string}) *json_decode()* *E491*
This parses a JSON formatted string and returns the equivalent
in Vim values. See |json_encode()| for the relation between
JSON and Vim values.
@@ -5380,7 +5384,7 @@ match({expr}, {pat} [, {start} [, {count}]]) *match()*
GetText()->match('word')
GetList()->match('word')
<
*matchadd()* *E798* *E799* *E801* *E957*
*matchadd()* *E290* *E798* *E799* *E801* *E957*
matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]])
Defines a pattern to be highlighted in the current window (a
"match"). It will be highlighted with {group}. Returns an
@@ -8130,7 +8134,8 @@ sound_playfile({path} [, {callback}])
< Can also be used as a |method|: >
GetSoundPath()->sound_playfile()
< {only available when compiled with the |+sound| feature}
< There is no error *E538* , but can listen to 538.nl.
{only available when compiled with the |+sound| feature}
sound_stop({id}) *sound_stop()*
+5 -3
View File
@@ -1,4 +1,4 @@
*cmdline.txt* For Vim version 8.2. Last change: 2021 Dec 26
*cmdline.txt* For Vim version 8.2. Last change: 2022 Jan 08
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -748,7 +748,8 @@ Line numbers may be specified with: *:range* *{address}*
Each may be followed (several times) by '+' or '-' and an optional number.
This number is added or subtracted from the preceding line number. If the
number is omitted, 1 is used.
number is omitted, 1 is used. If there is nothing before the '+' or '-' then
the current line is used.
The "/" and "?" after {pattern} are required to separate the pattern from
anything that follows.
@@ -778,7 +779,7 @@ Some commands allow for a count after the command. This count is used as the
number of lines to be used, starting with the line given in the last line
specifier (the default is the cursor line). The commands that accept a count
are the ones that use a range but do not have a file name argument (because
a file name can also be a number).
a file name can also be a number). The count cannot be negative.
Examples: >
:s/x/X/g 5 substitute 'x' by 'X' in the current line and four
@@ -949,6 +950,7 @@ Note: these are typed literally, they are not special keys!
and "script {file-name}[{lnum}]" for a script line, and
".." in between items. E.g.:
"function {function-name1}[{lnum}]..{function-name2}[{lnum}]"
If there is no call stack you get error *E489* .
*:<slnum>* *<slnum>*
<slnum> When executing a ":source" command, is replaced with the
line number. *E842*
+1 -1
View File
@@ -1770,7 +1770,7 @@ There are three different types of searching:
/u/user_x/work/include
/u/user_x/include
< Note: If your 'path' setting includes an non-existing directory, Vim will
< Note: If your 'path' setting includes a non-existing directory, Vim will
skip the non-existing directory, but continues searching in the parent of
the non-existing directory if upwards searching is used. E.g. when
searching "../include" and that doesn't exist, and upward searching is
+17 -16
View File
@@ -1,4 +1,4 @@
*eval.txt* For Vim version 8.2. Last change: 2021 Dec 28
*eval.txt* For Vim version 8.2. Last change: 2022 Jan 08
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -13,9 +13,9 @@ done, the features in this document are not available. See |+eval| and
|no-eval-feature|.
This file is mainly about the backwards compatible (legacy) Vim script. For
specifics of Vim9 script, which executes much faster, supports type checking
and much more, see |vim9.txt|. Where the syntax or semantics differ a remark
is given.
specifics of Vim9 script, which can execute much faster, supports type
checking and much more, see |vim9.txt|. Where the syntax or semantics differ
a remark is given.
1. Variables |variables|
1.1 Variable types
@@ -162,8 +162,8 @@ non-empty String, then the value is considered to be TRUE.
Note that " " and "0" are also non-empty strings, thus considered to be TRUE.
A List, Dictionary or Float is not a Number or String, thus evaluate to FALSE.
*E745* *E728* *E703* *E729* *E730* *E731* *E908* *E910* *E913*
*E974* *E975* *E976*
*E611* *E745* *E728* *E703* *E729* *E730* *E731* *E908* *E910*
*E913* *E974* *E975* *E976*
|List|, |Dictionary|, |Funcref|, |Job|, |Channel| and |Blob| types are not
automatically converted.
@@ -172,7 +172,7 @@ When mixing Number and Float the Number is converted to Float. Otherwise
there is no automatic conversion of Float. You can use str2float() for String
to Float, printf() for Float to String and float2nr() for Float to Number.
*E891* *E892* *E893* *E894* *E907* *E911* *E914*
*E362* *E891* *E892* *E893* *E894* *E907* *E911* *E914*
When expecting a Float a Number can also be used, but nothing else.
*no-type-checking*
@@ -1346,7 +1346,7 @@ When expr9 is a |Funcref| type variable, invoke the function it refers to.
expr9->name([args]) method call *method* *->*
expr9->{lambda}([args])
*E276*
*E260* *E276*
For methods that are also available as global functions this is the same as: >
name(expr9 [, args])
There can also be methods specifically for the type of "expr9".
@@ -1582,7 +1582,7 @@ See below |functions|.
lambda expression *expr-lambda* *lambda*
-----------------
{args -> expr1} legacy lambda expression
{args -> expr1} legacy lambda expression *E451*
(args) => expr1 |Vim9| lambda expression
A lambda expression creates a new unnamed function which returns the result of
@@ -1659,10 +1659,10 @@ See also: |numbered-function|
3. Internal variable *internal-variables* *E461*
An internal variable name can be made up of letters, digits and '_'. But it
cannot start with a digit. In legacy script it also possible to use curly
cannot start with a digit. In legacy script it is also possible to use curly
braces, see |curly-braces-names|.
In legacy script ann internal variable is created with the ":let" command
In legacy script an internal variable is created with the ":let" command
|:let|. An internal variable is explicitly destroyed with the ":unlet"
command |:unlet|.
Using a name that is not an internal variable or refers to a variable that has
@@ -2162,7 +2162,8 @@ v:lnum Line number for the 'foldexpr' |fold-expr|, 'formatexpr' and
|sandbox|.
*v:maxcol* *maxcol-variable*
v:maxcol Maximum line length.
v:maxcol Maximum line length. Depending on where it is used it can be
screen columns, characters or bytes.
*v:mouse_win* *mouse_win-variable*
v:mouse_win Window number for a mouse click obtained with |getchar()|.
@@ -2585,7 +2586,7 @@ functions.
In |Vim9| script functions are local to the script by default, prefix "g:" to
define a global function.
*:fu* *:function* *E128* *E129* *E123*
*:fu* *:function* *E128* *E129* *E123* *E454*
:fu[nction] List all functions and their arguments.
:fu[nction] {name} List function {name}.
@@ -2711,7 +2712,7 @@ See |:verbose-cmd| for more information.
command, use line breaks instead of |:bar|: >
:exe "func Foo()\necho 'foo'\nendfunc"
<
*:delf* *:delfunction* *E130* *E131* *E933*
*:delf* *:delfunction* *E131* *E933*
:delf[unction][!] {name}
Delete function {name}.
{name} can also be a |Dictionary| entry that is a
@@ -4958,7 +4959,7 @@ When the |+eval| feature is available the command is skipped because of the
silently ignored, and the command is executed.
==============================================================================
12. The sandbox *eval-sandbox* *sandbox* *E48*
12. The sandbox *eval-sandbox* *sandbox*
The 'foldexpr', 'formatexpr', 'includeexpr', 'indentexpr', 'statusline' and
'foldtext' options may be evaluated in a sandbox. This means that you are
@@ -4966,7 +4967,7 @@ protected from these expressions having nasty side effects. This gives some
safety for when these options are set from a modeline. It is also used when
the command from a tags file is executed and for CTRL-R = in the command line.
The sandbox is also used for the |:sandbox| command.
*E48*
These items are not allowed in the sandbox:
- changing the buffer text
- defining or changing mapping, autocommands, user commands
+2 -2
View File
@@ -1,4 +1,4 @@
*helphelp.txt* For Vim version 8.2. Last change: 2021 Dec 13
*helphelp.txt* For Vim version 8.2. Last change: 2022 Jan 08
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -224,7 +224,7 @@ command: >
dialog. {only when compiled with |+GUI_GTK|}
*:helpt* *:helptags*
*E154* *E150* *E151* *E152* *E153* *E670*
*E150* *E151* *E152* *E153* *E154* *E670*
:helpt[ags] [++t] {dir}
Generate the help tags file(s) for directory {dir}.
When {dir} is ALL then all "doc" directories in
+2 -2
View File
@@ -1,4 +1,4 @@
*if_cscop.txt* For Vim version 8.2. Last change: 2019 May 05
*if_cscop.txt* For Vim version 8.2. Last change: 2022 Jan 08
VIM REFERENCE MANUAL by Andy Kahn
@@ -89,7 +89,7 @@ suggested use.)
==============================================================================
2. Cscope related commands *cscope-commands*
*:cscope* *:cs* *:scs* *:scscope* *E259* *E262* *E561* *E560*
*:cscope* *:cs* *:scs* *:scscope* *E259* *E262* *E560* *E561*
All cscope commands are accessed through suboptions to the cscope commands.
`:cscope` or `:cs` is the main command
`:scscope` or `:scs` does the same and splits the window
+1 -2
View File
@@ -1,4 +1,4 @@
*if_perl.txt* For Vim version 8.2. Last change: 2019 Dec 07
*if_perl.txt* For Vim version 8.2. Last change: 2022 Jan 08
VIM REFERENCE MANUAL by Sven Verdoolaege
@@ -104,7 +104,6 @@ Here are some things you can try: >
:perl VIM::Msg("hello")
:perl $line = $curbuf->Get(42)
<
*E299*
Executing Perl commands in the |sandbox| is limited. ":perldo" will not be
possible at all. ":perl" will be evaluated in the Safe environment, if
possible.
+2 -2
View File
@@ -1,4 +1,4 @@
*if_tcl.txt* For Vim version 8.2. Last change: 2021 May 27
*if_tcl.txt* For Vim version 8.2. Last change: 2022 Jan 08
VIM REFERENCE MANUAL by Ingo Wilken
@@ -16,9 +16,9 @@ The Tcl Interface to Vim *tcl* *Tcl* *TCL*
8. Examples |tcl-examples|
9. Dynamic loading |tcl-dynamic|
*E280*
{only available when Vim was compiled with the |+tcl| feature}
*E280*
WARNING: There are probably still some bugs. Please send bug reports,
comments, ideas etc to <Ingo.Wilken@informatik.uni-oldenburg.de>
+2 -2
View File
@@ -879,7 +879,7 @@ For example, with N = 1, this will give:
*PHP_outdentphpescape*
To indent PHP escape tags as the surrounding non-PHP code (only affects the
PHP escape tags): >
:let g:PHP_outdentphpescape = 0
:let g:PHP_outdentphpescape = 0
-------------
*PHP_removeCRwhenUnix*
@@ -1206,7 +1206,7 @@ comments will be indented according to the correctly indented code.
VIM *ft-vim-indent*
*g:vim_indent_cont*
For indenting Vim scripts there is one variable that specifies the amount of
indent for a continuation line, a line that starts with a backslash: >
+2 -2
View File
@@ -850,7 +850,7 @@ space is preferred). Maximum line length is 510 bytes.
For an example, imagine the 'thesaurus' file has a line like this: >
angry furious mad enraged
<Placing the cursor after the letters "ang" and typing CTRL-X CTRL-T would
Placing the cursor after the letters "ang" and typing CTRL-X CTRL-T would
complete the word "angry"; subsequent presses would change the word to
"furious", "mad" etc.
@@ -862,7 +862,7 @@ https://github.com/vim/vim/issues/629#issuecomment-443293282
Unpack thesaurus_pkg.zip, put the thesaurus.txt file somewhere, e.g.
~/.vim/thesaurus/english.txt, and the 'thesaurus' option to this file name.
Completing keywords with 'thesaurusfunc' *compl-thesaurusfunc*
If the 'thesaurusfunc' option is set, then the user specified function is
+3 -4
View File
@@ -1,4 +1,4 @@
*map.txt* For Vim version 8.2. Last change: 2021 Dec 24
*map.txt* For Vim version 8.2. Last change: 2022 Jan 03
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -6,7 +6,7 @@
Key mapping, abbreviations and user-defined commands.
This subject is introduced in sections |05.3|, |24.7| and |40.1| of the user
This subject is introduced in sections |05.4|, |24.7| and |40.1| of the user
manual.
1. Key mapping |key-mapping|
@@ -97,8 +97,7 @@ modes.
map command applies. The mapping may remain defined
for other modes where it applies.
It also works when {lhs} matches the {rhs} of a
mapping. This is for when when an abbreviation
applied.
mapping. This is for when an abbreviation applied.
Note: Trailing spaces are included in the {lhs}. This
unmap does NOT work: >
:map @@ foo
+3 -3
View File
@@ -1,4 +1,4 @@
*mbyte.txt* For Vim version 8.2. Last change: 2021 Oct 04
*mbyte.txt* For Vim version 8.2. Last change: 2022 Jan 08
VIM REFERENCE MANUAL by Bram Moolenaar et al.
@@ -862,8 +862,8 @@ Use the RPM or port for your system.
window specific to the input method.
USING XIM *multibyte-input* *E284* *E286* *E287* *E288*
*E285* *E289*
USING XIM *multibyte-input* *E284* *E285* *E286* *E287*
*E288* *E289*
Note that Display and Input are independent. It is possible to see your
language even though you have no input method for it. But when your Display
+8 -6
View File
@@ -1,4 +1,4 @@
*message.txt* For Vim version 8.2. Last change: 2021 Dec 13
*message.txt* For Vim version 8.2. Last change: 2022 Jan 08
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -118,7 +118,8 @@ wiped out a buffer which contains a mark or is referenced in another way.
*E95* >
Buffer with this name already exists
You cannot have two buffers with the same name.
You cannot have two buffers with exactly the same name. This includes the
path leading to the file.
*E72* >
Close error on swap file
@@ -534,10 +535,10 @@ If you type "gq", it will execute this mapping, which will call "gq" again.
*E22* >
Scripts nested too deep
Scripts can be read with the "-s" command-line argument and with the ":source"
command. The script can then again read another script. This can continue
for about 14 levels. When more nesting is done, Vim assumes that there is a
recursive loop somewhere and stops with this error message.
Scripts can be read with the "-s" command-line argument and with the
`:source!` command. The script can then again read another script. This can
continue for about 14 levels. When more nesting is done, Vim assumes that
there is a recursive loop and stops with this error message.
*E319* >
Sorry, the command is not available in this version
@@ -727,6 +728,7 @@ specified.
Trailing characters
An argument has been added to an Ex command that does not permit one.
Or the argument has invalid characters and has not been recognized.
*E477* *E478* >
No ! allowed
+8 -6
View File
@@ -1,4 +1,4 @@
*options.txt* For Vim version 8.2. Last change: 2021 Dec 26
*options.txt* For Vim version 8.2. Last change: 2022 Jan 02
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -369,7 +369,7 @@ value to the local value, it doesn't switch back to using the global value
This will make the local value of 'path' empty, so that the global value is
used. Thus it does the same as: >
:setlocal path=
Note: In the future more global options can be made global-local. Using
Note: In the future more global options can be made |global-local|. Using
":setlocal" on a global option might work differently then.
@@ -874,11 +874,11 @@ A jump table for the options with a short description can be found at |Q_op|.
global
Write the contents of the file, if it has been modified, on each
`:next`, `:rewind`, `:last`, `:first`, `:previous`, `:stop`,
`:suspend`, `:tag, `:!`, ``:make`, CTRL-] and CTRL-^ command; and when
a :buffer, CTRL-O, CTRL-I, '{A-Z0-9}, or `{A-Z0-9} command takes one
`:suspend`, `:tag`, `:!`, `:make`, CTRL-] and CTRL-^ command; and when
a `:buffer`, CTRL-O, CTRL-I, '{A-Z0-9}, or `{A-Z0-9} command takes one
to another file.
A buffer is not written if it becomes hidden, e.g. when 'bufhidden' is
set to "hide" and `:next` is used
set to "hide" and `:next` is used.
Note that for some commands the 'autowrite' option is not used, see
'autowriteall' for that.
Some buffers will not be written, specifically when 'buftype' is
@@ -6816,6 +6816,8 @@ A jump table for the options with a short description can be found at |Q_op|.
Don't include both "curdir" and "sesdir".
When neither "curdir" nor "sesdir" is included, file names are stored
with absolute paths.
If you leave out "options" many things won't work well after restoring
the session.
"slash" and "unix" are useful on Windows when sharing session files
with Unix. The Unix version of Vim cannot source dos format scripts,
but the Windows version of Vim can source unix format scripts.
@@ -8259,7 +8261,7 @@ A jump table for the options with a short description can be found at |Q_op|.
another default. Backticks cannot be used in this option for security
reasons.
*'thesaurusfunc'* *tsrfu'*
*'thesaurusfunc'* *'tsrfu'*
'thesaurusfunc' 'tsrfu' string (default: empty)
global or local to buffer |global-local|
{not available when compiled without the |+eval|
+6 -6
View File
@@ -342,12 +342,12 @@ PowerShell Execution Policy settings.
See |option-backslash| about including spaces in 'shellcmdflag' when using
multiple flags.
The 'shellpipe' and 'shellredir' option values re-encode the UTF-16le output
The 'shellpipe' and 'shellredir' option values re-encode the UTF-16LE output
from PowerShell Desktop to your currently configured console codepage. The
output can be forced into a different encoding by changing "default" to one of
the following:
unicode - UTF-16le (default output from PowerShell 5.1)
unicode - UTF-16LE (default output from PowerShell 5.1)
bigendianunicode - UTF-16
utf8 - UTF-8
utf7 - UTF-7 (no BOM)
@@ -356,7 +356,7 @@ the following:
default - System's active code page (typically ANSI)
oem - System's current OEM code page
Note The abovce multi-byte Unicode encodings include a leading BOM unless
Note The above multi-byte Unicode encodings include a leading BOM unless
otherwise indicated.
By default PowerShell Core's output is UTF-8 encoded without a BOM. If you
@@ -365,10 +365,10 @@ want to force the output of PowerShell Core into a different encoding then set
encoding is one of the following:
ascii - 7-bit ASCII character set
bigendianunicode - UTF-16be
bigendianutf32 - UTF-32be
bigendianunicode - UTF-16BE
bigendianutf32 - UTF-32BE
oem - System's current OEM code page
unicode - UTF-16le
unicode - UTF-16LE
utf7 - UTF-7
utf8 - UTF-8
utf8BOM - UTF-8, with BOM
+14 -13
View File
@@ -1,4 +1,4 @@
*pattern.txt* For Vim version 8.2. Last change: 2021 Jul 16
*pattern.txt* For Vim version 8.2. Last change: 2022 Jan 08
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -315,7 +315,7 @@ the pattern.
==============================================================================
2. The definition of a pattern *search-pattern* *pattern* *[pattern]*
*regular-expression* *regexp* *Pattern*
*E76* *E383* *E476*
*E383* *E476*
For starters, read chapter 27 of the user manual |usr_27.txt|.
@@ -929,9 +929,9 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on):
\%23l Matches in a specific line.
\%<23l Matches above a specific line (lower line number).
\%>23l Matches below a specific line (higher line number).
\%.l Matches at the cursor line.
\%<.l Matches above the cursor line.
\%>.l Matches below the cursor line.
\%.l Matches at the cursor line.
\%<.l Matches above the cursor line.
\%>.l Matches below the cursor line.
These six can be used to match specific lines in a buffer. The "23"
can be any line number. The first line is 1.
WARNING: When inserting or deleting lines Vim does not automatically
@@ -950,9 +950,9 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on):
\%23c Matches in a specific column.
\%<23c Matches before a specific column.
\%>23c Matches after a specific column.
\%.c Matches at the cursor column.
\%<.c Matches before the cursor column.
\%>.c Matches after the cursor column.
\%.c Matches at the cursor column.
\%<.c Matches before the cursor column.
\%>.c Matches after the cursor column.
These six can be used to match specific columns in a buffer or string.
The "23" can be any column number. The first column is 1. Actually,
the column is the byte number (thus it's not exactly right for
@@ -976,9 +976,9 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on):
\%23v Matches in a specific virtual column.
\%<23v Matches before a specific virtual column.
\%>23v Matches after a specific virtual column.
\%.v Matches at the current virtual column.
\%<.v Matches before the current virtual column.
\%>.v Matches after the current virtual column.
\%.v Matches at the current virtual column.
\%<.v Matches before the current virtual column.
\%>.v Matches after the current virtual column.
These six can be used to match specific virtual columns in a buffer or
string. When not matching with a buffer in a window, the option
values of the current window are used (e.g., 'tabstop').
@@ -1070,6 +1070,8 @@ match ASCII characters, as indicated by the range.
\(\) A pattern enclosed by escaped parentheses. */\(* */\(\)* */\)*
E.g., "\(^a\)" matches 'a' at the start of a line.
There can only be ten of these. You can use "\%(" to add more, but
not counting it as a sub-expression.
*E51* *E54* *E55* *E872* *E873*
\1 Matches the same string that was matched by */\1* *E65*
@@ -1092,7 +1094,7 @@ x A single character, with no special meaning, matches itself
\x A backslash followed by a single character, with no special meaning,
is reserved for future expansions
[] (with 'nomagic': \[]) */[]* */\[]* */\_[]* */collection*
[] (with 'nomagic': \[]) */[]* */\[]* */\_[]* */collection* *E76*
\_[]
A collection. This is a sequence of characters enclosed in square
brackets. It matches any single character in the collection.
@@ -1488,5 +1490,4 @@ 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:
+3 -3
View File
@@ -1,4 +1,4 @@
*popup.txt* For Vim version 8.2. Last change: 2021 Nov 29
*popup.txt* For Vim version 8.2. Last change: 2022 Jan 08
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -54,7 +54,7 @@ A popup window has a window-ID like other windows, but behaves differently.
The size can be up to the whole Vim window and it overlaps other windows.
Popup windows can also overlap each other. The "zindex" property specifies
what goes on top of what.
*E366*
The popup window contains a buffer, and that buffer is always associated with
the popup window. The window cannot be in Normal, Visual or Insert mode, it
does not get keyboard focus. You can use functions like `setbufline()` to
@@ -262,7 +262,7 @@ popup_close({id} [, {result}]) *popup_close()*
popup_create({what}, {options}) *popup_create()*
Open a popup window showing {what}, which is either:
Open a popup window showing {what}, which is either: *E450*
- a buffer number
- a string
- a list of strings
+2 -2
View File
@@ -1,4 +1,4 @@
*quickfix.txt* For Vim version 8.2. Last change: 2021 Dec 03
*quickfix.txt* For Vim version 8.2. Last change: 2022 Jan 04
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -244,7 +244,7 @@ processing a quickfix or location list command, it will be aborted.
[!] is not used. It works like ":qall!" |:qall|,
except that Vim returns a non-zero exit code.
*:cf* *:cfile*
*:cf* *:cfi* *:cfile*
:cf[ile][!] [errorfile] Read the error file and jump to the first error.
This is done automatically when Vim is started with
the -q option. You can use this command when you
+2 -1
View File
@@ -365,11 +365,12 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
Vim version, or update Vim to a newer version. See
|vimscript-version| for what changed between versions.
:vim9s[cript] [noclear] *:vim9s* *:vim9script*
:vim9s[cript] [noclear] [autoload] *:vim9s* *:vim9script*
Marks a script file as containing |Vim9-script|
commands. Also see |vim9-namespace|.
Must be the first command in the file.
For [noclear] see |vim9-reload|.
For [autoload] see |vim9-autoload|.
Without the |+eval| feature this changes the syntax
for some commands.
See |:vim9cmd| for executing one command with Vim9
+3 -1
View File
@@ -1,4 +1,4 @@
*starting.txt* For Vim version 8.2. Last change: 2021 May 08
*starting.txt* For Vim version 8.2. Last change: 2022 Jan 03
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -560,6 +560,8 @@ a slash. Thus "-R" means recovery and "-/R" readonly.
":source!". When the "scriptout" file already exists, new
characters are appended. See also |complex-repeat|.
{scriptout} cannot start with a digit.
If you want to record what is typed in a human readable for
you can use |ch_logfile()|, It adds "raw key input" lines.
*-W*
-W {scriptout} Like -w, but do not append, overwrite an existing file.
+2 -2
View File
@@ -1442,7 +1442,7 @@ add the following line to your startup file: >
:let g:filetype_euphoria = "euphoria4"
Elixir and Euphoria share the *.ex file extension. If the filetype is
Elixir and Euphoria share the *.ex file extension. If the filetype is
specifically set as Euphoria with the g:filetype_euphoria variable, or the
file is determined to be Euphoria based on keywords in the file, then the
filetype will be set as Euphoria. Otherwise, the filetype will default to
@@ -1473,7 +1473,7 @@ The following file extensions are auto-detected as Elixir file types:
*.ex, *.exs, *.eex, *.leex, *.lock
Elixir and Euphoria share the *.ex file extension. If the filetype is
Elixir and Euphoria share the *.ex file extension. If the filetype is
specifically set as Euphoria with the g:filetype_euphoria variable, or the
file is determined to be Euphoria based on keywords in the file, then the
filetype will be set as Euphoria. Otherwise, the filetype will default to
+17 -3
View File
@@ -1182,6 +1182,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
'ts' options.txt /*'ts'*
'tsl' options.txt /*'tsl'*
'tsr' options.txt /*'tsr'*
'tsrfu' options.txt /*'tsrfu'*
'ttimeout' options.txt /*'ttimeout'*
'ttimeoutlen' options.txt /*'ttimeoutlen'*
'ttm' options.txt /*'ttm'*
@@ -1441,6 +1442,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
+user_commands various.txt /*+user_commands*
+vartabs various.txt /*+vartabs*
+vertsplit various.txt /*+vertsplit*
+vim9script various.txt /*+vim9script*
+viminfo various.txt /*+viminfo*
+virtualedit various.txt /*+virtualedit*
+visual various.txt /*+visual*
@@ -2267,6 +2269,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
:cexpr quickfix.txt /*:cexpr*
:cf quickfix.txt /*:cf*
:cfdo quickfix.txt /*:cfdo*
:cfi quickfix.txt /*:cfi*
:cfile quickfix.txt /*:cfile*
:cfir quickfix.txt /*:cfir*
:cfirst quickfix.txt /*:cfirst*
@@ -4067,7 +4070,6 @@ E127 eval.txt /*E127*
E128 eval.txt /*E128*
E129 eval.txt /*E129*
E13 message.txt /*E13*
E130 eval.txt /*E130*
E131 eval.txt /*E131*
E132 eval.txt /*E132*
E133 eval.txt /*E133*
@@ -4207,6 +4209,7 @@ E257 if_cscop.txt /*E257*
E258 remote.txt /*E258*
E259 if_cscop.txt /*E259*
E26 rileft.txt /*E26*
E260 eval.txt /*E260*
E261 if_cscop.txt /*E261*
E262 if_cscop.txt /*E262*
E263 if_pyth.txt /*E263*
@@ -4237,6 +4240,7 @@ E287 mbyte.txt /*E287*
E288 mbyte.txt /*E288*
E289 mbyte.txt /*E289*
E29 change.txt /*E29*
E290 builtin.txt /*E290*
E292 message.txt /*E292*
E293 message.txt /*E293*
E294 message.txt /*E294*
@@ -4244,7 +4248,6 @@ E295 message.txt /*E295*
E296 message.txt /*E296*
E297 message.txt /*E297*
E298 message.txt /*E298*
E299 if_perl.txt /*E299*
E30 change.txt /*E30*
E300 message.txt /*E300*
E301 message.txt /*E301*
@@ -4312,9 +4315,11 @@ E358 options.txt /*E358*
E359 term.txt /*E359*
E36 windows.txt /*E36*
E360 various.txt /*E360*
E362 eval.txt /*E362*
E363 options.txt /*E363*
E364 builtin.txt /*E364*
E365 print.txt /*E365*
E366 popup.txt /*E366*
E367 autocmd.txt /*E367*
E368 builtin.txt /*E368*
E369 pattern.txt /*E369*
@@ -4406,8 +4411,11 @@ E447 editing.txt /*E447*
E448 various.txt /*E448*
E449 builtin.txt /*E449*
E45 message.txt /*E45*
E450 popup.txt /*E450*
E451 eval.txt /*E451*
E452 eval.txt /*E452*
E453 syntax.txt /*E453*
E454 eval.txt /*E454*
E455 print.txt /*E455*
E456 print.txt /*E456*
E457 print.txt /*E457*
@@ -4445,8 +4453,10 @@ E485 message.txt /*E485*
E486 pattern.txt /*E486*
E487 options.txt /*E487*
E488 message.txt /*E488*
E489 cmdline.txt /*E489*
E49 message.txt /*E49*
E490 fold.txt /*E490*
E491 builtin.txt /*E491*
E492 message.txt /*E492*
E493 cmdline.txt /*E493*
E494 editing.txt /*E494*
@@ -4497,6 +4507,7 @@ E534 options.txt /*E534*
E535 options.txt /*E535*
E536 options.txt /*E536*
E537 options.txt /*E537*
E538 builtin.txt /*E538*
E539 options.txt /*E539*
E54 pattern.txt /*E54*
E540 options.txt /*E540*
@@ -4572,6 +4583,7 @@ E608 eval.txt /*E608*
E609 if_cscop.txt /*E609*
E61 pattern.txt /*E61*
E610 editing.txt /*E610*
E611 eval.txt /*E611*
E612 sign.txt /*E612*
E613 print.txt /*E613*
E614 editing.txt /*E614*
@@ -7101,6 +7113,7 @@ g:tex_subscripts syntax.txt /*g:tex_subscripts*
g:tex_superscripts syntax.txt /*g:tex_superscripts*
g:tex_verbspell syntax.txt /*g:tex_verbspell*
g:var eval.txt /*g:var*
g:vim_indent_cont indent.txt /*g:vim_indent_cont*
g:vimball_home pi_vimball.txt /*g:vimball_home*
g:vimball_mkdir pi_vimball.txt /*g:vimball_mkdir*
g:vimsyn_embed syntax.txt /*g:vimsyn_embed*
@@ -8080,6 +8093,7 @@ matchstrpos() builtin.txt /*matchstrpos()*
matlab-indent indent.txt /*matlab-indent*
matlab-indenting indent.txt /*matlab-indenting*
max() builtin.txt /*max()*
maxcol-variable eval.txt /*maxcol-variable*
mbyte-IME mbyte.txt /*mbyte-IME*
mbyte-XIM mbyte.txt /*mbyte-XIM*
mbyte-combining mbyte.txt /*mbyte-combining*
@@ -10017,7 +10031,6 @@ try-echoerr eval.txt /*try-echoerr*
try-finally eval.txt /*try-finally*
try-nested eval.txt /*try-nested*
try-nesting eval.txt /*try-nesting*
tsrfu' options.txt /*tsrfu'*
tutor usr_01.txt /*tutor*
twice if_cscop.txt /*twice*
two-engines pattern.txt /*two-engines*
@@ -10152,6 +10165,7 @@ v:key eval.txt /*v:key*
v:lang eval.txt /*v:lang*
v:lc_time eval.txt /*v:lc_time*
v:lnum eval.txt /*v:lnum*
v:maxcol eval.txt /*v:maxcol*
v:mouse_col eval.txt /*v:mouse_col*
v:mouse_lnum eval.txt /*v:mouse_lnum*
v:mouse_win eval.txt /*v:mouse_win*
+1
View File
@@ -39,6 +39,7 @@ If the result is "1" you have it.
Stepping through code |termdebug-stepping|
Inspecting variables |termdebug-variables|
Other commands |termdebug-commands|
Events |termdebug-events|
Prompt mode |termdebug-prompt|
Communication |termdebug-communication|
Customizing |termdebug-customizing|
+16 -4
View File
@@ -1,4 +1,4 @@
*todo.txt* For Vim version 8.2. Last change: 2021 Dec 30
*todo.txt* For Vim version 8.2. Last change: 2022 Jan 08
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -38,15 +38,27 @@ browser use: https://github.com/vim/vim/issues/1234
*known-bugs*
-------------------- Known bugs and current work -----------------------
Autoload import syntax:
import autoload "filename"
import autoload "filename" as name
doesn't load the script yet
autoload items can be used without the "#dir#file#" prefix, but file.item
Add a test_override() item to load the script and compile functions the
moment it is encountered, so that types are checked.
"vim9script autoload" in an autoload script, using "export" will prefix
"dir#file#" to the exported item.
Once Vim9 is stable:
- Add the "vim9script" feature, can use has('vim9script')
Remove TODO in vim9.txt
- Add all the error numbers in a good place in documentation.
done until E653
- Use Vim9 for runtime files.
Further Vim9 improvements, possibly after launch:
- Check performance with callgrind and kcachegrind.
- better implementation for partial and tests for that.
- Better implementation for partial and tests for that.
- when using "const" mark the variable type as const with TTFLAG_CONST, so
that an error is given at compile time when trying to change it. E.g. for a
const list and trying to call add().
- Compile options that are an expression, e.g. "expr:" in 'spellsuggest',
'foldexpr', 'foldtext', 'printexpr', 'diffexpr', 'patchexpr', 'charconvert',
'balloonexpr', 'includeexpr', 'indentexpr', 'formatexpr'.
+2 -2
View File
@@ -189,7 +189,7 @@ You can specify #rrggbb hex colors and you can define new names for hex
colors in |v:colornames| like so: >
let v:colornames['mine_red'] = '#aa0000'
<
If you are authoring a color scheme for others to use, it is important
to define these colors only when they do not exist: >
@@ -197,7 +197,7 @@ to define these colors only when they do not exist: >
This allows users of the color scheme to override the precise definition of
that color prior to loading your color scheme. For example, in a |.vimrc|
file:
file: >
runtime colors/lists/css_colors.vim
let v:colornames['your_red'] = v:colornames['css_red']
+2 -2
View File
@@ -1,4 +1,4 @@
*usr_40.txt* For Vim version 8.2. Last change: 2020 Sep 02
*usr_40.txt* For Vim version 8.2. Last change: 2022 Jan 03
VIM USER MANUAL - by Bram Moolenaar
@@ -20,7 +20,7 @@ Table of contents: |usr_toc.txt|
==============================================================================
*40.1* Key mapping
A simple mapping was explained in section |05.3|. The principle is that one
A simple mapping was explained in section |05.4|. The principle is that one
sequence of key strokes is translated into another sequence of key strokes.
This is a simple, yet powerful mechanism.
The simplest form is that one key is mapped to a sequence of keys. Since
+6 -6
View File
@@ -1,4 +1,4 @@
*usr_41.txt* For Vim version 8.2. Last change: 2021 Dec 30
*usr_41.txt* For Vim version 8.2. Last change: 2022 Jan 01
VIM USER MANUAL - by Bram Moolenaar
@@ -277,7 +277,7 @@ Example: >
var name = "Peter"
echo name
< peter ~
< Peter ~
Every variable has a type. Very often, as in this example, the type is
defined by assigning a value. This is called type inference. If you do not
@@ -538,16 +538,16 @@ between the `while` and the `endwhile`:
Example: >
var counter = 1
while counter < 40
do_something()
if skip_flag
if skip_number(counter)
continue
endif
if finished_flag
if last_number(counter)
break
endif
sleep 50m
--counter
++counter
endwhile
The `sleep` command makes Vim take a nap. The "50m" specifies fifty
+3 -3
View File
@@ -1,4 +1,4 @@
*various.txt* For Vim version 8.2. Last change: 2021 Dec 20
*various.txt* For Vim version 8.2. Last change: 2022 Jan 08
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -244,10 +244,10 @@ g8 Print the hex values of the bytes used in the
compiler will have set stdin to a non-interactive
mode.
*:!cmd* *:!* *E34*
*:!cmd* *:!*
:!{cmd} Execute {cmd} with the shell. See also the 'shell'
and 'shelltype' option.
*E34*
Any '!' in {cmd} is replaced with the previous
external command (see also 'cpoptions'). But not when
there is a backslash before the '!', then that
+58 -35
View File
@@ -1,4 +1,4 @@
*vim9.txt* For Vim version 8.2. Last change: 2021 Dec 27
*vim9.txt* For Vim version 8.2. Last change: 2022 Jan 07
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -120,7 +120,7 @@ is the same as in shell scripts and Python programs.
In Vi # is a command to list text with numbers. In Vim9 script you can use
`:number` for that. >
101 number
:101 number
To improve readability there must be a space between a command and the #
that starts a comment: >
@@ -1358,8 +1358,14 @@ Same for |extend()|, use |extendnew()| instead, and for |flatten()|, use
*vim9script* *vim9-export* *vim9-import*
A Vim9 script can be written to be imported. This means that everything in
the script is local, unless exported. Those exported items, and only those
items, can then be imported in another script.
the script is local, except for items that are exported. Those exported
items, and only those items, can then be imported in another script.
This mechanism exists for writing a script that can be sourced (imported) by
other scripts, while making sure these other scripts only have access to what
you want them to. This also avoids using the global namespace, which has a
risc of name collisions. For example when you have two plugins with similar
functionality.
You can cheat by using the global namespace explicitly. We will assume here
that you don't do that.
@@ -1438,21 +1444,23 @@ The exported items can be imported in another Vim9 script: >
This makes each item available as "myscript.item".
In case the name is long or ambiguous, another name can be specified: >
import "thatscript.vim" as That
import "thatscript.vim" as that
Then you can use "That.EXPORTED_CONST", "That.someValue", etc. You are free
to choose the name "That". Use something that will be recognized as referring
to the imported script. Avoid command names, because the name will shadow
them.
Then you can use "that.EXPORTED_CONST", "that.someValue", etc. You are free
to choose the name "that". Use something that will be recognized as referring
to the imported script. Avoid command names and builtin function names,
because the name will shadow them.
In case the dot in the name is unwanted, a local reference can be made: >
var ThatFunc = That.LongFuncName
In case the dot in the name is undesired, a local reference can be made for a
function: >
var LongFunc = that.LongFuncName
This also works for constants: >
cost MAXLEN = That.MAX_LEN_OF_NAME
const MAXLEN = that.MAX_LEN_OF_NAME
This does not work for variables, you could use a setter function and make a
local reference for it.
This does not work for variables, since the value would be copied once and
when changing the variable the copy will change, not the original variable.
You will need to use the full name, with the dot.
`:import` can also be used in legacy Vim script. The imported items still
become script-local, even when the "s:" prefix is not given.
@@ -1471,12 +1479,21 @@ The script name after `import` can be:
longer and unique, to avoid loading the wrong file.
Note that "after/import" is not used.
If the name does not end in ".vim" then the use of "as name" is required.
Once a vim9 script file has been imported, the result is cached and used the
next time the same script is imported. It will not be read again.
It is not allowed to import the same script twice, also when using two
different "as" names.
*:import-cycle*
When using the imported name the dot and the item name must be in the same
line, there can be no line break: >
echo that.
name # Error!
echo that
.name # Error!
< *:import-cycle*
The `import` commands are executed when encountered. If that script (directly
or indirectly) imports the current script, then items defined after the
`import` won't be processed yet. Therefore cyclic imports can exist, but may
@@ -1484,37 +1501,43 @@ result in undefined items.
Import in an autoload script ~
*vim9-autoload*
For optimal startup speed, loading scripts should be postponed until they are
actually needed. A recommended mechanism:
actually needed. Using the autoload mechanism is recommended:
1. In the plugin define user commands, functions and/or mappings that refer to
an autoload script. >
command -nargs=1 SearchForStuff searchfor#Stuff(<f-args>)
items imported from an autoload script. >
import autoload 'for/search.vim'
command -nargs=1 SearchForStuff search.Stuff(<f-args>)
< This goes in .../plugin/anyname.vim. "anyname.vim" can be freely chosen.
The "SearchForStuff" command is now available to the user.
2. In the autoload script do the actual work. You can import items from
other files to split up functionality in appropriate pieces. >
vim9script
import "../import/someother.vim" as other
def searchfor#Stuff(arg: string)
var filtered = other.FilterFunc(arg)
The "autoload" argument to `:import` means that the script is not loaded
until one of the items is actually used. The script will be found under
the "autoload" directory in 'runtimepath' instead of the "import"
directory.
2. In the autoload script put the bulk of the code. >
vim9script autoload
export def Stuff(arg: string)
...
< This goes in .../autoload/searchfor.vim. "searchfor" in the file name
must be exactly the same as the prefix for the function name, that is how
Vim finds the file.
3. Other functionality, possibly shared between plugins, contains the exported
items and any private items. >
vim9script
var localVar = 'local'
export def FilterFunc(arg: string): string
...
< This goes in .../import/someother.vim.
< This goes in .../autoload/for/search.vim.
Adding "autoload" to `:vim9script` has the effect that "for#search#" will
be prefixed to every exported item. The prefix is obtained from the file
name, as you would to manually in a legacy autoload script. Thus the
exported function can be found with "for#search#Stuff", but you would
normally use `import autoload` and not need to specify the prefix.
You can split up the functionality and import other scripts from the
autoload script as you like. This way you can share code between plugins.
When compiling a `:def` function and a function in an autoload script is
encountered, the script is not loaded until the `:def` function is called.
This also means you get any errors only at runtime, since the argument and
return types are not known yet.
Import in legacy Vim script ~
+6 -2
View File
@@ -1,4 +1,4 @@
*windows.txt* For Vim version 8.2. Last change: 2021 Nov 29
*windows.txt* For Vim version 8.2. Last change: 2022 Jan 08
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -146,7 +146,7 @@ highlight group (|hl-EndOfBuffer|) can be used to change the highlighting of
the filler characters.
==============================================================================
3. Opening and closing a window *opening-window* *E36*
3. Opening and closing a window *opening-window*
CTRL-W s *CTRL-W_s*
CTRL-W S *CTRL-W_S*
@@ -246,6 +246,10 @@ CTRL-W : Does the same as typing |:| - enter a command line. Useful in a
Note that the 'splitbelow' and 'splitright' options influence where a new
window will appear.
*E36*
Creating a window will fail if there is not enough room. Every window needs
at least one screen line and column, sometimes more. Options 'winminheight'
and 'winminwidth' are relevant.
*:vert* *:vertical*
:vert[ical] {cmd}
+1 -1
View File
@@ -1,7 +1,7 @@
" Vim support file to detect file types
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2021 Dec 27
" Last Change: 2022 Jan 05
" Listen very carefully, I will say this only once
if exists("did_load_filetypes")
-41
View File
@@ -1,41 +0,0 @@
" Vim filetype plugin
" Language: generic git output
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2019 Dec 05
" Only do this when not done yet for this buffer
if (exists("b:did_ftplugin"))
finish
endif
let b:did_ftplugin = 1
if !exists('b:git_dir')
if expand('%:p') =~# '[\/]\.git[\/]modules[\/]\|:[\/][\/]\|^\a\a\+:'
" Stay out of the way
elseif expand('%:p') =~# '[\/]\.git[\/]worktrees'
let b:git_dir = matchstr(expand('%:p'),'.*\.git[\/]worktrees[\/][^\/]\+\>')
elseif expand('%:p') =~# '\.git\>'
let b:git_dir = matchstr(expand('%:p'),'.*\.git\>')
elseif $GIT_DIR != ''
let b:git_dir = $GIT_DIR
endif
if (has('win32') || has('win64')) && exists('b:git_dir')
let b:git_dir = substitute(b:git_dir,'\\','/','g')
endif
endif
if exists('*shellescape') && exists('b:git_dir') && b:git_dir != ''
if b:git_dir =~# '/\.git$' " Not a bare repository
let &l:path = escape(fnamemodify(b:git_dir,':h'),'\, ').','.&l:path
endif
let &l:path = escape(b:git_dir,'\, ').','.&l:path
let &l:keywordprg = 'git --git-dir='.shellescape(b:git_dir).' show'
else
setlocal keywordprg=git\ show
endif
if has('gui_running')
let &l:keywordprg = substitute(&l:keywordprg,'^git\>','git --no-pager','')
endif
setlocal includeexpr=substitute(v:fname,'^[^/]\\+/','','')
let b:undo_ftplugin = "setl keywordprg< path< includeexpr<"
+19 -28
View File
@@ -1,66 +1,57 @@
" Vim filetype plugin
" Language: git commit file
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2019 Dec 05
" Last Change: 2022 Jan 05
" Only do this when not done yet for this buffer
if (exists("b:did_ftplugin"))
finish
endif
runtime! ftplugin/git.vim
let b:did_ftplugin = 1
setlocal comments=:# commentstring=#\ %s
setlocal nomodeline tabstop=8 formatoptions+=tl textwidth=72
setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=q formatoptions+=n
setlocal formatlistpat+=\\\|^\\s*[-*+]\\s\\+
setlocal include=^+++
setlocal includeexpr=substitute(v:fname,'^[bi]/','','')
let b:undo_ftplugin = 'setl modeline< tabstop< formatoptions< tw< com< cms< formatlistpat<'
let b:undo_ftplugin = 'setl modeline< tabstop< formatoptions< tw< com< cms< formatlistpat< inc< inex<'
if exists("g:no_gitcommit_commands") || v:version < 700
let s:l = search('\C\m^[#;@!$%^&|:] -\{24,\} >8 -\{24,\}$', 'cnW', '', 100)
let &l:comments = ':' . (matchstr(getline(s:l ? s:l : '$'), '^[#;@!$%^&|:]\S\@!') . '#')[0]
let &l:commentstring = &l:comments[1] . ' %s'
unlet s:l
if exists("g:no_gitcommit_commands")
finish
endif
if !exists("b:git_dir")
let b:git_dir = expand("%:p:h")
endif
command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>)
command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0, <f-args>)
let b:undo_ftplugin = b:undo_ftplugin . "|delc DiffGitCached"
function! s:diffcomplete(A,L,P)
function! s:diffcomplete(A, L, P) abort
let args = ""
if a:P <= match(a:L." -- "," -- ")+3
let args = args . "-p\n--stat\n--shortstat\n--summary\n--patch-with-stat\n--no-renames\n-B\n-M\n-C\n"
end
if exists("b:git_dir") && a:A !~ '^-'
let tree = fnamemodify(b:git_dir,':h')
if strpart(getcwd(),0,strlen(tree)) == tree
let args = args."\n".system("git diff --cached --name-only")
endif
if a:A !~ '^-' && !empty(getftype('.git'))
let args = args."\n".system("git diff --cached --name-only")
endif
return args
endfunction
function! s:gitdiffcached(bang,gitdir,...)
let tree = fnamemodify(a:gitdir,':h')
function! s:gitdiffcached(bang, ...) abort
let name = tempname()
let git = "git"
if strpart(getcwd(),0,strlen(tree)) != tree
let git .= " --git-dir=".(exists("*shellescape") ? shellescape(a:gitdir) : '"'.a:gitdir.'"')
endif
if a:0
let extra = join(map(copy(a:000),exists("*shellescape") ? 'shellescape(v:val)' : "'\"'.v:val.'\"'"))
let extra = join(map(copy(a:000), 'shellescape(v:val)'))
else
let extra = "-p --stat=".&columns
endif
call system(git." diff --cached --no-color --no-ext-diff ".extra." > ".(exists("*shellescape") ? shellescape(name) : name))
exe "pedit ".(exists("*fnameescape") ? fnameescape(name) : name)
call system("git diff --cached --no-color --no-ext-diff ".extra." > ".shellescape(name))
exe "pedit " . fnameescape(name)
wincmd P
let b:git_dir = a:gitdir
command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>)
nnoremap <buffer> <silent> q :q<CR>
command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0, <f-args>)
setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git
endfunction
+6 -9
View File
@@ -1,22 +1,20 @@
" Vim filetype plugin
" Language: git rebase --interactive
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2019 Dec 05
" Last Change: 2022 Jan 05
" Only do this when not done yet for this buffer
if (exists("b:did_ftplugin"))
finish
endif
runtime! ftplugin/git.vim
let b:did_ftplugin = 1
setlocal comments=:# commentstring=#\ %s formatoptions-=t
let &l:comments = ':' . (matchstr(getline('$'), '^[#;@!$%^&|:]\S\@!') . '#')[0]
let &l:commentstring = &l:comments[1] . ' %s'
setlocal formatoptions-=t
setlocal nomodeline
if !exists("b:undo_ftplugin")
let b:undo_ftplugin = ""
endif
let b:undo_ftplugin = b:undo_ftplugin."|setl com< cms< fo< ml<"
let b:undo_ftplugin = "setl com< cms< fo< ml<"
function! s:choose(word) abort
s/^\(\w\+\>\)\=\(\s*\)\ze\x\{4,40\}\>/\=(strlen(submatch(1)) == 1 ? a:word[0] : a:word) . substitute(submatch(2),'^$',' ','')/e
@@ -41,8 +39,7 @@ if exists("g:no_plugin_maps") || exists("g:no_gitrebase_maps")
finish
endif
nnoremap <buffer> <expr> K col('.') < 7 && expand('<Lt>cword>') =~ '\X' && getline('.') =~ '^\w\+\s\+\x\+\>' ? 'wK' : 'K'
nnoremap <buffer> <silent> <C-A> :<C-U><C-R>=v:count1<CR>Cycle<CR>
nnoremap <buffer> <silent> <C-X> :<C-U><C-R>=v:count1<CR>Cycle!<CR>
let b:undo_ftplugin = b:undo_ftplugin . "|exe 'nunmap <buffer> K'|exe 'nunmap <buffer> <C-A>'|exe 'nunmap <buffer> <C-X>'"
let b:undo_ftplugin = b:undo_ftplugin . "|exe 'nunmap <buffer> <C-A>'|exe 'nunmap <buffer> <C-X>'"
+5 -5
View File
@@ -147,7 +147,7 @@ func s:StartDebug_internal(dict)
if &columns < g:termdebug_wide
let s:save_columns = &columns
let &columns = g:termdebug_wide
" If we make the Vim window wider, use the whole left halve for the debug
" If we make the Vim window wider, use the whole left half for the debug
" windows.
let s:allleft = 1
endif
@@ -426,7 +426,7 @@ func s:StartDebug_prompt(dict)
call s:SendCommand('set env COLORS = ' . &t_Co)
call s:SendCommand('set env VIM_TERMINAL = ' . v:version)
else
" TODO: open a new terminal get get the tty name, pass on to gdb
" TODO: open a new terminal, get the tty name, pass on to gdb
call s:SendCommand('show inferior-tty')
endif
call s:SendCommand('set print pretty on')
@@ -1067,10 +1067,10 @@ func s:GetEvaluationExpression(range, arg)
return expr
endfunc
" clean up expression that may got in because of range
" clean up expression that may get in because of range
" (newlines and surrounding whitespace)
" As it can also be specified via ex-command for assignments this function
" may not change the "content" parts (like replacing contained spaces
" may not change the "content" parts (like replacing contained spaces)
func s:CleanupExpr(expr)
" replace all embedded newlines/tabs/...
let expr = substitute(a:expr, '\_s', ' ', 'g')
@@ -1099,7 +1099,7 @@ func s:HandleEvaluate(msg)
\ ->substitute('.*value="\(.*\)"', '\1', '')
\ ->substitute('\\"', '"', 'g')
\ ->substitute('\\\\', '\\', 'g')
"\ multi-byte characters arrive in octal form, replace everthing but NULL values
"\ multi-byte characters arrive in octal form, replace everything but NULL values
\ ->substitute('\\000', s:NullRepl, 'g')
\ ->substitute('\\\o\o\o', {-> eval('"' .. submatch(0) .. '"')}, 'g')
"\ Note: GDB docs also mention hex encodings - the translations below work
+62 -31
View File
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: generic git output
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2019 Dec 05
" Last Change: 2022 Jan 05
if exists("b:current_syntax")
finish
@@ -12,12 +12,28 @@ syn sync minlines=50
syn include @gitDiff syntax/diff.vim
syn region gitHead start=/\%^/ end=/^$/
syn region gitHead start=/\%(^commit\%( \x\{40\}\)\{1,\}\%(\s*(.*)\)\=$\)\@=/ end=/^$/
" For git reflog and git show ...^{tree}, avoid sync issues
syn match gitHead /^\d\{6\} \%(\w\{4} \)\=\x\{40\}\%( [0-3]\)\=\t.*/
syn match gitHead /^\x\{40\} \x\{40}\t.*/
syn region gitHead start=/\%^\%(tag \|tree \|object \)\@=/ end=/^$/ contains=@NoSpell
syn region gitHead start=/\%(^commit\%( \x\{4,\}\)\{1,\}\%(\s*(.*)\)\=$\)\@=/ end=/^$/ contains=@NoSpell
" git log --oneline
" minimize false positives by verifying contents of buffer
if getline(1) =~# '^\x\{7,\} ' && getline('$') =~# '^\x\{7,\} '
syn match gitHashAbbrev /^\x\{7,\} \@=/ contains=@NoSpell
elseif getline(1) =~# '^[|\/\\_ ]\{-\}\*[|\/\\_ ]\{-\} \x\{7,\} '
syn match gitHashAbbrev /^[|\/\\_ ]\{-\}\*[|\/\\_ ]\{-\} \zs\x\{7,\} \@=/ contains=@NoSpell
endif
" git log --graph
syn region gitGraph start=/\%(^[|\/\\_ ]*\*[|\/\\_ ]\{-\} commit\%( \x\{4,\}\)\{1,\}\%(\s*(.*)\)\=$\)\@=/ end=/^\%([|\/\\_ ]*$\)\@=/ contains=@NoSpell
" git blame --porcelain
syn region gitHead start=/\%(^\x\{40,\} \d\+ \d\+\%( \d\+\)\=$\)\@=/ end=/^\t\@=/ contains=@NoSpell
" git ls-tree
syn match gitMode /^\d\{6\}\%( \%(blob\|tree\) \x\{4,\}\t\)\@=/ nextgroup=gitType skipwhite contains=@NoSpell
" git ls-files --stage
syn match gitMode /^\d\{6\}\%( \x\{4,\} [0-3]\t\)\@=/ nextgroup=gitHashStage skipwhite contains=@NoSpell
" .git/HEAD, .git/refs/
syn match gitKeyword /\%^ref: \@=/ nextgroup=gitReference skipwhite contains=@NoSpell
syn match gitHash /\%^\x\{40,}\%$/ skipwhite contains=@NoSpell
" .git/logs/
syn match gitReflog /^\x\{40,\} \x\{40,\} .\{-\}\d\+\s-\d\{4\}\t.*/ skipwhite contains=@NoSpell,gitReflogOld
syn region gitDiff start=/^\%(diff --git \)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff fold
syn region gitDiff start=/^\%(@@ -\)\@=/ end=/^\%(diff --\%(git\|cc\|combined\) \|$\)\@=/ contains=@gitDiff
@@ -25,35 +41,47 @@ syn region gitDiff start=/^\%(@@ -\)\@=/ end=/^\%(diff --\%(git\|cc\|combined\)
syn region gitDiffMerge start=/^\%(diff --\%(cc\|combined\) \)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff
syn region gitDiffMerge start=/^\%(@@@@* -\)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff
syn match gitDiffAdded "^ \++.*" contained containedin=gitDiffMerge
syn match gitDiffAdded "{+.*+}" contained containedin=gitDiff
syn match gitDiffAdded "{+[^}]*+}" contained containedin=gitDiff
syn match gitDiffRemoved "^ \+-.*" contained containedin=gitDiffMerge
syn match gitDiffRemoved "\[-.*-\]" contained containedin=gitDiff
syn match gitDiffRemoved "\[-[^]]*-\]" contained containedin=gitDiff
syn match gitKeyword /^\%(object\|type\|tag\|commit\|tree\|parent\|encoding\)\>/ contained containedin=gitHead nextgroup=gitHash,gitType skipwhite
syn match gitKeyword /^\%(tag\>\|ref:\)/ contained containedin=gitHead nextgroup=gitReference skipwhite
syn match gitKeyword /^Merge:/ contained containedin=gitHead nextgroup=gitHashAbbrev skipwhite
syn match gitMode /^\d\{6\}\>/ contained containedin=gitHead nextgroup=gitType,gitHash skipwhite
syn match gitIdentityKeyword /^\%(author\|committer\|tagger\)\>/ contained containedin=gitHead nextgroup=gitIdentity skipwhite
syn match gitIdentityHeader /^\%(Author\|Commit\|Tagger\):/ contained containedin=gitHead nextgroup=gitIdentity skipwhite
syn match gitDateHeader /^\%(AuthorDate\|CommitDate\|Date\):/ contained containedin=gitHead nextgroup=gitDate skipwhite
syn match gitKeyword /^commit \@=/ contained containedin=gitHead nextgroup=gitHashAbbrev skipwhite contains=@NoSpell
syn match gitKeyword /^\%(object\|tree\|parent\|encoding\|gpgsig\%(-\w\+\)\=\|previous\) \@=/ contained containedin=gitHead nextgroup=gitHash skipwhite contains=@NoSpell
syn match gitKeyword /^Merge:/ contained containedin=gitHead nextgroup=gitHashAbbrev skipwhite contains=@NoSpell
syn match gitIdentityKeyword /^\%(author\|committer\|tagger\) \@=/ contained containedin=gitHead nextgroup=gitIdentity skipwhite contains=@NoSpell
syn match gitIdentityHeader /^\%(Author\|Commit\|Tagger\):/ contained containedin=gitHead nextgroup=gitIdentity skipwhite contains=@NoSpell
syn match gitDateHeader /^\%(AuthorDate\|CommitDate\|Date\):/ contained containedin=gitHead nextgroup=gitDate skipwhite contains=@NoSpell
syn match gitReflogHeader /^Reflog:/ contained containedin=gitHead nextgroup=gitReflogMiddle skipwhite
syn match gitReflogHeader /^Reflog message:/ contained containedin=gitHead skipwhite
syn match gitReflogMiddle /\S\+@{\d\+} (/he=e-2 nextgroup=gitIdentity
syn match gitKeyword /^[*|\/\\_ ]\+\zscommit \@=/ contained containedin=gitGraph nextgroup=gitHashAbbrev skipwhite contains=@NoSpell
syn match gitKeyword /^[|\/\\_ ]\+\zs\%(object\|tree\|parent\|encoding\|gpgsig\%(-\w\+\)\=\|previous\) \@=/ contained containedin=gitGraph nextgroup=gitHash skipwhite contains=@NoSpell
syn match gitKeyword /^[|\/\\_ ]\+\zsMerge:/ contained containedin=gitGraph nextgroup=gitHashAbbrev skipwhite contains=@NoSpell
syn match gitIdentityKeyword /^[|\/\\_ ]\+\zs\%(author\|committer\|tagger\) \@=/ contained containedin=gitGraph nextgroup=gitIdentity skipwhite contains=@NoSpell
syn match gitIdentityHeader /^[|\/\\_ ]\+\zs\%(Author\|Commit\|Tagger\):/ contained containedin=gitGraph nextgroup=gitIdentity skipwhite contains=@NoSpell
syn match gitDateHeader /^[|\/\\_ ]\+\zs\%(AuthorDate\|CommitDate\|Date\):/ contained containedin=gitGraph nextgroup=gitDate skipwhite contains=@NoSpell
syn match gitDate /\<\u\l\l \u\l\l \d\=\d \d\d:\d\d:\d\d \d\d\d\d [+-]\d\d\d\d/ contained
syn match gitDate /-\=\d\+ [+-]\d\d\d\d\>/ contained
syn match gitDate /\<\d\+ \l\+ ago\>/ contained
syn match gitType /\<\%(tag\|commit\|tree\|blob\)\>/ contained nextgroup=gitHash skipwhite
syn match gitStage /\<\d\t\@=/ contained
syn match gitReference /\S\+\S\@!/ contained
syn match gitHash /\<\x\{40\}\>/ contained nextgroup=gitIdentity,gitStage,gitHash skipwhite
syn match gitHash /^\<\x\{40\}\>/ containedin=gitHead contained nextgroup=gitHash skipwhite
syn match gitHashAbbrev /\<\x\{4,40\}\>/ contained nextgroup=gitHashAbbrev skipwhite
syn match gitHashAbbrev /\<\x\{4,39\}\.\.\./he=e-3 contained nextgroup=gitHashAbbrev skipwhite
syn match gitKeyword /^type \@=/ contained containedin=gitHead nextgroup=gitType skipwhite contains=@NoSpell
syn match gitKeyword /^\%(summary\|boundary\|filename\|\%(author\|committer\)-\%(time\|tz\)\) \@=/ contained containedin=gitHead skipwhite contains=@NoSpell
syn match gitKeyword /^tag \@=/ contained containedin=gitHead nextgroup=gitReference skipwhite contains=@NoSpell
syn match gitIdentityKeyword /^\%(author\|committer\)-mail \@=/ contained containedin=gitHead nextgroup=gitEmail skipwhite contains=@NoSpell
syn match gitReflogHeader /^Reflog:/ contained containedin=gitHead nextgroup=gitReflogMiddle skipwhite contains=@NoSpell
syn match gitReflogHeader /^Reflog message:/ contained containedin=gitHead skipwhite contains=@NoSpell
syn match gitReflogMiddle /\S\+@{\d\+} (/he=e-2 nextgroup=gitIdentity contains=@NoSpell
syn match gitIdentity /\S.\{-\} <[^>]*>/ contained nextgroup=gitDate skipwhite contains=@NoSpell
syn region gitEmail matchgroup=gitEmailDelimiter start=/</ end=/>/ keepend oneline contained containedin=gitIdentity contains=@NoSpell
syn match gitDate /\<\u\l\l \u\l\l \d\=\d \d\d:\d\d:\d\d \d\d\d\d [+-]\d\d\d\d/ contained contains=@NoSpell
syn match gitDate /-\=\d\+ [+-]\d\d\d\d\>/ contained contains=@NoSpell
syn match gitDate /\<\d\+ \l\+ ago\>/ contained contains=@NoSpell
syn match gitType /\<\%(tag\|commit\|tree\|blob\)\>/ contained nextgroup=gitHashAbbrev skipwhite contains=@NoSpell
syn match gitReference /\S\+\S\@!/ contained contains=@NoSpell
syn match gitHash /\<\x\{40,\}\>/ contained nextgroup=gitIdentity,gitHash skipwhite contains=@NoSpell
syn match gitReflogOld /^\x\{40,\} \@=/ contained nextgroup=gitReflogNew skipwhite contains=@NoSpell
syn match gitReflogNew /\<\x\{40,\} \@=/ contained nextgroup=gitIdentity skipwhite contains=@NoSpell
syn match gitHashAbbrev /\<\x\{4,\}\>/ contained nextgroup=gitHashAbbrev skipwhite contains=@NoSpell
syn match gitHashAbbrev /\<\x\{4,39\}\.\.\./he=e-3 contained nextgroup=gitHashAbbrev skipwhite contains=@NoSpell
syn match gitHashStage /\<\x\{4,\}\>/ contained nextgroup=gitStage skipwhite contains=@NoSpell
syn match gitStage /\<\d\t\@=/ contained contains=@NoSpell
syn match gitIdentity /\S.\{-\} <[^>]*>/ contained nextgroup=gitDate skipwhite
syn region gitEmail matchgroup=gitEmailDelimiter start=/</ end=/>/ keepend oneline contained containedin=gitIdentity
syn match gitNotesHeader /^Notes:\ze\n /
@@ -68,7 +96,10 @@ hi def link gitEmailDelimiter Delimiter
hi def link gitEmail Special
hi def link gitDate Number
hi def link gitMode Number
hi def link gitHashStage gitHash
hi def link gitHashAbbrev gitHash
hi def link gitReflogOld gitHash
hi def link gitReflogNew gitHash
hi def link gitHash Identifier
hi def link gitReflogMiddle gitReference
hi def link gitReference Function
+52 -36
View File
@@ -2,71 +2,87 @@
" Language: git commit file
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Filenames: *.git/COMMIT_EDITMSG
" Last Change: 2019 Dec 05
" Last Change: 2022 Jan 05
if exists("b:current_syntax")
finish
endif
scriptencoding utf-8
syn case match
syn sync minlines=50
syn sync linebreaks=1
if has("spell")
syn spell toplevel
endif
syn include @gitcommitDiff syntax/diff.vim
syn region gitcommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^\%(diff --\|$\|#\)\@=/ fold contains=@gitcommitDiff
syn region gitcommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^\%(diff --\|$\|@@\@!\|[^[:alnum:]\ +-]\S\@!\)\@=/ fold contains=@gitcommitDiff
syn match gitcommitSummary "^.*\%<51v." contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell
syn match gitcommitOverflow ".*" contained contains=@Spell
syn match gitcommitBlank "^[^#].*" contained contains=@Spell
syn match gitcommitBlank "^.\+" contained contains=@Spell
syn match gitcommitFirstLine "\%^.*" nextgroup=gitcommitBlank,gitcommitComment skipnl
if get(g:, "gitcommit_cleanup") is# "scissors"
syn match gitcommitFirstLine "\%^.*" nextgroup=gitcommitBlank skipnl
syn region gitcommitComment start=/^# -\+ >8 -\+$/ end=/\%$/ contains=gitcommitDiff
else
syn match gitcommitFirstLine "\%^[^#].*" nextgroup=gitcommitBlank skipnl
syn match gitcommitComment "^#.*"
let s:scissors = 0
let s:l = search('^[#;@!$%^&|:] -\{24,\} >8 -\{24,\}$', 'cnW', '', 100)
if s:l == 0
let s:l = line('$')
elseif getline(s:l)[0] !=# getline(s:l - 1)[0]
let s:scissors = 1
endif
let s:comment = escape((matchstr(getline(s:l), '^[#;@!$%^&|:]\S\@!') . '#')[0], '^$.*[]~\"/')
syn match gitcommitHead "^\%(# .*\n\)\+#$" contained transparent
syn match gitcommitOnBranch "\%(^# \)\@<=On branch" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
syn match gitcommitOnBranch "\%(^# \)\@<=Your branch .\{-\} '" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
if s:scissors
let s:comment .= ' -\{24,\} >8 -\{24,\}$'
exe 'syn region gitcommitComment start="^' . s:comment . '" end="\%$" contains=gitcommitDiff'
else
exe 'syn match gitcommitComment "^' . s:comment . '.*"'
endif
exe 'syn match gitcommitTrailers "\n\@<=\n\%([[:alnum:]-]\+\s*:.*\|(cherry picked from commit .*\)\%(\n\s.*\|\n[[:alnum:]-]\+\s*:.*\|\n(cherry picked from commit .*\)*\%(\n\n*\%(' . s:comment . '\)\|\n*\%$\)\@="'
unlet s:l s:comment s:scissors
syn match gitcommitTrailerToken "^[[:alnum:]-]\+\s*:" contained containedin=gitcommitTrailers
syn match gitcommitHash "\<\x\{40,}\>" contains=@NoSpell display
syn match gitcommitOnBranch "\%(^. \)\@<=On branch" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
syn match gitcommitOnBranch "\%(^. \)\@<=Your branch .\{-\} '" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
syn match gitcommitBranch "[^ ']\+" contained
syn match gitcommitNoBranch "\%(^# \)\@<=Not currently on any branch." contained containedin=gitcommitComment
syn match gitcommitHeader "\%(^# \)\@<=.*:$" contained containedin=gitcommitComment
syn region gitcommitAuthor matchgroup=gitCommitHeader start=/\%(^# \)\@<=\%(Author\|Committer\):/ end=/$/ keepend oneline contained containedin=gitcommitComment transparent
syn match gitcommitNoChanges "\%(^# \)\@<=No changes$" contained containedin=gitcommitComment
syn match gitcommitNoBranch "\%(^. \)\@<=Not currently on any branch." contained containedin=gitcommitComment
syn match gitcommitHeader "\%(^. \)\@<=\S.*[:]\%(\n^$\)\@!$" contained containedin=gitcommitComment
syn region gitcommitAuthor matchgroup=gitCommitHeader start=/\%(^. \)\@<=\%(Author\|Committer\|Date\):/ end=/$/ keepend oneline contained containedin=gitcommitComment transparent
syn match gitcommitHeader "\%(^. \)\@<=commit\%( \x\{40,\}$\)\@=" contained containedin=gitcommitComment nextgroup=gitcommitHash skipwhite
syn match gitcommitNoChanges "\%(^. \)\@<=No changes$" contained containedin=gitcommitComment
syn region gitcommitUntracked start=/^# Untracked files:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUntrackedFile fold
syn match gitcommitUntrackedFile "\t\@<=.*" contained
syn match gitcommitType "\%(^.\t\)\@<=[^[:punct:][:space:]][^/:]*[^[:punct:][:space:]][:]\ze "he=e-1 contained containedin=gitcommitComment nextgroup=gitcommitFile skipwhite
syn match gitcommitFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitArrow
syn match gitcommitArrow " -> " contained nextgroup=gitcommitFile
syn match gitcommitUntrackedFile "\%(^.\t\)\@<=[^:/]*\%(/.*\)\=$" contained containedin=gitcommitComment
syn region gitcommitDiscarded start=/^# Change\%(s not staged for commit\|d but not updated\):/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitDiscardedType fold
syn region gitcommitSelected start=/^# Changes to be committed:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitSelectedType fold
syn region gitcommitUnmerged start=/^# Unmerged paths:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUnmergedType fold
syn region gitcommitUntracked start=/^\z(.\) Untracked files:$/ end=/^\z1\=$\|^\z1\@!/ contains=gitcommitHeader containedin=gitcommitComment containedin=gitcommitComment contained transparent fold
syn region gitcommitDiscarded start=/^\z(.\) Change\%(s not staged for commit\|d but not updated\):$/ end=/^\z1\=$\|^\z1\@!/ contains=gitcommitHeader,gitcommitDiscardedType containedin=gitcommitComment containedin=gitcommitComment contained transparent fold
syn region gitcommitSelected start=/^\z(.\) Changes to be committed:$/ end=/^\z1$\|^\z1\@!/ contains=gitcommitHeader,gitcommitSelectedType containedin=gitcommitComment containedin=gitcommitComment contained transparent fold
syn region gitcommitUnmerged start=/^\z(.\) Unmerged paths:$/ end=/^\z1\=$\|^\z1\@!/ contains=gitcommitHeader,gitcommitUnmergedType containedin=gitcommitComment containedin=gitcommitComment contained transparent fold
syn match gitcommitUntrackedFile "\%(^.\t\)\@<=.*" contained containedin=gitcommitUntracked
syn match gitcommitDiscardedType "\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitDiscardedFile skipwhite
syn match gitcommitSelectedType "\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitSelectedFile skipwhite
syn match gitcommitUnmergedType "\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitUnmergedFile skipwhite
syn match gitcommitDiscardedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitDiscardedArrow
syn match gitcommitSelectedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow
syn match gitcommitUnmergedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow
syn match gitcommitDiscardedType "\%(^.\t\)\@<=[^[:punct:][:space:]][^/:]*[^[:punct:][:space:]][:]\ze "he=e-1 contained nextgroup=gitcommitDiscardedFile skipwhite
syn match gitcommitSelectedType "\%(^.\t\)\@<=[^[:punct:][:space:]][^/:]*[^[:punct:][:space:]][:]\ze "he=e-1 contained nextgroup=gitcommitSelectedFile skipwhite
syn match gitcommitUnmergedType "\%(^.\t\)\@<=[^[:punct:][:space:]][^/:]*[^[:punct:][:space:]][:]\ze "he=e-1 contained nextgroup=gitcommitUnmergedFile skipwhite
syn match gitcommitDiscardedFile "\S.\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitDiscardedArrow
syn match gitcommitSelectedFile "\S.\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow
syn match gitcommitUnmergedFile "\S.\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitUnmergedArrow
syn match gitcommitDiscardedArrow " -> " contained nextgroup=gitcommitDiscardedFile
syn match gitcommitSelectedArrow " -> " contained nextgroup=gitcommitSelectedFile
syn match gitcommitUnmergedArrow " -> " contained nextgroup=gitcommitSelectedFile
syn match gitcommitWarning "\%^[^#].*: needs merge$" nextgroup=gitcommitWarning skipnl
syn match gitcommitWarning "^[^#].*: needs merge$" nextgroup=gitcommitWarning skipnl contained
syn match gitcommitWarning "^\%(no changes added to commit\|nothing \%(added \)\=to commit\)\>.*\%$"
syn match gitcommitUnmergedArrow " -> " contained nextgroup=gitcommitUnmergedFile
hi def link gitcommitSummary Keyword
hi def link gitcommitTrailerToken Label
hi def link gitcommitComment Comment
hi def link gitcommitUntracked gitcommitComment
hi def link gitcommitDiscarded gitcommitComment
hi def link gitcommitSelected gitcommitComment
hi def link gitcommitUnmerged gitcommitComment
hi def link gitcommitHash Identifier
hi def link gitcommitOnBranch Comment
hi def link gitcommitBranch Special
hi def link gitcommitNoBranch gitCommitBranch
+10 -5
View File
@@ -2,7 +2,7 @@
" Language: git rebase --interactive
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Filenames: git-rebase-todo
" Last Change: 2019 Dec 06
" Last Change: 2022 Jan 05
if exists("b:current_syntax")
finish
@@ -10,8 +10,10 @@ endif
syn case match
syn match gitrebaseHash "\v<\x{7,}>" contained
syn match gitrebaseCommit "\v<\x{7,}>" nextgroup=gitrebaseSummary skipwhite
let s:c = escape((matchstr(getline('$'), '^[#;@!$%^&|:]\S\@!') . '#')[0], '^$.*[]~\"/')
syn match gitrebaseHash "\v<\x{7,}>" contained contains=@NoSpell
syn match gitrebaseCommit "\v<\x{7,}>" nextgroup=gitrebaseSummary skipwhite contains=@NoSpell
syn match gitrebasePick "\v^p%(ick)=>" nextgroup=gitrebaseCommit skipwhite
syn match gitrebaseReword "\v^r%(eword)=>" nextgroup=gitrebaseCommit skipwhite
syn match gitrebaseEdit "\v^e%(dit)=>" nextgroup=gitrebaseCommit skipwhite
@@ -26,12 +28,15 @@ syn match gitrebaseLabel "\v^l(abel)=>" nextgroup=gitrebaseName skipwhite
syn match gitrebaseReset "\v^(t|reset)=>" nextgroup=gitrebaseName skipwhite
syn match gitrebaseSummary ".*" contains=gitrebaseHash contained
syn match gitrebaseCommand ".*" contained
syn match gitrebaseComment "^\s*#.*" contains=gitrebaseHash
exe 'syn match gitrebaseComment " \@<=' . s:c . ' empty$" containedin=gitrebaseSummary contained'
exe 'syn match gitrebaseComment "^\s*' . s:c . '.*" contains=gitrebaseHash'
syn match gitrebaseSquashError "\v%^%(s%(quash)=>|f%(ixup)=>)" nextgroup=gitrebaseCommit skipwhite
syn match gitrebaseMergeOption "\v-[Cc]>" nextgroup=gitrebaseMergeCommit skipwhite contained
syn match gitrebaseMergeCommit "\v<\x{7,}>" nextgroup=gitrebaseName skipwhite contained
syn match gitrebaseName "\v[^[:space:].*?i:^~/-]\S+" nextgroup=gitrebaseMergeComment skipwhite contained
syn match gitrebaseMergeComment "#" nextgroup=gitrebaseSummary skipwhite contained
exe 'syn match gitrebaseMergeComment "' . s:c . '" nextgroup=gitrebaseSummary skipwhite contained'
unlet s:c
hi def link gitrebaseCommit gitrebaseHash
hi def link gitrebaseHash Identifier
+3 -2
View File
@@ -1,8 +1,9 @@
" Vim syntax file
" Language: i3 config file
" Maintainer: Mohamed Boughaba <mohamed dot bgb at gmail dot com>
" Original Author: Mohamed Boughaba <mohamed dot bgb at gmail dot com>
" Maintainer: Quentin Hibon (github user hiqua)
" Version: 0.4
" Last Change: 2021 Dec 14
" Last Change: 2022 Jan 04
" References:
" http://i3wm.org/docs/userguide.html#configuring
+1 -1
View File
@@ -1891,7 +1891,7 @@ OBJ_COMMON = \
$(OS_EXTRA_OBJ) \
$(NETBEANS_OBJ) \
$(CHANNEL_OBJ) \
$(XDIFF_OBJS)
$(XDIFF_OBJS_USED)
# The files included by tests are not in OBJ_COMMON.
OBJ_MAIN = \
+21 -2
View File
@@ -151,6 +151,7 @@ alloc(size_t size)
return lalloc(size, TRUE);
}
#if defined(FEAT_QUICKFIX) || defined(PROTO)
/*
* alloc() with an ID for alloc_fail().
*/
@@ -163,6 +164,7 @@ alloc_id(size_t size, alloc_id_T id UNUSED)
#endif
return lalloc(size, TRUE);
}
#endif
/*
* Allocate memory and set all bytes to zero.
@@ -178,6 +180,7 @@ alloc_clear(size_t size)
return p;
}
#if defined(FEAT_SIGNS) || defined(PROTO)
/*
* Same as alloc_clear() but with allocation id for testing
*/
@@ -190,6 +193,7 @@ alloc_clear_id(size_t size, alloc_id_T id UNUSED)
#endif
return alloc_clear(size);
}
#endif
/*
* Allocate memory like lalloc() and set all bytes to zero.
@@ -648,6 +652,7 @@ ga_clear_strings(garray_T *gap)
ga_clear(gap);
}
#if defined(FEAT_EVAL) || defined(PROTO)
/*
* Copy a growing array that contains a list of strings.
*/
@@ -682,6 +687,7 @@ ga_copy_strings(garray_T *from, garray_T *to)
to->ga_len = from->ga_len;
return OK;
}
#endif
/*
* Initialize a growing array. Don't forget to set ga_itemsize and
@@ -696,7 +702,7 @@ ga_init(garray_T *gap)
}
void
ga_init2(garray_T *gap, int itemsize, int growsize)
ga_init2(garray_T *gap, size_t itemsize, int growsize)
{
ga_init(gap);
gap->ga_itemsize = itemsize;
@@ -783,7 +789,7 @@ ga_concat_strings(garray_T *gap, char *sep)
* When out of memory nothing changes and FAIL is returned.
*/
int
ga_add_string(garray_T *gap, char_u *p)
ga_copy_string(garray_T *gap, char_u *p)
{
char_u *cp = vim_strsave(p);
@@ -799,6 +805,19 @@ ga_add_string(garray_T *gap, char_u *p)
return OK;
}
/*
* Add string "p" to "gap".
* When out of memory "p" is freed and FAIL is returned.
*/
int
ga_add_string(garray_T *gap, char_u *p)
{
if (ga_grow(gap, 1) == FAIL)
return FAIL;
((char_u **)(gap->ga_data))[gap->ga_len++] = p;
return OK;
}
/*
* Concatenate a string to a growarray which contains bytes.
* When "s" is NULL does not do anything.
+2 -2
View File
@@ -51,7 +51,7 @@ alist_clear(alist_T *al)
void
alist_init(alist_T *al)
{
ga_init2(&al->al_ga, (int)sizeof(aentry_T), 5);
ga_init2(&al->al_ga, sizeof(aentry_T), 5);
}
/*
@@ -275,7 +275,7 @@ do_one_arg(char_u *str)
static int
get_arglist(garray_T *gap, char_u *str, int escaped)
{
ga_init2(gap, (int)sizeof(char_u *), 20);
ga_init2(gap, sizeof(char_u *), 20);
while (*str != NUL)
{
if (ga_grow(gap, 1) == FAIL)
+15
View File
@@ -716,6 +716,7 @@ LUA_SRC
vi_cv_path_plain_lua
vi_cv_path_luajit
vi_cv_path_lua
XDIFF_OBJS_USED
compiledby
dogvimdiff
dovimdiff
@@ -5370,6 +5371,20 @@ else
$as_echo "yes" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking diff feature" >&5
$as_echo_n "checking diff feature... " >&6; }
if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled in $features version" >&5
$as_echo "disabled in $features version" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled" >&5
$as_echo "enabled" >&6; }
$as_echo "#define FEAT_DIFF 1" >>confdefs.h
XDIFF_OBJS_USED="\$(XDIFF_OBJS)"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-luainterp argument" >&5
$as_echo_n "checking --enable-luainterp argument... " >&6; }
# Check whether --enable-luainterp was given.
+9 -2
View File
@@ -1425,8 +1425,6 @@ ex_doautoall(exarg_T *eap)
if (call_do_modelines && did_aucmd)
do_modelines(0);
}
check_cursor(); // just in case lines got deleted
}
/*
@@ -1533,6 +1531,10 @@ aucmd_prepbuf(
curbuf = buf;
aco->new_curwin_id = curwin->w_id;
set_bufref(&aco->new_curbuf, curbuf);
// disable the Visual area, the position may be invalid in another buffer
aco->save_VIsual_active = VIsual_active;
VIsual_active = FALSE;
}
/*
@@ -1657,6 +1659,11 @@ win_found:
check_cursor();
}
}
check_cursor(); // just in case lines got deleted
VIsual_active = aco->save_VIsual_active;
if (VIsual_active)
check_pos(curbuf, &VIsual);
}
static int autocmd_nested = FALSE;
+6
View File
@@ -138,6 +138,7 @@ read_buffer(
return retval;
}
#if defined(FEAT_EVAL) || defined(PROTO)
/*
* Ensure buffer "buf" is loaded. Does not trigger the swap-exists action.
*/
@@ -154,6 +155,7 @@ buffer_ensure_loaded(buf_T *buf)
aucmd_restbuf(&aco);
}
}
#endif
/*
* Open current buffer, that is: open the memfile and read the file into
@@ -5619,6 +5621,7 @@ bt_prompt(buf_T *buf)
return buf != NULL && buf->b_p_bt[0] == 'p' && buf->b_p_bt[1] == 'r';
}
#if defined(FEAT_PROP_POPUP) || defined(PROTO)
/*
* Return TRUE if "buf" is a buffer for a popup window.
*/
@@ -5628,6 +5631,7 @@ bt_popup(buf_T *buf)
return buf != NULL && buf->b_p_bt != NULL
&& buf->b_p_bt[0] == 'p' && buf->b_p_bt[1] == 'o';
}
#endif
/*
* Return TRUE if "buf" is a "nofile", "acwrite", "terminal" or "prompt"
@@ -5642,6 +5646,7 @@ bt_nofilename(buf_T *buf)
|| buf->b_p_bt[0] == 'p');
}
#if defined(FEAT_QUICKFIX) || defined(PROTO)
/*
* Return TRUE if "buf" has 'buftype' set to "nofile".
*/
@@ -5650,6 +5655,7 @@ bt_nofile(buf_T *buf)
{
return buf != NULL && buf->b_p_bt[0] == 'n' && buf->b_p_bt[2] == 'f';
}
#endif
/*
* Return TRUE if "buf" is a "nowrite", "nofile", "terminal" or "prompt"
+1 -1
View File
@@ -2332,7 +2332,7 @@ channel_add_block_id(chanpart_T *chanpart, int id)
garray_T *gap = &chanpart->ch_block_ids;
if (gap->ga_growsize == 0)
ga_init2(gap, (int)sizeof(int), 10);
ga_init2(gap, sizeof(int), 10);
if (ga_grow(gap, 1) == OK)
{
((int *)gap->ga_data)[gap->ga_len] = id;
+2
View File
@@ -1476,6 +1476,7 @@ skipwhite(char_u *q)
return p;
}
#if defined(FEAT_EVAL) || defined(PROTO)
/*
* skip over ' ', '\t' and '\n'.
*/
@@ -1488,6 +1489,7 @@ skipwhite_and_nl(char_u *q)
++p;
return p;
}
#endif
/*
* getwhitecols: return the number of whitespace
+2
View File
@@ -1544,6 +1544,7 @@ clip_x11_notify_cb(Widget w UNUSED, Atom *sel_atom UNUSED, Atom *target UNUSED)
/*
* Property callback to get a timestamp for XtOwnSelection.
*/
# if (defined(FEAT_X11) && defined(FEAT_XCLIPBOARD)) || defined(PROTO)
static void
clip_x11_timestamp_cb(
Widget w,
@@ -1596,6 +1597,7 @@ x11_setup_selection(Widget w)
XtAddEventHandler(w, PropertyChangeMask, False,
/*(XtEventHandler)*/clip_x11_timestamp_cb, (XtPointer)NULL);
}
# endif
static void
clip_x11_request_selection_cb(
+3 -3
View File
@@ -2354,7 +2354,7 @@ expand_shellcmd(
// Go over all directories in $PATH. Expand matches in that directory and
// collect them in "ga". When "." is not in $PATH also expand for the
// current directory, to find "subdir/cmd".
ga_init2(&ga, (int)sizeof(char *), 10);
ga_init2(&ga, sizeof(char *), 10);
hash_init(&found_ht);
for (s = path; ; s = e)
{
@@ -2509,7 +2509,7 @@ ExpandUserDefined(
if (retstr == NULL)
return FAIL;
ga_init2(&ga, (int)sizeof(char *), 3);
ga_init2(&ga, sizeof(char *), 3);
for (s = retstr; *s != NUL; s = e)
{
e = vim_strchr(s, '\n');
@@ -2555,7 +2555,7 @@ ExpandUserList(
if (retlist == NULL)
return FAIL;
ga_init2(&ga, (int)sizeof(char *), 3);
ga_init2(&ga, sizeof(char *), 3);
// Loop over the items in the list.
FOR_ALL_LIST_ITEMS(retlist, li)
{
+4
View File
@@ -37,11 +37,13 @@ get_histentry(int hist_type)
return history[hist_type];
}
#if defined(FEAT_VIMINFO) || defined(PROTO)
void
set_histentry(int hist_type, histentry_T *entry)
{
history[hist_type] = entry;
}
#endif
int *
get_hisidx(int hist_type)
@@ -49,11 +51,13 @@ get_hisidx(int hist_type)
return &hisidx[hist_type];
}
#if defined(FEAT_VIMINFO) || defined(PROTO)
int *
get_hisnum(int hist_type)
{
return &hisnum[hist_type];
}
#endif
/*
* Translate a history character to the associated type number.
+2
View File
@@ -38,6 +38,8 @@ X_PRE_LIBS = @X_PRE_LIBS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIB@
XDIFF_OBJS_USED = @XDIFF_OBJS_USED@
LUA_LIBS = @LUA_LIBS@
LUA_SRC = @LUA_SRC@
LUA_OBJ = @LUA_OBJ@
+10
View File
@@ -606,6 +606,16 @@ else
AC_MSG_RESULT(yes)
fi
AC_MSG_CHECKING([diff feature])
if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then
AC_MSG_RESULT([disabled in $features version])
else
AC_MSG_RESULT(enabled)
AC_DEFINE(FEAT_DIFF)
XDIFF_OBJS_USED="\$(XDIFF_OBJS)"
AC_SUBST(XDIFF_OBJS_USED)
fi
dnl Check for Lua feature.
AC_MSG_CHECKING(--enable-luainterp argument)
AC_ARG_ENABLE(luainterp,
+2
View File
@@ -247,6 +247,7 @@ crypt_get_header_len(int method_nr)
}
#if defined(FEAT_SODIUM) || defined(PROTO)
/*
* Get maximum crypt method specific length of the file header in bytes.
*/
@@ -265,6 +266,7 @@ crypt_get_max_header_len()
}
return max;
}
#endif
/*
* Set the crypt method for buffer "buf" to "method_nr" using the int value as
+1 -1
View File
@@ -759,7 +759,7 @@ dict2string(typval_T *tv, int copyID, int restore_copyID)
if ((d = tv->vval.v_dict) == NULL)
return NULL;
ga_init2(&ga, (int)sizeof(char), 80);
ga_init2(&ga, sizeof(char), 80);
ga_append(&ga, '{');
todo = (int)d->dv_hashtab.ht_used;
+1 -1
View File
@@ -2632,7 +2632,7 @@ ex_loadkeymap(exarg_T *eap)
keymap_unload();
curbuf->b_kmap_state = 0;
ga_init2(&curbuf->b_kmap_ga, (int)sizeof(kmap_T), 20);
ga_init2(&curbuf->b_kmap_ga, sizeof(kmap_T), 20);
// Set 'cpoptions' to "C" to avoid line continuation.
p_cpo = (char_u *)"C";
+2
View File
@@ -1724,6 +1724,7 @@ edit_putchar(int c, int highlight)
}
}
#if defined(FEAT_JOB_CHANNEL) || defined(PROTO)
/*
* Set the insert start position for when using a prompt buffer.
*/
@@ -1737,6 +1738,7 @@ set_insstart(linenr_T lnum, int col)
Insstart_blank_vcol = MAXCOL;
arrow_used = FALSE;
}
#endif
/*
* Undo the previous edit_putchar().
+358 -39
View File
File diff suppressed because it is too large Load Diff
+19 -47
View File
@@ -487,7 +487,7 @@ typval2string(typval_T *tv, int convert)
if (convert && tv->v_type == VAR_LIST)
{
ga_init2(&ga, (int)sizeof(char), 80);
ga_init2(&ga, sizeof(char), 80);
if (tv->vval.v_list != NULL)
{
list_join(&ga, tv->vval.v_list, (char_u *)"\n", TRUE, FALSE, 0);
@@ -653,50 +653,10 @@ call_vim_function(
return ret;
}
/*
* Call Vim script function "func" and return the result as a number.
* Returns -1 when calling the function fails.
* Uses argv[0] to argv[argc - 1] for the function arguments. argv[argc] should
* have type VAR_UNKNOWN.
*/
varnumber_T
call_func_retnr(
char_u *func,
int argc,
typval_T *argv)
{
typval_T rettv;
varnumber_T retval;
if (call_vim_function(func, argc, argv, &rettv) == FAIL)
return -1;
retval = tv_get_number_chk(&rettv, NULL);
clear_tv(&rettv);
return retval;
}
/*
* Call Vim script function like call_func_retnr() and drop the result.
* Returns FAIL when calling the function fails.
*/
int
call_func_noret(
char_u *func,
int argc,
typval_T *argv)
{
typval_T rettv;
if (call_vim_function(func, argc, argv, &rettv) == FAIL)
return FAIL;
clear_tv(&rettv);
return OK;
}
/*
* Call Vim script function "func" and return the result as a string.
* Uses "argv" and "argc" as call_func_retnr().
* Uses "argv[0]" to "argv[argc - 1]" for the function arguments. "argv[argc]"
* should have type VAR_UNKNOWN.
* Returns NULL when calling the function fails.
*/
void *
@@ -718,7 +678,7 @@ call_func_retstr(
/*
* Call Vim script function "func" and return the result as a List.
* Uses "argv" and "argc" as call_func_retnr().
* Uses "argv" and "argc" as call_func_retstr().
* Returns NULL when there is something wrong.
*/
void *
@@ -926,7 +886,9 @@ get_lval(
if (*p == '.' && in_vim9script())
{
imported_T *import = find_imported(lp->ll_name, p - lp->ll_name, NULL);
imported_T *import = find_imported(lp->ll_name, p - lp->ll_name,
TRUE, NULL);
if (import != NULL)
{
ufunc_T *ufunc;
@@ -3481,6 +3443,7 @@ eval7(
&& (evalarg->eval_flags & EVAL_EVALUATE);
int len;
char_u *s;
char_u *name_start = NULL;
char_u *start_leader, *end_leader;
int ret = OK;
char_u *alias;
@@ -3713,8 +3676,11 @@ eval7(
ret = OK;
}
else
{
name_start = s;
ret = eval_variable(s, len, 0, rettv, NULL,
EVAL_VAR_VERBOSE + EVAL_VAR_IMPORT);
}
}
else
{
@@ -3729,7 +3695,7 @@ eval7(
// Handle following '[', '(' and '.' for expr[expr], expr.name,
// expr(expr), expr->name(expr)
if (ret == OK)
ret = handle_subscript(arg, rettv, evalarg, TRUE);
ret = handle_subscript(arg, name_start, rettv, evalarg, TRUE);
/*
* Apply logical NOT and unary '-', from right to left, ignore '+'.
@@ -4779,6 +4745,8 @@ set_ref_in_ht(hashtab_T *ht, int copyID, list_stack_T **list_stack)
return abort;
}
#if defined(FEAT_LUA) || defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) \
|| defined(PROTO)
/*
* Mark a dict and its items with "copyID".
* Returns TRUE if setting references failed somehow.
@@ -4793,6 +4761,7 @@ set_ref_in_dict(dict_T *d, int copyID)
}
return FALSE;
}
#endif
/*
* Mark a list and its items with "copyID".
@@ -5891,10 +5860,12 @@ eval_isdictc(int c)
* - method call: var->method()
*
* Can all be combined in any order: dict.func(expr)[idx]['func'](expr)->len()
* "name_start" points to a variable before the subscript or is NULL.
*/
int
handle_subscript(
char_u **arg,
char_u *name_start,
typval_T *rettv,
evalarg_T *evalarg,
int verbose) // give error messages
@@ -5936,7 +5907,8 @@ handle_subscript(
if (**arg != '.')
{
if (verbose)
semsg(_(e_expected_str_but_got_str), "'.'", *arg);
semsg(_(e_expected_dot_after_name_str),
name_start != NULL ? name_start: *arg);
ret = FAIL;
break;
}
+1 -3
View File
@@ -864,9 +864,7 @@ f_setline(typval_T *argvars, typval_T *rettv)
}
#endif // FEAT_EVAL
#if defined(FEAT_JOB_CHANNEL) \
|| defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) \
|| defined(PROTO)
#if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) || defined(PROTO)
/*
* Make "buf" the current buffer. restore_buffer() MUST be called to undo.
* No autocommands will be executed. Use aucmd_prepbuf() if there are any.
+3 -1
View File
@@ -3529,6 +3529,7 @@ execute_redir_str(char_u *value, int value_len)
}
}
#if defined(FEAT_LUA) || defined(PROTO)
/*
* Get next line from a string containing NL separated lines.
* Called by do_cmdline() to get the next line.
@@ -3570,6 +3571,7 @@ execute_cmds_from_string(char_u *str)
do_cmdline(NULL, get_str_line, (void *)&str,
DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT|DOCMD_KEYTYPED);
}
#endif
/*
* Get next line from a list.
@@ -3660,7 +3662,7 @@ execute_common(typval_T *argvars, typval_T *rettv, int arg_off)
if (redir_execute)
save_ga = redir_execute_ga;
ga_init2(&redir_execute_ga, (int)sizeof(char), 500);
ga_init2(&redir_execute_ga, sizeof(char), 500);
redir_execute = TRUE;
redir_off = FALSE;
if (!echo_output)
+42 -8
View File
@@ -1241,8 +1241,8 @@ list_arg_vars(exarg_T *eap, char_u *arg, int *first)
{
// handle d.key, l[idx], f(expr)
arg_subsc = arg;
if (handle_subscript(&arg, &tv, &EVALARG_EVALUATE, TRUE)
== FAIL)
if (handle_subscript(&arg, name_start, &tv,
&EVALARG_EVALUATE, TRUE) == FAIL)
error = TRUE;
else
{
@@ -2685,14 +2685,14 @@ eval_variable(
char_u *p = STRNCMP(name, "s:", 2) == 0 ? name + 2 : name;
if (sid == 0)
import = find_imported(p, 0, NULL);
import = find_imported(p, 0, TRUE, NULL);
// imported variable from another script
if (import != NULL || sid != 0)
{
if ((flags & EVAL_VAR_IMPORT) == 0)
{
if (sid != 0 && SCRIPT_ID_VALID(sid))
if (SCRIPT_ID_VALID(sid))
{
ht = &SCRIPT_VARS(sid);
if (ht != NULL)
@@ -2879,6 +2879,39 @@ find_var(char_u *name, hashtab_T **htp, int no_autoload)
return NULL;
}
/*
* Like find_var() but if the name starts with <SNR>99_ then look in the
* referenced script (used for a funcref).
*/
dictitem_T *
find_var_also_in_script(char_u *name, hashtab_T **htp, int no_autoload)
{
if (STRNCMP(name, "<SNR>", 5) == 0 && isdigit(name[5]))
{
char_u *p = name + 5;
int sid = getdigits(&p);
if (SCRIPT_ID_VALID(sid) && *p == '_')
{
hashtab_T *ht = &SCRIPT_VARS(sid);
if (ht != NULL)
{
dictitem_T *di = find_var_in_ht(ht, 0, p + 1, no_autoload);
if (di != NULL)
{
if (htp != NULL)
*htp = ht;
return di;
}
}
}
}
return find_var(name, htp, no_autoload);
}
/*
* Find variable "varname" in hashtab "ht" with name "htname".
* When "varname" is empty returns curwin/curtab/etc vars dictionary.
@@ -2984,7 +3017,7 @@ lookup_scriptitem(
res = HASHITEM_EMPTY(hi) ? FAIL : OK;
// if not script-local, then perhaps imported
if (res == FAIL && find_imported(p, 0, NULL) != NULL)
if (res == FAIL && find_imported(p, 0, FALSE, NULL) != NULL)
res = OK;
if (p != buffer)
vim_free(p);
@@ -3357,7 +3390,7 @@ set_var_const(
if (di == NULL && var_in_vim9script)
{
imported_T *import = find_imported(varname, 0, NULL);
imported_T *import = find_imported(varname, 0, FALSE, NULL);
if (import != NULL)
{
@@ -3957,7 +3990,8 @@ var_exists(char_u *var)
{
// handle d.key, l[idx], f(expr)
arg = skipwhite(arg);
n = (handle_subscript(&arg, &tv, &EVALARG_EVALUATE, FALSE) == OK);
n = (handle_subscript(&arg, name, &tv, &EVALARG_EVALUATE,
FALSE) == OK);
if (n)
clear_tv(&tv);
}
@@ -3993,7 +4027,7 @@ clear_redir_lval(void)
void
init_redir_ga(void)
{
ga_init2(&redir_ga, (int)sizeof(char), 500);
ga_init2(&redir_ga, sizeof(char), 500);
}
/*
+7 -1
View File
@@ -743,6 +743,12 @@ f_win_execute(typval_T *argvars, typval_T *rettv)
// Update the status line if the cursor moved.
if (win_valid(wp) && !EQUAL_POS(curpos, wp->w_cursor))
wp->w_redr_status = TRUE;
// In case the command moved the cursor or changed the Visual area,
// check it is valid.
check_cursor();
if (VIsual_active)
check_pos(curbuf, &VIsual);
}
}
@@ -1114,7 +1120,7 @@ f_winrestcmd(typval_T *argvars UNUSED, typval_T *rettv)
garray_T ga;
char_u buf[50];
ga_init2(&ga, (int)sizeof(char), 70);
ga_init2(&ga, sizeof(char), 70);
// Do this twice to handle some window layouts properly.
for (i = 0; i < 2; ++i)
+5 -1
View File
@@ -697,7 +697,7 @@ do_cmdline(
#ifdef FEAT_EVAL
CLEAR_FIELD(cstack);
cstack.cs_idx = -1;
ga_init2(&lines_ga, (int)sizeof(wcmd_T), 10);
ga_init2(&lines_ga, sizeof(wcmd_T), 10);
real_cookie = getline_cookie(fgetline, cookie);
@@ -3088,6 +3088,7 @@ parse_command_modifiers(
return OK;
}
#if defined(FEAT_EVAL) || defined(PROTO)
/*
* Return TRUE if "cmod" has anything set.
*/
@@ -3116,6 +3117,7 @@ cmdmod_error(int ignore_silent)
}
return FALSE;
}
#endif
/*
* Apply the command modifiers. Saves current state in "cmdmod", call
@@ -3399,6 +3401,7 @@ append_command(char_u *cmd)
*d = NUL;
}
#if defined(FEAT_EVAL) || defined(PROTO)
/*
* If "start" points "&opt", "&l:opt", "&g:opt" or "$ENV" return a pointer to
* the name. Otherwise just return "start".
@@ -3419,6 +3422,7 @@ skip_option_env_lead(char_u *start)
name += 1;
return name;
}
#endif
/*
* Find an Ex command by its name, either built-in or user.
+26 -24
View File
@@ -4107,7 +4107,33 @@ f_setcmdpos(typval_T *argvars, typval_T *rettv)
if (pos >= 0)
rettv->vval.v_number = set_cmdline_pos(pos);
}
#endif
#if defined(FEAT_EVAL) || defined(FEAT_CMDWIN)
/*
* Get the current command-line type.
* Returns ':' or '/' or '?' or '@' or '>' or '-'
* Only works when the command line is being edited.
* Returns NUL when something is wrong.
*/
static int
get_cmdline_type(void)
{
cmdline_info_T *p = get_ccline_ptr();
if (p == NULL)
return NUL;
if (p->cmdfirstc == NUL)
return
# ifdef FEAT_EVAL
(p->input_fn) ? '@' :
# endif
'-';
return p->cmdfirstc;
}
#endif
#if defined(FEAT_EVAL) || defined(PROTO)
/*
* "getcmdtype()" function
*/
@@ -4125,30 +4151,6 @@ f_getcmdtype(typval_T *argvars UNUSED, typval_T *rettv)
#endif
#if defined(FEAT_EVAL) || defined(FEAT_CMDWIN) || defined(PROTO)
/*
* Get the current command-line type.
* Returns ':' or '/' or '?' or '@' or '>' or '-'
* Only works when the command line is being edited.
* Returns NUL when something is wrong.
*/
int
get_cmdline_type(void)
{
cmdline_info_T *p = get_ccline_ptr();
if (p == NULL)
return NUL;
if (p->cmdfirstc == NUL)
return
# ifdef FEAT_EVAL
(p->input_fn) ? '@' :
# endif
'-';
return p->cmdfirstc;
}
#endif
/*
* Return the first character of the current command line.
*/
+2 -1
View File
@@ -345,8 +345,9 @@
/*
* +diff Displaying diffs in a nice way.
* Requires +windows and +autocmd.
* Can be enabled in autoconf already.
*/
#if defined(FEAT_NORMAL)
#if defined(FEAT_NORMAL) && !defined(FEAT_DIFF)
# define FEAT_DIFF
#endif
+1 -1
View File
@@ -4809,7 +4809,7 @@ readdir_core(
struct dirent *dp;
# endif
ga_init2(gap, (int)sizeof(void *), 20);
ga_init2(gap, sizeof(void *), 20);
# ifdef FEAT_EVAL
# define FREE_ITEM(item) do { \
+2 -2
View File
@@ -1388,7 +1388,7 @@ f_globpath(typval_T *argvars, typval_T *rettv)
}
if (file != NULL && !error)
{
ga_init2(&ga, (int)sizeof(char_u *), 10);
ga_init2(&ga, sizeof(char_u *), 10);
globpath(tv_get_string(&argvars[0]), file, &ga, flags);
if (rettv->v_type == VAR_STRING)
rettv->vval.v_string = ga_concat_strings(&ga, "\n");
@@ -3908,7 +3908,7 @@ gen_expand_wildcards(
/*
* The matching file names are stored in a growarray. Init it empty.
*/
ga_init2(&ga, (int)sizeof(char_u *), 30);
ga_init2(&ga, sizeof(char_u *), 30);
for (i = 0; i < num_pat; ++i)
{
+2 -2
View File
@@ -2430,7 +2430,7 @@ uniquefy_paths(garray_T *gap, char_u *pattern)
char_u *short_name;
remove_duplicates(gap);
ga_init2(&path_ga, (int)sizeof(char_u *), 1);
ga_init2(&path_ga, sizeof(char_u *), 1);
/*
* We need to prepend a '*' at the beginning of file_pattern so that the
@@ -2611,7 +2611,7 @@ expand_in_path(
return 0;
mch_dirname(curdir, MAXPATHL);
ga_init2(&path_ga, (int)sizeof(char_u *), 1);
ga_init2(&path_ga, sizeof(char_u *), 1);
expand_path_option(curdir, &path_ga);
vim_free(curdir);
if (path_ga.ga_len == 0)
+3 -3
View File
@@ -647,7 +647,7 @@ foldCreate(linenr_T start, linenr_T end)
if (ga_grow(gap, 1) == OK)
{
fp = (fold_T *)gap->ga_data + i;
ga_init2(&fold_ga, (int)sizeof(fold_T), 10);
ga_init2(&fold_ga, sizeof(fold_T), 10);
// Count number of folds that will be contained in the new fold.
for (cont = 0; i + cont < gap->ga_len; ++cont)
@@ -1018,7 +1018,7 @@ foldMoveTo(
void
foldInitWin(win_T *new_win)
{
ga_init2(&new_win->w_folds, (int)sizeof(fold_T), 10);
ga_init2(&new_win->w_folds, sizeof(fold_T), 10);
}
// find_wl_entry() {{{2
@@ -2868,7 +2868,7 @@ foldInsert(garray_T *gap, int i)
if (gap->ga_len > 0 && i < gap->ga_len)
mch_memmove(fp + 1, fp, sizeof(fold_T) * (gap->ga_len - i));
++gap->ga_len;
ga_init2(&fp->fd_nested, (int)sizeof(fold_T), 10);
ga_init2(&fp->fd_nested, sizeof(fold_T), 10);
return OK;
}
+10
View File
@@ -440,7 +440,9 @@ EXTERN type_T t_dict_string INIT6(VAR_DICT, 0, 0, TTFLAG_STATIC, &t_string, NULL
#endif
#ifdef FEAT_EVAL
EXTERN int did_source_packages INIT(= FALSE);
#endif
// Magic number used for hashitem "hi_key" value indicating a deleted item.
// Only the address is used.
@@ -1155,7 +1157,9 @@ EXTERN int ctrl_c_interrupts INIT(= TRUE); // CTRL-C sets got_int
EXTERN cmdmod_T cmdmod; // Ex command modifiers
#ifdef FEAT_EVAL
EXTERN int is_export INIT(= FALSE); // :export {cmd}
#endif
EXTERN int msg_silent INIT(= 0); // don't print messages
EXTERN int emsg_silent INIT(= 0); // don't print error messages
@@ -1192,7 +1196,9 @@ EXTERN typebuf_T typebuf // typeahead buffer
#endif
;
EXTERN int ex_normal_busy INIT(= 0); // recursiveness of ex_normal()
#ifdef FEAT_EVAL
EXTERN int in_feedkeys INIT(= 0); // ex_normal_busy set in feedkeys()
#endif
EXTERN int ex_normal_lock INIT(= 0); // forbid use of ex_normal()
#ifdef FEAT_EVAL
@@ -1396,8 +1402,10 @@ EXTERN char_u no_lines_msg[] INIT(= N_("--No lines in buffer--"));
EXTERN long sub_nsubs; // total number of substitutions
EXTERN linenr_T sub_nlines; // total number of lines changed
#ifdef FEAT_EVAL
// Used when a compiled :substitute has an expression.
EXTERN struct subs_expr_S *substitute_instr INIT(= NULL);
#endif
// table to store parsed 'wildmode'
EXTERN char_u wim_flags[4];
@@ -1592,7 +1600,9 @@ EXTERN int netbeansSuppressNoLines INIT(= 0); // skip "No lines in buffer"
EXTERN char top_bot_msg[] INIT(= N_("search hit TOP, continuing at BOTTOM"));
EXTERN char bot_top_msg[] INIT(= N_("search hit BOTTOM, continuing at TOP"));
#ifdef FEAT_EVAL
EXTERN char line_msg[] INIT(= N_(" line "));
#endif
#ifdef FEAT_CRYPT
EXTERN char need_key_msg[] INIT(= N_("Need encryption key for \"%s\""));
+4 -3
View File
@@ -133,6 +133,7 @@ free_xim_stuff(void)
}
#endif
#if defined(FEAT_EVAL) || defined(PROTO)
/*
* Mark the global 'imactivatefunc' and 'imstatusfunc' callbacks with 'copyID'
* so that they are not garbage collected.
@@ -142,14 +143,14 @@ set_ref_in_im_funcs(int copyID UNUSED)
{
int abort = FALSE;
#if defined(FEAT_EVAL) && \
(defined(FEAT_XIM) || defined(IME_WITHOUT_XIM) || defined(VIMDLL))
# if defined(FEAT_XIM) || defined(IME_WITHOUT_XIM) || defined(VIMDLL)
abort = set_ref_in_callback(&imaf_cb, copyID);
abort = abort || set_ref_in_callback(&imsf_cb, copyID);
#endif
# endif
return abort;
}
#endif
#if defined(FEAT_XIM) || defined(PROTO)
+2 -2
View File
@@ -1650,7 +1650,7 @@ prt_flush_buffer(void)
prt_write_string("s\n");
ga_clear(&prt_ps_buffer);
ga_init2(&prt_ps_buffer, (int)sizeof(char), prt_bufsiz);
ga_init2(&prt_ps_buffer, sizeof(char), prt_bufsiz);
}
}
@@ -2649,7 +2649,7 @@ mch_print_init(
prt_bufsiz = psettings->chars_per_line;
if (prt_out_mbyte)
prt_bufsiz *= 2;
ga_init2(&prt_ps_buffer, (int)sizeof(char), prt_bufsiz);
ga_init2(&prt_ps_buffer, sizeof(char), prt_bufsiz);
prt_page_num = 0;
+2
View File
@@ -288,6 +288,7 @@ hash_lock(hashtab_T *ht)
++ht->ht_locked;
}
#if defined(FEAT_PROP_POPUP) || defined(PROTO)
/*
* Lock a hashtable at the specified number of entries.
* Caller must make sure no more than "size" entries will be added.
@@ -299,6 +300,7 @@ hash_lock_size(hashtab_T *ht, int size)
(void)hash_may_resize(ht, size);
++ht->ht_locked;
}
#endif
/*
* Unlock a hashtable: allow ht_array changes again.
+1 -1
View File
@@ -999,7 +999,7 @@ helptags_one(
// If using the "++t" argument or generating tags for "$VIMRUNTIME/doc"
// add the "help-tags" tag.
ga_init2(&ga, (int)sizeof(char_u *), 100);
ga_init2(&ga, sizeof(char_u *), 100);
if (add_help_tags || fullpathcmp((char_u *)"$VIMRUNTIME/doc",
dir, FALSE, TRUE) == FPC_SAME)
{
+19 -14
View File
@@ -343,6 +343,7 @@ static char *(highlight_init_dark[]) = {
NULL
};
#if defined(FEAT_SYN_HL) || defined(PROTO)
/*
* Returns the number of highlight groups.
*/
@@ -369,6 +370,7 @@ highlight_link_id(int id)
{
return HL_TABLE()[id].sg_link;
}
#endif
void
init_highlight(
@@ -458,6 +460,21 @@ init_highlight(
#endif
}
#if defined(FEAT_EVAL) && (defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS))
/*
* Load a default color list. Intended to support legacy color names but allows
* the user to override the color values. Only loaded once.
*/
static void
load_default_colors_lists()
{
// Lacking a default color list isn't the end of the world but it is likely
// an inconvenience so users should know when it is missing.
if (source_runtime((char_u *)"colors/lists/default.vim", DIP_ALL) != OK)
msg("failed to load colors/lists/default.vim");
}
#endif
/*
* Load color file "name".
* Return OK for success, FAIL for failure.
@@ -2270,7 +2287,7 @@ hex_digit(int c)
return 0x1ffffff;
}
guicolor_T
static guicolor_T
decode_hex_color(char_u *hex)
{
guicolor_T color;
@@ -2292,7 +2309,7 @@ decode_hex_color(char_u *hex)
// such name exists in the color table. The convention is to use lowercase for
// all keys in the v:colornames dictionary. The value can be either a string in
// the form #rrggbb or a number, either of which is converted to a guicolor_T.
guicolor_T
static guicolor_T
colorname2rgb(char_u *name)
{
dict_T *colornames_table = get_vim_var_dict(VV_COLORNAMES);
@@ -2333,18 +2350,6 @@ colorname2rgb(char_u *name)
return INVALCOLOR;
}
/*
* Load a default color list. Intended to support legacy color names but allows
* the user to override the color values. Only loaded once.
*/
void
load_default_colors_lists()
{
// Lacking a default color list isn't the end of the world but it is likely
// an inconvenience so users should know when it is missing.
if (source_runtime((char_u *)"colors/lists/default.vim", DIP_ALL) != OK)
msg("failed to load colors/lists/default.vim");
}
#endif
guicolor_T
+7 -7
View File
@@ -3264,7 +3264,7 @@ FunctionRepr(FunctionObject *self)
typval_T tv;
char_u numbuf[NUMBUFLEN];
ga_init2(&repr_ga, (int)sizeof(char), 70);
ga_init2(&repr_ga, sizeof(char), 70);
ga_concat(&repr_ga, (char_u *)"<vim.Function '");
if (self->name)
ga_concat(&repr_ga, self->name);
@@ -3789,14 +3789,14 @@ TabPageAttr(TabPageObject *self, char *name)
TabPageRepr(TabPageObject *self)
{
if (self->tab == INVALID_TABPAGE_VALUE)
return PyString_FromFormat("<tabpage object (deleted) at %p>", (self));
return PyString_FromFormat("<tabpage object (deleted) at %p>", (void *)self);
else
{
int t = get_tab_number(self->tab);
if (t == 0)
return PyString_FromFormat("<tabpage object (unknown) at %p>",
(self));
(void *)self);
else
return PyString_FromFormat("<tabpage %d>", t - 1);
}
@@ -4125,14 +4125,14 @@ WindowSetattr(WindowObject *self, char *name, PyObject *valObject)
WindowRepr(WindowObject *self)
{
if (self->win == INVALID_WINDOW_VALUE)
return PyString_FromFormat("<window object (deleted) at %p>", (self));
return PyString_FromFormat("<window object (deleted) at %p>", (void *)self);
else
{
int w = get_win_number(self->win, firstwin);
if (w == 0)
return PyString_FromFormat("<window object (unknown) at %p>",
(self));
(void *)self);
else
return PyString_FromFormat("<window %d>", w - 1);
}
@@ -5126,7 +5126,7 @@ RangeRepr(RangeObject *self)
{
if (self->buf->buf == INVALID_BUFFER_VALUE)
return PyString_FromFormat("<range object (for deleted buffer) at %p>",
(self));
(void *)self);
else
{
char *name = (char *)self->buf->buf->b_fname;
@@ -5378,7 +5378,7 @@ BufferRange(BufferObject *self, PyObject *args)
BufferRepr(BufferObject *self)
{
if (self->buf == INVALID_BUFFER_VALUE)
return PyString_FromFormat("<buffer object (deleted) at %p>", self);
return PyString_FromFormat("<buffer object (deleted) at %p>", (void *)self);
else
{
char *name = (char *)self->buf->b_fname;
+5 -1
View File
@@ -502,7 +502,11 @@ static int (*dll_rb_w32_snprintf)(char*, size_t, const char*, ...);
# endif
# endif
# if RUBY_VERSION >= 31
static void (*dll_rb_unexpected_type) (VALUE, int) ATTRIBUTE_NORETURN;
# ifdef _MSC_VER
static void (*dll_rb_unexpected_type) (VALUE, int);
# else
NORETURN(static void (*dll_rb_unexpected_type) (VALUE, int));
# endif
# endif
# if RUBY_VERSION >= 18
static char * (*dll_rb_string_value_ptr) (volatile VALUE*);
+34 -21
View File
@@ -915,13 +915,15 @@ get_breakindent_win(
win_T *wp,
char_u *line) // start of the line
{
static int prev_indent = 0; // cached indent value
static long prev_ts = 0L; // cached tabstop value
static char_u *prev_line = NULL; // cached pointer to line
static int prev_indent = 0; // cached indent value
static long prev_ts = 0L; // cached tabstop value
static char_u *prev_line = NULL; // cached pointer to line
static varnumber_T prev_tick = 0; // changedtick of cached value
# ifdef FEAT_VARTABS
static int *prev_vts = NULL; // cached vartabs values
static int *prev_vts = NULL; // cached vartabs values
# endif
static int prev_list = 0; // cached list value
static int prev_listopt = 0; // cached w_p_briopt_list value
int bri = 0;
// window width minus window margin space, i.e. what rests for text
const int eff_wwidth = wp->w_width
@@ -929,9 +931,10 @@ get_breakindent_win(
&& (vim_strchr(p_cpo, CPO_NUMCOL) == NULL)
? number_width(wp) + 1 : 0);
// used cached indent, unless pointer or 'tabstop' changed
// used cached indent, unless line, 'tabstop' or briopt_list changed
if (prev_line != line || prev_ts != wp->w_buffer->b_p_ts
|| prev_tick != CHANGEDTICK(wp->w_buffer)
|| prev_listopt != wp->w_briopt_list
# ifdef FEAT_VARTABS
|| prev_vts != wp->w_buffer->b_p_vts_array
# endif
@@ -949,6 +952,28 @@ get_breakindent_win(
prev_indent = get_indent_str(line,
(int)wp->w_buffer->b_p_ts, wp->w_p_list);
# endif
prev_listopt = wp->w_briopt_list;
// add additional indent for numbered lists
if (wp->w_briopt_list != 0)
{
regmatch_T regmatch;
regmatch.regprog = vim_regcomp(curbuf->b_p_flp,
RE_MAGIC + RE_STRING + RE_AUTO + RE_STRICT);
if (regmatch.regprog != NULL)
{
regmatch.rm_ic = FALSE;
if (vim_regexec(&regmatch, line, 0))
{
if (wp->w_briopt_list > 0)
prev_list = wp->w_briopt_list;
else
prev_list = (*regmatch.endp - *regmatch.startp);
}
vim_regfree(regmatch.regprog);
}
}
}
bri = prev_indent + wp->w_briopt_shift;
@@ -958,22 +983,10 @@ get_breakindent_win(
// add additional indent for numbered lists
if (wp->w_briopt_list != 0)
{
regmatch_T regmatch;
regmatch.regprog = vim_regcomp(curbuf->b_p_flp,
RE_MAGIC + RE_STRING + RE_AUTO + RE_STRICT);
if (regmatch.regprog != NULL)
{
regmatch.rm_ic = FALSE;
if (vim_regexec(&regmatch, line, 0))
{
if (wp->w_briopt_list > 0)
bri += wp->w_briopt_list;
else
bri = (*regmatch.endp - *regmatch.startp);
}
vim_regfree(regmatch.regprog);
}
if (wp->w_briopt_list > 0)
bri += prev_list;
else
bri = prev_list;
}
// indent minus the length of the showbreak string
+29 -6
View File
@@ -263,7 +263,9 @@ ins_ctrl_x(void)
/*
* Functions to check the current CTRL-X mode.
*/
#ifdef FEAT_CINDENT
int ctrl_x_mode_none(void) { return ctrl_x_mode == 0; }
#endif
int ctrl_x_mode_normal(void) { return ctrl_x_mode == CTRL_X_NORMAL; }
int ctrl_x_mode_scroll(void) { return ctrl_x_mode == CTRL_X_SCROLL; }
int ctrl_x_mode_whole_line(void) { return ctrl_x_mode == CTRL_X_WHOLE_LINE; }
@@ -698,7 +700,20 @@ ins_compl_add_infercase(
}
/*
* Add a match to the list of matches.
* Add a match to the list of matches. The arguments are:
* str - text of the match to add
* len - length of "str". If -1, then the length of "str" is
* computed.
* fname - file name to associate with this match.
* cptext - list of strings to use with this match (for abbr, menu, info
* and kind)
* user_data - user supplied data (any vim type) for this match
* cdir - match direction. If 0, use "compl_direction".
* flags_arg - match flags (cp_flags)
* adup - accept this match even if it is already present.
* If "cdir" is FORWARD, then the match is added after the current match.
* Otherwise, it is added before the current match.
*
* If the given string is already in the list of completions, then return
* NOTDONE, otherwise add it to the list and return OK. If there is an error,
* maybe because alloc() returns NULL, then FAIL is returned.
@@ -789,7 +804,8 @@ ins_compl_add(
match->cp_user_data = *user_data;
#endif
// Link the new match structure in the list of matches.
// Link the new match structure after (FORWARD) or before (BACKWARD) the
// current match in the list of matches .
if (compl_first_match == NULL)
match->cp_next = match->cp_prev = NULL;
else if (dir == FORWARD)
@@ -2709,6 +2725,7 @@ ins_compl_add_tv(typval_T *tv, int dir, int fast)
int flags = fast ? CP_FAST : 0;
char_u *(cptext[CPT_COUNT]);
typval_T user_data;
int status;
user_data.v_type = VAR_UNKNOWN;
if (tv->v_type == VAR_DICT && tv->vval.v_dict != NULL)
@@ -2740,8 +2757,14 @@ ins_compl_add_tv(typval_T *tv, int dir, int fast)
CLEAR_FIELD(cptext);
}
if (word == NULL || (!empty && *word == NUL))
{
clear_tv(&user_data);
return FAIL;
return ins_compl_add(word, -1, NULL, cptext, &user_data, dir, flags, dup);
}
status = ins_compl_add(word, -1, NULL, cptext, &user_data, dir, flags, dup);
if (status != OK)
clear_tv(&user_data);
return status;
}
/*
@@ -3162,8 +3185,8 @@ typedef struct
* st->dict_f - flag specifying whether "dict" is an exact file name or not
*
* Returns INS_COMPL_CPT_OK if the next value is processed successfully.
* Returns INS_COMPL_CPT_CONT to skip the current value and process the next
* option value.
* Returns INS_COMPL_CPT_CONT to skip the current completion source matching
* the "st->e_cpt" option value and process the next matching source.
* Returns INS_COMPL_CPT_END if all the values in "st->e_cpt" are processed.
*/
static int
@@ -4526,7 +4549,7 @@ get_userdefined_compl_info(colnr_T curs_col UNUSED)
return FAIL;
}
// Reset extended parameters of completion, when start new
// Reset extended parameters of completion, when starting new
// completion.
compl_opt_refresh_always = FALSE;
compl_opt_suppress_empty = FALSE;
+2 -2
View File
@@ -1308,7 +1308,7 @@ job_start(
job->jv_status = JOB_FAILED;
#ifndef USE_ARGV
ga_init2(&ga, (int)sizeof(char*), 20);
ga_init2(&ga, sizeof(char*), 20);
#endif
if (opt_arg != NULL)
@@ -1447,7 +1447,7 @@ job_start(
{
garray_T ga;
ga_init2(&ga, (int)sizeof(char), 200);
ga_init2(&ga, sizeof(char), 200);
for (i = 0; i < argc; ++i)
{
if (i > 0)
+3 -3
View File
@@ -1299,7 +1299,7 @@ list2string(typval_T *tv, int copyID, int restore_copyID)
if (tv->vval.v_list == NULL)
return NULL;
ga_init2(&ga, (int)sizeof(char), 80);
ga_init2(&ga, sizeof(char), 80);
ga_append(&ga, '[');
CHECK_LIST_MATERIALIZE(tv->vval.v_list);
if (list_join(&ga, tv->vval.v_list, (char_u *)", ",
@@ -1412,7 +1412,7 @@ list_join(
if (l->lv_len < 1)
return OK; // nothing to do
ga_init2(&join_ga, (int)sizeof(join_T), l->lv_len);
ga_init2(&join_ga, sizeof(join_T), l->lv_len);
retval = list_join_inner(gap, l, sep, echo_style, restore_copyID,
copyID, &join_ga);
@@ -1461,7 +1461,7 @@ f_join(typval_T *argvars, typval_T *rettv)
if (sep != NULL)
{
ga_init2(&ga, (int)sizeof(char), 80);
ga_init2(&ga, sizeof(char), 80);
list_join(&ga, argvars[0].vval.v_list, sep, TRUE, FALSE, 0);
ga_append(&ga, NUL);
rettv->vval.v_string = (char_u *)ga.ga_data;
+4
View File
@@ -1155,12 +1155,15 @@ state_no_longer_safe(char *reason UNUSED)
was_safe = FALSE;
}
#if defined(FEAT_EVAL) || defined(MESSAGE_QUEUE) || defined(PROTO)
int
get_was_safe_state(void)
{
return was_safe;
}
#endif
#if defined(MESSAGE_QUEUE) || defined(PROTO)
/*
* Invoked when leaving code that invokes callbacks. Then trigger
* SafeStateAgain, if it was safe when starting to wait for a character.
@@ -1201,6 +1204,7 @@ may_trigger_safestateagain(void)
"SafeState: back to waiting, not triggering SafeStateAgain");
#endif
}
#endif
/*
+2
View File
@@ -1368,6 +1368,7 @@ free_all_marks(void)
}
#endif
#if defined(FEAT_VIMINFO) || defined(PROTO)
/*
* Return a pointer to the named file marks.
*/
@@ -1376,6 +1377,7 @@ get_namedfm(void)
{
return namedfm;
}
#endif
#if defined(FEAT_EVAL) || defined(PROTO)
/*
+1 -1
View File
@@ -2691,7 +2691,7 @@ ex_menutranslate(exarg_T *eap UNUSED)
char_u *from, *from_noamp, *to;
if (menutrans_ga.ga_itemsize == 0)
ga_init2(&menutrans_ga, (int)sizeof(menutrans_T), 5);
ga_init2(&menutrans_ga, sizeof(menutrans_T), 5);
/*
* ":menutrans clear": clear all translations.
+5 -1
View File
@@ -587,7 +587,7 @@ ignore_error_for_testing(char_u *error)
if (STRCMP("RESET", error) == 0)
ga_clear_strings(&ignore_error_list);
else
ga_add_string(&ignore_error_list, error);
ga_copy_string(&ignore_error_list, error);
}
static int
@@ -876,6 +876,7 @@ internal_error(char *where)
siemsg(_(e_internal_error_str), where);
}
#if defined(FEAT_EVAL) || defined(PROTO)
/*
* Like internal_error() but do not call abort(), to avoid tests using
* test_unknown() and test_void() causing Vim to exit.
@@ -885,6 +886,7 @@ internal_error_no_abort(char *where)
{
semsg(_(e_internal_error_str), where);
}
#endif
// emsg3() and emsgn() are in misc2.c to avoid warnings for the prototypes.
@@ -894,6 +896,7 @@ emsg_invreg(int name)
semsg(_(e_invalid_register_name_str), transchar(name));
}
#if defined(FEAT_EVAL) || defined(PROTO)
/*
* Give an error message which contains %s for "name[len]".
*/
@@ -905,6 +908,7 @@ emsg_namelen(char *msg, char_u *name, int len)
semsg(msg, copy == NULL ? "NULL" : (char *)copy);
vim_free(copy);
}
#endif
/*
* Like msg(), but truncate to a single line if p_shm contains 't', or when
+3 -1
View File
@@ -1903,7 +1903,6 @@ vim_unsetenv(char_u *var)
vim_setenv(var, (char_u *)"");
#endif
}
#endif
/*
@@ -1921,6 +1920,7 @@ vim_setenv_ext(char_u *name, char_u *val)
&& STRICMP(name, "VIMRUNTIME") == 0)
didset_vimruntime = FALSE;
}
#endif
/*
* Our portable version of setenv.
@@ -2237,6 +2237,7 @@ fast_breakcheck(void)
}
}
# if defined(FEAT_SPELL) || defined(PROTO)
/*
* Like line_breakcheck() but check 100 times less often.
*/
@@ -2249,6 +2250,7 @@ veryfast_breakcheck(void)
ui_breakcheck();
}
}
#endif
#if defined(VIM_BACKTICK) || defined(FEAT_EVAL) \
|| (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
+2
View File
@@ -2431,6 +2431,7 @@ get_user_name(char_u *buf, int len)
return OK;
}
#if defined(EXITFREE) || defined(PROTOS)
/*
* Free the memory allocated by get_user_name()
*/
@@ -2439,6 +2440,7 @@ free_username(void)
{
vim_free(username);
}
#endif
#ifndef HAVE_QSORT
/*
+2 -2
View File
@@ -3350,6 +3350,7 @@ free_operatorfunc_option(void)
}
#endif
#if defined(FEAT_EVAL) || defined(PROTO)
/*
* Mark the global 'operatorfunc' callback with 'copyID' so that it is not
* garbage collected.
@@ -3359,12 +3360,11 @@ set_ref_in_opfunc(int copyID UNUSED)
{
int abort = FALSE;
#ifdef FEAT_EVAL
abort = set_ref_in_callback(&opfunc_cb, copyID);
#endif
return abort;
}
#endif
/*
* Handle the "g@" operator: call 'operatorfunc'.
+4
View File
@@ -771,6 +771,7 @@ set_number_default(char *name, long val)
options[opt_idx].def_val[VI_DEFAULT] = (char_u *)(long_i)val;
}
#if defined(FEAT_PROP_POPUP) || defined(PROTO)
/*
* Set all window-local and buffer-local options to the Vim default.
* local-global options will use the global value.
@@ -802,6 +803,7 @@ set_local_options_default(win_T *wp, int do_buffer)
curwin = save_curwin;
curbuf = curwin->w_buffer;
}
#endif
#if defined(EXITFREE) || defined(PROTO)
/*
@@ -5646,6 +5648,7 @@ get_option_var(int opt_idx)
return options[opt_idx].var;
}
#if defined(FEAT_EVAL) || defined(PROTO)
/*
* Return the full name of the option at 'opt_idx'
*/
@@ -5654,6 +5657,7 @@ get_option_fullname(int opt_idx)
{
return (char_u *)options[opt_idx].fullname;
}
#endif
/*
* Get the value of 'equalprg', either the buffer-local one or the global one.
+7 -8
View File
@@ -486,7 +486,9 @@ EXTERN int p_deco; // 'delcombine'
EXTERN char_u *p_ccv; // 'charconvert'
#endif
EXTERN int p_cdh; // 'cdhome'
#ifdef FEAT_CINDENT
EXTERN char_u *p_cino; // 'cinoptions'
#endif
#ifdef FEAT_CMDWIN
EXTERN char_u *p_cedit; // 'cedit'
EXTERN long p_cwh; // 'cmdwinheight'
@@ -747,13 +749,6 @@ EXTERN char_u *p_mef; // 'makeef'
EXTERN char_u *p_mp; // 'makeprg'
#endif
EXTERN char_u *p_mps; // 'matchpairs'
#ifdef FEAT_SIGNS
EXTERN char_u *p_scl; // signcolumn
#endif
#ifdef FEAT_SYN_HL
EXTERN char_u *p_cc; // 'colorcolumn'
EXTERN int p_cc_cols[256]; // array for 'colorcolumn' columns
#endif
EXTERN long p_mat; // 'matchtime'
EXTERN long p_mco; // 'maxcombine'
#ifdef FEAT_EVAL
@@ -862,7 +857,9 @@ EXTERN int p_ru; // 'ruler'
EXTERN char_u *p_ruf; // 'rulerformat'
#endif
EXTERN char_u *p_pp; // 'packpath'
#ifdef FEAT_QUICKFIX
EXTERN char_u *p_qftf; // 'quickfixtextfunc'
#endif
EXTERN char_u *p_rtp; // 'runtimepath'
EXTERN long p_sj; // 'scrolljump'
#if defined(MSWIN) && defined(FEAT_GUI)
@@ -971,7 +968,9 @@ EXTERN unsigned swb_flags;
#define SWB_NEWTAB 0x008
#define SWB_VSPLIT 0x010
#define SWB_USELAST 0x020
#ifdef FEAT_SYN_HL
EXTERN char_u *p_syn; // 'syntax'
#endif
EXTERN long p_ts; // 'tabstop'
EXTERN int p_tbs; // 'tagbsearch'
EXTERN char_u *p_tc; // 'tagcase'
@@ -1052,8 +1051,8 @@ EXTERN unsigned ttym_flags;
# define TTYM_URXVT 0x40
# define TTYM_SGR 0x80
#endif
EXTERN char_u *p_udir; // 'undodir'
#ifdef FEAT_PERSISTENT_UNDO
EXTERN char_u *p_udir; // 'undodir'
EXTERN int p_udf; // 'undofile'
#endif
EXTERN long p_ul; // 'undolevels'
+13
View File
@@ -454,6 +454,7 @@ set_string_option_direct_in_win(
unblock_autocmds();
}
#if defined(FEAT_PROP_POPUP) || defined(PROTO)
/*
* Like set_string_option_direct(), but for a buffer-local option in "buf".
* Blocks autocommands to avoid the old curbuf becoming invalid.
@@ -477,6 +478,7 @@ set_string_option_direct_in_buf(
curwin->w_buffer = curbuf;
unblock_autocmds();
}
#endif
/*
* Set a string option to a new value, and handle the effects.
@@ -756,6 +758,9 @@ did_set_string_option(
{
if (briopt_check(curwin) == FAIL)
errmsg = e_invalid_argument;
// list setting requires a redraw
if (curwin->w_briopt_list)
redraw_all_later(NOT_VALID);
}
#endif
@@ -2629,6 +2634,14 @@ ambw_end:
update_package_paths_in_lua();
#endif
#if defined(FEAT_LINEBREAK)
// Changing Formatlistpattern when briopt includes the list setting:
// redraw
if ((varp == &p_flp || varp == &(curbuf->b_p_flp))
&& curwin->w_briopt_list)
redraw_all_later(NOT_VALID);
#endif
if (curwin->w_curswant != MAXCOL
&& (get_option_flags(opt_idx) & (P_CURSWANT | P_RALL)) != 0)
curwin->w_set_curswant = TRUE;
+1 -1
View File
@@ -5280,7 +5280,7 @@ mch_job_start(char *cmd, job_T *job, jobopt_T *options)
ofd[1] = INVALID_HANDLE_VALUE;
efd[0] = INVALID_HANDLE_VALUE;
efd[1] = INVALID_HANDLE_VALUE;
ga_init2(&ga, (int)sizeof(wchar_t), 500);
ga_init2(&ga, sizeof(wchar_t), 500);
jo = CreateJobObject(NULL, NULL);
if (jo == NULL)
+2 -1
View File
@@ -17,10 +17,11 @@ void ga_clear(garray_T *gap);
void ga_clear_strings(garray_T *gap);
int ga_copy_strings(garray_T *from, garray_T *to);
void ga_init(garray_T *gap);
void ga_init2(garray_T *gap, int itemsize, int growsize);
void ga_init2(garray_T *gap, size_t itemsize, int growsize);
int ga_grow(garray_T *gap, int n);
int ga_grow_inner(garray_T *gap, int n);
char_u *ga_concat_strings(garray_T *gap, char *sep);
int ga_copy_string(garray_T *gap, char_u *p);
int ga_add_string(garray_T *gap, char_u *p);
void ga_concat(garray_T *gap, char_u *s);
void ga_concat_len(garray_T *gap, char_u *s, size_t len);
+1 -1
View File
@@ -70,7 +70,7 @@ char_u *find_name_end(char_u *arg, char_u **expr_start, char_u **expr_end, int f
int eval_isnamec(int c);
int eval_isnamec1(int c);
int eval_isdictc(int c);
int handle_subscript(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int verbose);
int handle_subscript(char_u **arg, char_u *name_start, typval_T *rettv, evalarg_T *evalarg, int verbose);
int item_copy(typval_T *from, typval_T *to, int deep, int copyID);
void echo_one(typval_T *rettv, int with_space, int *atstart, int *needclr);
void ex_echo(exarg_T *eap);
+1
View File
@@ -60,6 +60,7 @@ char_u *set_cmdarg(exarg_T *eap, char_u *oldarg);
int eval_variable(char_u *name, int len, scid_T sid, typval_T *rettv, dictitem_T **dip, int flags);
void check_vars(char_u *name, int len);
dictitem_T *find_var(char_u *name, hashtab_T **htp, int no_autoload);
dictitem_T *find_var_also_in_script(char_u *name, hashtab_T **htp, int no_autoload);
dictitem_T *find_var_in_ht(hashtab_T *ht, int htname, char_u *varname, int no_autoload);
hashtab_T *get_script_local_ht(void);
int lookup_scriptitem(char_u *name, size_t len, int cmd, cctx_T *dummy);
-1
View File
@@ -34,7 +34,6 @@ void f_getcmdline(typval_T *argvars, typval_T *rettv);
void f_getcmdpos(typval_T *argvars, typval_T *rettv);
void f_setcmdpos(typval_T *argvars, typval_T *rettv);
void f_getcmdtype(typval_T *argvars, typval_T *rettv);
int get_cmdline_type(void);
int get_cmdline_firstc(void);
int get_list_range(char_u **str, int *num1, int *num2);
char *check_cedit(void);
-3
View File
@@ -14,9 +14,6 @@ void hl_set_font_name(char_u *font_name);
void hl_set_bg_color_name(char_u *name);
void hl_set_fg_color_name(char_u *name);
guicolor_T color_name2handle(char_u *name);
guicolor_T decode_hex_color(char_u *hex);
guicolor_T colorname2rgb(char_u *name);
void load_default_colors_lists(void);
guicolor_T gui_get_color_cmn(char_u *name);
guicolor_T gui_get_rgb_color_cmn(int r, int g, int b);
int get_cterm_attr_idx(int attr, int fg, int bg);
+3
View File
@@ -10,6 +10,7 @@ int do_in_path(char_u *path, char_u *name, int flags, void (*callback)(char_u *f
int do_in_runtimepath(char_u *name, int flags, void (*callback)(char_u *fname, void *ck), void *cookie);
int source_runtime(char_u *name, int flags);
int source_in_path(char_u *path, char_u *name, int flags, int *ret_sid);
int find_script_in_rtp(char_u *name);
void add_pack_start_dirs(void);
void load_start_packages(void);
void ex_packloadall(exarg_T *eap);
@@ -36,6 +37,8 @@ void ex_scriptversion(exarg_T *eap);
void ex_finish(exarg_T *eap);
void do_finish(exarg_T *eap, int reanimate);
int source_finished(char_u *(*fgetline)(int, void *, int, getline_opt_T), void *cookie);
char_u *script_name_after_autoload(scriptitem_T *si);
char_u *may_prefix_autoload(char_u *name);
char_u *autoload_name(char_u *name);
int script_autoload(char_u *name, int reload);
/* vim: set ft=c : */
+1 -1
View File
@@ -38,7 +38,7 @@ char_u *untrans_function_name(char_u *name);
char_u *get_scriptlocal_funcname(char_u *funcname);
char_u *save_function_name(char_u **name, int *is_global, int skip, int flags, funcdict_T *fudi);
void list_functions(regmatch_T *regmatch);
ufunc_T *define_function(exarg_T *eap, char_u *name_arg, char_u **line_to_free);
ufunc_T *define_function(exarg_T *eap, char_u *name_arg, garray_T *lines_to_free);
void ex_function(exarg_T *eap);
void ex_defcompile(exarg_T *eap);
int eval_fname_script(char_u *p);
+1 -2
View File
@@ -7,8 +7,7 @@ int check_defined(char_u *p, size_t len, cctx_T *cctx, int is_arg);
int need_type(type_T *actual, type_T *expected, int offset, int arg_idx, cctx_T *cctx, int silent, int actual_is_const);
lvar_T *reserve_local(cctx_T *cctx, char_u *name, size_t len, int isConst, type_T *type);
int get_script_item_idx(int sid, char_u *name, int check_writable, cctx_T *cctx);
imported_T *find_imported(char_u *name, size_t len, cctx_T *cctx);
imported_T *find_imported_in_script(char_u *name, size_t len, int sid);
imported_T *find_imported(char_u *name, size_t len, int load, cctx_T *cctx);
char_u *may_peek_next_line(cctx_T *cctx, char_u *arg, char_u **nextp);
char_u *peek_next_line_from_context(cctx_T *cctx);
char_u *next_line_from_context(cctx_T *cctx, int skip_comment);

Some files were not shown because too many files have changed in this diff Show More