mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Merge remote-tracking branch 'vim/master'
This commit is contained in:
+67
-16
@@ -1,4 +1,4 @@
|
||||
*builtin.txt* For Vim version 8.2. Last change: 2022 May 27
|
||||
*builtin.txt* For Vim version 8.2. Last change: 2022 Jun 05
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -753,7 +753,7 @@ acos({expr}) *acos()*
|
||||
Return the arc cosine of {expr} measured in radians, as a
|
||||
|Float| in the range of [0, pi].
|
||||
{expr} must evaluate to a |Float| or a |Number| in the range
|
||||
[-1, 1].
|
||||
[-1, 1]. Otherwise acos() returns "nan".
|
||||
Examples: >
|
||||
:echo acos(0)
|
||||
< 1.570796 >
|
||||
@@ -775,6 +775,7 @@ add({object}, {expr}) *add()*
|
||||
item. Use |extend()| to concatenate |Lists|.
|
||||
When {object} is a |Blob| then {expr} must be a number.
|
||||
Use |insert()| to add an item at another position.
|
||||
Returns 1 if {object} is not a |List| or a |Blob|.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
mylist->add(val1)->add(val2)
|
||||
@@ -877,11 +878,17 @@ argv([{nr} [, {winid}]])
|
||||
The {winid} argument specifies the window ID, see |argc()|.
|
||||
For the Vim command line arguments see |v:argv|.
|
||||
|
||||
Returns an empty string if {nr}th argument is not present in
|
||||
the argument list. Returns an empty List if the {winid}
|
||||
argument is invalid.
|
||||
|
||||
asin({expr}) *asin()*
|
||||
Return the arc sine of {expr} measured in radians, as a |Float|
|
||||
in the range of [-pi/2, pi/2].
|
||||
{expr} must evaluate to a |Float| or a |Number| in the range
|
||||
[-1, 1].
|
||||
Returns "nan" if {expr} is outside the range [-1, 1]. Returns
|
||||
0.0 if {expr} is not a |Float| or a |Number|.
|
||||
Examples: >
|
||||
:echo asin(0.8)
|
||||
< 0.927295 >
|
||||
@@ -902,6 +909,7 @@ atan({expr}) *atan()*
|
||||
Return the principal value of the arc tangent of {expr}, in
|
||||
the range [-pi/2, +pi/2] radians, as a |Float|.
|
||||
{expr} must evaluate to a |Float| or a |Number|.
|
||||
Returns 0.0 if {expr} is not a |Float| or a |Number|.
|
||||
Examples: >
|
||||
:echo atan(100)
|
||||
< 1.560797 >
|
||||
@@ -918,6 +926,8 @@ atan2({expr1}, {expr2}) *atan2()*
|
||||
Return the arc tangent of {expr1} / {expr2}, measured in
|
||||
radians, as a |Float| in the range [-pi, pi].
|
||||
{expr1} and {expr2} must evaluate to a |Float| or a |Number|.
|
||||
Returns 0.0 if {expr1} or {expr2} is not a |Float| or a
|
||||
|Number|.
|
||||
Examples: >
|
||||
:echo atan2(-1, 1)
|
||||
< -0.785398 >
|
||||
@@ -1002,7 +1012,7 @@ autocmd_delete({acmds}) *autocmd_delete()*
|
||||
{pattern} and {cmd} are not specified, then that autocmd group
|
||||
is deleted.
|
||||
|
||||
Returns v:true on success and v:false on failure.
|
||||
Returns |v:true| on success and |v:false| on failure.
|
||||
Examples: >
|
||||
" :autocmd! BufLeave *.vim
|
||||
let acmd = #{event: 'BufLeave', pattern: '*.vim'}
|
||||
@@ -1060,6 +1070,9 @@ autocmd_get([{opts}]) *autocmd_get()*
|
||||
If there are multiple commands for an autocmd event in a
|
||||
group, then separate items are returned for each command.
|
||||
|
||||
Returns an empty List if an autocmd with the specified group
|
||||
or event or pattern is not found.
|
||||
|
||||
Examples: >
|
||||
" :autocmd MyGroup
|
||||
echo autocmd_get(#{group: 'Mygroup'})
|
||||
@@ -1080,7 +1093,8 @@ autocmd_get([{opts}]) *autocmd_get()*
|
||||
<
|
||||
balloon_gettext() *balloon_gettext()*
|
||||
Return the current text in the balloon. Only for the string,
|
||||
not used for the List.
|
||||
not used for the List. Returns an empty string if balloon
|
||||
is not present.
|
||||
|
||||
balloon_show({expr}) *balloon_show()*
|
||||
Show {expr} inside the balloon. For the GUI {expr} is used as
|
||||
@@ -1117,7 +1131,8 @@ balloon_split({msg}) *balloon_split()*
|
||||
Split String {msg} into lines to be displayed in a balloon.
|
||||
The splits are made for the current window size and optimize
|
||||
to show debugger output.
|
||||
Returns a |List| with the split lines.
|
||||
Returns a |List| with the split lines. Returns an empty List
|
||||
on error.
|
||||
Can also be used as a |method|: >
|
||||
GetText()->balloon_split()->balloon_show()
|
||||
|
||||
@@ -1171,7 +1186,8 @@ bufadd({name}) *bufadd()*
|
||||
let bufnr = bufadd('someName')
|
||||
call bufload(bufnr)
|
||||
call setbufline(bufnr, 1, ['some', 'text'])
|
||||
< Can also be used as a |method|: >
|
||||
< Returns 0 on error.
|
||||
Can also be used as a |method|: >
|
||||
let bufnr = 'somename'->bufadd()
|
||||
|
||||
bufexists({buf}) *bufexists()*
|
||||
@@ -1326,6 +1342,8 @@ byte2line({byte}) *byte2line()*
|
||||
one.
|
||||
Also see |line2byte()|, |go| and |:goto|.
|
||||
|
||||
Returns -1 if the {byte} value is invalid.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetOffset()->byte2line()
|
||||
|
||||
@@ -1397,6 +1415,8 @@ ceil({expr}) *ceil()*
|
||||
echo ceil(4.0)
|
||||
< 4.0
|
||||
|
||||
Returns 0.0 if {expr} is not a |Float| or a |Number|.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
Compute()->ceil()
|
||||
<
|
||||
@@ -1413,6 +1433,7 @@ changenr() *changenr()*
|
||||
When a change was made it is the number of that change. After
|
||||
redo it is the number of the redone change. After undo it is
|
||||
one less than the number of the undone change.
|
||||
Returns 0 if the undo list is empty.
|
||||
|
||||
char2nr({string} [, {utf8}]) *char2nr()*
|
||||
Return Number value of the first char in {string}.
|
||||
@@ -1431,10 +1452,11 @@ char2nr({string} [, {utf8}]) *char2nr()*
|
||||
let list = map(split(str, '\zs'), {_, val -> char2nr(val)})
|
||||
< Result: [65, 66, 67]
|
||||
|
||||
Returns 0 if {string} is not a |String|.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetChar()->char2nr()
|
||||
|
||||
|
||||
charclass({string}) *charclass()*
|
||||
Return the character class of the first character in {string}.
|
||||
The character class is one of:
|
||||
@@ -1444,6 +1466,7 @@ charclass({string}) *charclass()*
|
||||
3 emoji
|
||||
other specific Unicode class
|
||||
The class is used in patterns and word motions.
|
||||
Returns 0 if {string} is not a |String|.
|
||||
|
||||
|
||||
charcol({expr}) *charcol()*
|
||||
@@ -1555,7 +1578,7 @@ col({expr}) The result is a Number, which is the byte index of the column
|
||||
col("$") length of cursor line plus one
|
||||
col("'t") column of mark t
|
||||
col("'" .. markname) column of mark markname
|
||||
< The first column is 1. 0 is returned for an error.
|
||||
< The first column is 1. Returns 0 if {expr} is invalid.
|
||||
For an uppercase mark the column may actually be in another
|
||||
buffer.
|
||||
For the cursor position, when 'virtualedit' is active, the
|
||||
@@ -1673,6 +1696,8 @@ complete_info([{what}]) *complete_info()*
|
||||
|pum_getpos()|. It's also available in |v:event| during the
|
||||
|CompleteChanged| event.
|
||||
|
||||
Returns an empty |Dictionary| on error.
|
||||
|
||||
Examples: >
|
||||
" Get all items
|
||||
call complete_info()
|
||||
@@ -1758,6 +1783,7 @@ copy({expr}) Make a copy of {expr}. For Numbers and Strings this isn't
|
||||
cos({expr}) *cos()*
|
||||
Return the cosine of {expr}, measured in radians, as a |Float|.
|
||||
{expr} must evaluate to a |Float| or a |Number|.
|
||||
Returns 0.0 if {expr} is not a |Float| or a |Number|.
|
||||
Examples: >
|
||||
:echo cos(100)
|
||||
< 0.862319 >
|
||||
@@ -1774,6 +1800,7 @@ cosh({expr}) *cosh()*
|
||||
Return the hyperbolic cosine of {expr} as a |Float| in the range
|
||||
[1, inf].
|
||||
{expr} must evaluate to a |Float| or a |Number|.
|
||||
Returns 0.0 if {expr} is not a |Float| or a |Number|.
|
||||
Examples: >
|
||||
:echo cosh(0.5)
|
||||
< 1.127626 >
|
||||
@@ -1885,6 +1912,9 @@ debugbreak({pid}) *debugbreak()*
|
||||
processes is undefined. See |terminal-debugger|.
|
||||
{only available on MS-Windows}
|
||||
|
||||
Returns |TRUE| if successfully interrupted the program.
|
||||
Otherwise returns |FALSE|.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetPid()->debugbreak()
|
||||
|
||||
@@ -2355,6 +2385,7 @@ exp({expr}) *exp()*
|
||||
Return the exponential of {expr} as a |Float| in the range
|
||||
[0, inf].
|
||||
{expr} must evaluate to a |Float| or a |Number|.
|
||||
Returns 0.0 if {expr} is not a |Float| or a |Number|.
|
||||
Examples: >
|
||||
:echo exp(2)
|
||||
< 7.389056 >
|
||||
@@ -2521,7 +2552,7 @@ extend({expr1}, {expr2} [, {expr3}]) *extend()*
|
||||
{expr2} remains unchanged.
|
||||
When {expr1} is locked and {expr2} is not empty the operation
|
||||
fails.
|
||||
Returns {expr1}.
|
||||
Returns {expr1}. Returns 0 on error.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
mylist->extend(otherlist)
|
||||
@@ -2695,6 +2726,8 @@ finddir({name} [, {path} [, {count}]]) *finddir()*
|
||||
{name} in {path} instead of the first one.
|
||||
When {count} is negative return all the matches in a |List|.
|
||||
|
||||
Returns an empty string if the directory is not found.
|
||||
|
||||
This is quite similar to the ex-command `:find`.
|
||||
{only available when compiled with the |+file_in_path|
|
||||
feature}
|
||||
@@ -2745,6 +2778,7 @@ float2nr({expr}) *float2nr()*
|
||||
Convert {expr} to a Number by omitting the part after the
|
||||
decimal point.
|
||||
{expr} must evaluate to a |Float| or a Number.
|
||||
Returns 0 if {expr} is not a |Float| or a |Number|.
|
||||
When the value of {expr} is out of range for a |Number| the
|
||||
result is truncated to 0x7fffffff or -0x7fffffff (or when
|
||||
64-bit Number support is enabled, 0x7fffffffffffffff or
|
||||
@@ -2772,6 +2806,7 @@ floor({expr}) *floor()*
|
||||
Return the largest integral value less than or equal to
|
||||
{expr} as a |Float| (round down).
|
||||
{expr} must evaluate to a |Float| or a |Number|.
|
||||
Returns 0.0 if {expr} is not a |Float| or a |Number|.
|
||||
Examples: >
|
||||
echo floor(1.856)
|
||||
< 1.0 >
|
||||
@@ -2794,6 +2829,8 @@ fmod({expr1}, {expr2}) *fmod()*
|
||||
the magnitude of {expr2}. If {expr2} is zero, the value
|
||||
returned is zero. The value returned is a |Float|.
|
||||
{expr1} and {expr2} must evaluate to a |Float| or a |Number|.
|
||||
Returns 0.0 if {expr1} or {expr2} is not a |Float| or a
|
||||
|Number|.
|
||||
Examples: >
|
||||
:echo fmod(12.33, 1.22)
|
||||
< 0.13 >
|
||||
@@ -2815,6 +2852,7 @@ fnameescape({string}) *fnameescape()*
|
||||
appears in a filename, it depends on the value of 'isfname'.
|
||||
A leading '+' and '>' is also escaped (special after |:edit|
|
||||
and |:write|). And a "-" by itself (special after |:cd|).
|
||||
Returns an empty string on error.
|
||||
Example: >
|
||||
:let fname = '+some str%nge|name'
|
||||
:exe "edit " .. fnameescape(fname)
|
||||
@@ -2832,7 +2870,8 @@ fnamemodify({fname}, {mods}) *fnamemodify()*
|
||||
:echo fnamemodify("main.c", ":p:h")
|
||||
< results in: >
|
||||
/home/mool/vim/vim/src
|
||||
< If {mods} is empty then {fname} is returned.
|
||||
< If {mods} is empty or an unsupported modifier is used then
|
||||
{fname} is returned.
|
||||
Note: Environment variables don't work in {fname}, use
|
||||
|expand()| first then.
|
||||
|
||||
@@ -2889,6 +2928,7 @@ foldtext() Returns a String, to be displayed for a closed fold. This is
|
||||
When used to draw the actual foldtext, the rest of the line
|
||||
will be filled with the fold char from the 'fillchars'
|
||||
setting.
|
||||
Returns an empty string when there is no fold.
|
||||
{not available when compiled without the |+folding| feature}
|
||||
|
||||
foldtextresult({lnum}) *foldtextresult()*
|
||||
@@ -2940,6 +2980,7 @@ funcref({name} [, {arglist}] [, {dict}])
|
||||
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.
|
||||
Returns 0 on error.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetFuncname()->funcref([arg])
|
||||
@@ -3020,6 +3061,8 @@ function({name} [, {arglist}] [, {dict}])
|
||||
< Invokes the function as with: >
|
||||
call context.Callback('one', 500)
|
||||
<
|
||||
Returns 0 on error.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetFuncname()->function([arg])
|
||||
|
||||
@@ -3073,6 +3116,7 @@ get({func}, {what})
|
||||
"func" The function
|
||||
"dict" The dictionary
|
||||
"args" The list with arguments
|
||||
Returns zero on error.
|
||||
Preferably used as a |method|: >
|
||||
myfunc->get(what)
|
||||
<
|
||||
@@ -3315,7 +3359,7 @@ getcharmod() *getcharmod()*
|
||||
128 command (Macintosh only)
|
||||
Only the modifiers that have not been included in the
|
||||
character itself are obtained. Thus Shift-a results in "A"
|
||||
without a modifier.
|
||||
without a modifier. Returns 0 if no modifiers are used.
|
||||
|
||||
*getcharpos()*
|
||||
getcharpos({expr})
|
||||
@@ -3665,7 +3709,7 @@ getftype({fname}) *getftype()*
|
||||
|
||||
getimstatus() *getimstatus()*
|
||||
The result is a Number, which is |TRUE| when the IME status is
|
||||
active.
|
||||
active and |FALSE| otherwise.
|
||||
See 'imstatusfunc'.
|
||||
|
||||
getjumplist([{winnr} [, {tabnr}]]) *getjumplist()*
|
||||
@@ -3675,7 +3719,8 @@ getjumplist([{winnr} [, {tabnr}]]) *getjumplist()*
|
||||
With {winnr} only use this window in the current tab page.
|
||||
{winnr} can also be a |window-ID|.
|
||||
With {winnr} and {tabnr} use the window in the specified tab
|
||||
page.
|
||||
page. If {winnr} or {tabnr} is invalid, an empty list is
|
||||
returned.
|
||||
|
||||
The returned list contains two entries: a list with the jump
|
||||
locations and the last used jump position number in the list.
|
||||
@@ -3756,7 +3801,8 @@ getmarklist([{buf}]) *getmarklist()*
|
||||
|
||||
If the optional {buf} argument is specified, returns the
|
||||
local marks defined in buffer {buf}. For the use of {buf},
|
||||
see |bufname()|.
|
||||
see |bufname()|. If {buf} is invalid, an empty list is
|
||||
returned.
|
||||
|
||||
Each item in the returned List is a |Dict| with the following:
|
||||
mark name of the mark prefixed by "'"
|
||||
@@ -3778,7 +3824,8 @@ getmatches([{win}]) *getmatches()*
|
||||
as |setmatches()| can restore a list of matches saved by
|
||||
|getmatches()|.
|
||||
If {win} is specified, use the window with this number or
|
||||
window ID instead of the current window.
|
||||
window ID instead of the current window. If {win} is invalid,
|
||||
an empty list is returned.
|
||||
Example: >
|
||||
:echo getmatches()
|
||||
< [{'group': 'MyGroup1', 'pattern': 'TODO',
|
||||
@@ -3850,6 +3897,7 @@ getpos({expr}) Get the position for String {expr}. For possible values of
|
||||
use |getcharpos()|.
|
||||
A very large column number equal to |v:maxcol| can be returned,
|
||||
in which case it means "after the end of the line".
|
||||
If {expr} is invalid, returns a list with all zeros.
|
||||
This can be used to save and restore the position of a mark: >
|
||||
let save_a_mark = getpos("'a")
|
||||
...
|
||||
@@ -6870,7 +6918,9 @@ reltime([{start} [, {end}]]) *reltime()*
|
||||
The item can be passed to |reltimestr()| to convert it to a
|
||||
string or |reltimefloat()| to convert to a Float.
|
||||
|
||||
Without an argument reltime() returns the current time.
|
||||
Without an argument reltime() returns the current time (the
|
||||
representation is system-dependend, it can not be used as the
|
||||
wall-clock time, see |localtime()| for that).
|
||||
With one argument is returns the time passed since the time
|
||||
specified in the argument.
|
||||
With two arguments it returns the time passed between {start}
|
||||
@@ -10095,6 +10145,7 @@ winnr([{arg}]) The result is a Number, which is the number of the current
|
||||
current window (where |CTRL-W_l| goes to).
|
||||
The number can be used with |CTRL-W_w| and ":wincmd w"
|
||||
|:wincmd|.
|
||||
When {arg} is invalid an error is given and zero is returned.
|
||||
Also see |tabpagewinnr()| and |win_getid()|.
|
||||
Examples: >
|
||||
let window_count = winnr('$')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*channel.txt* For Vim version 8.2. Last change: 2022 Apr 16
|
||||
*channel.txt* For Vim version 8.2. Last change: 2022 Jun 04
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
|
||||
+11
-2
@@ -5171,14 +5171,23 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
"space" setting is used. For example,
|
||||
`:set listchars=multispace:---+` shows ten consecutive
|
||||
spaces as:
|
||||
---+---+--
|
||||
---+---+-- ~
|
||||
*lcs-lead*
|
||||
lead:c Character to show for leading spaces. When omitted,
|
||||
leading spaces are blank. Overrides the "space" and
|
||||
"multispace" settings for leading spaces. You can
|
||||
combine it with "tab:", for example: >
|
||||
:set listchars+=tab:>-,lead:.
|
||||
< *lcs-trail*
|
||||
< *lcs-leadmultispace*
|
||||
leadmultispace:c...
|
||||
Like multispace value, but only for leading whitespace
|
||||
Overrides |lcs-lead| for leading multiple spaces.
|
||||
`:set listchars=leadmultispace:---+` shows ten consecutive
|
||||
leading spaces as:
|
||||
---+---+--XXX ~
|
||||
Where "XXX" denotes the first non-blank characters in
|
||||
the line.
|
||||
*lcs-trail*
|
||||
trail:c Character to show for trailing spaces. When omitted,
|
||||
trailing spaces are blank. Overrides the "space" and
|
||||
"multispace" settings for trailing spaces.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*popup.txt* For Vim version 8.2. Last change: 2022 May 29
|
||||
*popup.txt* For Vim version 8.2. Last change: 2022 Jun 06
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -999,7 +999,7 @@ To make the four corners transparent:
|
||||
==============================================================================
|
||||
4. Examples *popup-examples*
|
||||
|
||||
These examplese use |Vim9| script.
|
||||
These examples use |Vim9| script.
|
||||
|
||||
TODO: more interesting examples
|
||||
|
||||
@@ -1043,6 +1043,10 @@ Extend popup_filter_menu() with shortcut keys: >
|
||||
" No shortcut, pass to generic filter
|
||||
return popup_filter_menu(a:id, a:key)
|
||||
endfunc
|
||||
|
||||
func MyMenuHandler(id, result)
|
||||
echo $'Result: {a:result}'
|
||||
endfunc
|
||||
<
|
||||
*popup_beval_example*
|
||||
Example for using a popup window for 'ballooneval': >
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*starting.txt* For Vim version 8.2. Last change: 2022 May 10
|
||||
*starting.txt* For Vim version 8.2. Last change: 2022 Jun 04
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*todo.txt* For Vim version 8.2. Last change: 2022 Jun 03
|
||||
*todo.txt* For Vim version 8.2. Last change: 2022 Jun 05
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -40,7 +40,6 @@ browser use: https://github.com/vim/vim/issues/1234
|
||||
|
||||
Prepare for Vim 9.0 release:
|
||||
- Update the user manual:
|
||||
- Add import/export example to 52.1
|
||||
- Add more to usr_50.txt as an "advanced section" of usr_41.txt
|
||||
- Move some from vim9.txt to the user manual? Keep the specification.
|
||||
- Use Vim9 for more runtime files.
|
||||
@@ -82,8 +81,8 @@ Update list of features to vote on:
|
||||
|
||||
Popup windows:
|
||||
- Preview popup not properly updated when it overlaps with completion menu.
|
||||
(Yegappan Lakshmanan, 2021 May 22
|
||||
- Srollbar thumb somtimes not visible #10492
|
||||
(Yegappan Lakshmanan, 2021 May 22)
|
||||
- Srollbar thumb sometimes not visible #10492
|
||||
- Add a function to redraw a specific popup window. Esp. to be used when
|
||||
editing the command line, when screen updating doesn't happen. (Shougo)
|
||||
- Add a flag to make a popup window focusable?
|
||||
@@ -204,6 +203,10 @@ Terminal emulator window:
|
||||
- When 'encoding' is not utf-8, or the job is using another encoding, setup
|
||||
conversions.
|
||||
|
||||
Autoconf: must use autoconf 2.69, later version generates lots of warnings
|
||||
attempt in ~/tmp/configure.ac
|
||||
- try using autoconf 2.71 and fix all "obsolete" warnings
|
||||
|
||||
Can deref_func_name() and deref_function_name() be merged?
|
||||
|
||||
After patch 8.2.4915 w_botline is computed much more often. Can this be
|
||||
@@ -217,7 +220,7 @@ Improvement in terminal configuration mess: Request the terminfo entry from
|
||||
the terminal itself. The $TERM value then is only relevant for whether this
|
||||
feature is supported or not. Replaces the xterm mechanism to request each
|
||||
entry separately. #6609
|
||||
Multiplexers (screen, tmux) can request it to the underlaying terminal, and
|
||||
Multiplexers (screen, tmux) can request it to the underlying terminal, and
|
||||
pass it on with modifications.
|
||||
|
||||
Can "CSI nr X" be used instead of outputting spaces? Is it faster? #8002
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*usr_41.txt* For Vim version 8.2. Last change: 2022 Jun 03
|
||||
*usr_41.txt* For Vim version 8.2. Last change: 2022 Jun 04
|
||||
|
||||
VIM USER MANUAL - by Bram Moolenaar
|
||||
|
||||
@@ -66,7 +66,8 @@ The output of the example code is:
|
||||
count is 4 ~
|
||||
|
||||
In the first line the `vim9script` command makes clear this is a new, |Vim9|
|
||||
script file. That matters for how the rest of the file is used.
|
||||
script file. That matters for how the rest of the file is used. It is
|
||||
recommended to put it in the very fist line, before any comments.
|
||||
*vim9-declarations*
|
||||
The `var i = 1` command declares the "i" variable and initializes it. The
|
||||
generic form is: >
|
||||
@@ -1791,7 +1792,7 @@ encountered, execution of the script/function/mapping will be aborted.
|
||||
|
||||
When the `read` command causes another error, the pattern "E484:" will not
|
||||
match in it. Thus this exception will not be caught and result in the usual
|
||||
error message and excecution is aborted.
|
||||
error message and execution is aborted.
|
||||
|
||||
You might be tempted to do this: >
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ Table of contents: |usr_toc.txt|
|
||||
==============================================================================
|
||||
*50.1* Line continuation
|
||||
|
||||
In legacy Vim script line contination is done by preceding a contination line
|
||||
with a backslash: >
|
||||
In legacy Vim script line continuation is done by preceding a continuation
|
||||
line with a backslash: >
|
||||
let mylist = [
|
||||
\ 'one',
|
||||
\ 'two',
|
||||
|
||||
+107
-47
@@ -1,14 +1,12 @@
|
||||
*usr_52.txt* For Vim version 8.2. Last change: 2022 Jun 03
|
||||
*usr_52.txt* For Vim version 8.2. Last change: 2022 Jun 04
|
||||
|
||||
VIM USER MANUAL - by Bram Moolenaar
|
||||
|
||||
Write larger plugins
|
||||
|
||||
TODO: this file needs to be updated
|
||||
|
||||
When plugins do more than simple things, they tend to grow big. This file
|
||||
explains how to make sure they still load fast and how to split them up in
|
||||
smaller parts
|
||||
smaller parts.
|
||||
|
||||
|52.1| Export and import
|
||||
|52.2| Autoloading
|
||||
@@ -29,45 +27,97 @@ functions are compiled into instructions that can be executed quickly. This
|
||||
makes Vim9 script a lot faster, up to a 100 times.
|
||||
|
||||
The basic idea is that a script file has items that are private, only used
|
||||
inside the script file, and items that are exported, used outside of the
|
||||
script file. The exported items can then be used by scripts that import them.
|
||||
That makes very clear what is defined where.
|
||||
inside the script file, and items that are exported, which can be used by
|
||||
scripts that import them. That makes very clear what is defined where.
|
||||
|
||||
Let's start with an example, a script that exports one function and has one
|
||||
private function: >
|
||||
|
||||
vim9script " This indicates a Vim9 script file.
|
||||
vim9script
|
||||
|
||||
export def GetMessage(): string
|
||||
let result = ''
|
||||
...
|
||||
result = GetPart(count)
|
||||
...
|
||||
export def GetMessage(count: string): string
|
||||
var nr = str2nr(count)
|
||||
var result = $'To {nr} we say '
|
||||
result ..= GetReply(nr)
|
||||
return result
|
||||
enddef
|
||||
|
||||
def GetPart(nr: number): string
|
||||
if nr == 4
|
||||
def GetReply(nr: number): string
|
||||
if nr == 42
|
||||
return 'yes'
|
||||
elseif nr = 22
|
||||
return 'maybe'
|
||||
else
|
||||
return 'no'
|
||||
endif
|
||||
enddef
|
||||
|
||||
The `vim9script` command must be the very first command in the file. Without
|
||||
it Vim will assume legacy script syntax.
|
||||
The `vim9script` command is required, `export` only works in a |Vim9| script.
|
||||
|
||||
The `export def GetMessage(): string` line starts with `export`, meaning that
|
||||
this function can be imported and called by other scripts. The line
|
||||
`def GetPart(...` does not start with `export`, this is a script-local
|
||||
function, it can only be used inside this script file.
|
||||
The `export def GetMessage(...` line starts with `export`, meaning that this
|
||||
function can be called by other scripts. The line `def GetReply(...` does not
|
||||
start with `export`, this is a script-local function, it can only be used
|
||||
inside this script file.
|
||||
|
||||
In the `export def GetMessage(): string` line you will notice the colon and
|
||||
the return type. Vim9 functions, defined with `def`, require specifying the
|
||||
type of arguments and the return type. That way Vim can compile the code
|
||||
efficiently. The GetPart function defines an argument "nr" of type "number".
|
||||
Now about the script where this is imported. In this example we use this
|
||||
layout, which works well for a plugin below the "pack" directory:
|
||||
.../plugin/theplugin.vim
|
||||
.../lib/getmessage.vim
|
||||
|
||||
Assuming the "..." directory has been added to 'runtimepath', Vim will look
|
||||
for plugins in the "plugin" directory and source "theplugin.vim". Vim does
|
||||
not recognize the "lib" directory, you can put any scripts there.
|
||||
|
||||
The above script that exports GetMessage() goes in lib/getmessage.vim. The
|
||||
GetMessage() function is used in plugin/theplugin.vim: >
|
||||
|
||||
vim9script
|
||||
|
||||
import "../lib/getmessage.vim"
|
||||
command -nargs=1 ShowMessage echomsg getmessage.GetMessage(<f-args>)
|
||||
|
||||
The `import` command uses a relative path, it starts with "../", which means
|
||||
to go one directory up. For other kinds of paths see the `:import` command.
|
||||
|
||||
How we can try out the command that the plugin provides: >
|
||||
ShowMessage 1
|
||||
< To 1 we say no ~
|
||||
>
|
||||
ShowMessage 22
|
||||
< To 22 we say maybe ~
|
||||
|
||||
Notice that the function GetMessage() is prefixed with the imported script
|
||||
name "getmessage". That way, for every imported function used, you know what
|
||||
script it was imported from. If you import several scripts each of them could
|
||||
define a GetMessage() function: >
|
||||
|
||||
vim9script
|
||||
|
||||
import "../lib/getmessage.vim"
|
||||
import "../lib/getother.vim"
|
||||
command -nargs=1 ShowMessage echomsg getmessage.GetMessage(<f-args>)
|
||||
command -nargs=1 ShowOther echomsg getother.GetMessage(<f-args>)
|
||||
|
||||
If the imported script name is long or you use it in many places, you can
|
||||
shorten it by adding an "as" argument: >
|
||||
import "../lib/getmessage.vim" as msg
|
||||
command -nargs=1 ShowMessage echomsg msg.GetMessage(<f-args>)
|
||||
|
||||
|
||||
RELOADING
|
||||
|
||||
One thing to keep in mind: the imported "lib/getmessage.vim" script will be
|
||||
sourced only once. When it is imported a second time sourcing it will be
|
||||
skipped, since the items in it have already been created. It does not matter
|
||||
if this import command is in another script, or in the same script that is
|
||||
sourced again.
|
||||
|
||||
This is efficient when using a plugin, but when still developing a plugin it
|
||||
means that changing "lib/getmessage.vim" after it has been imported will have
|
||||
no effect. You need to quit Vim and start it again. (Rationale: the items
|
||||
defined in the script could be used in a compiled function, sourcing the
|
||||
script again may break those functions).
|
||||
|
||||
TODO: import/export example
|
||||
|
||||
USING GLOBALS
|
||||
|
||||
@@ -83,8 +133,6 @@ prefix that is very unlikely to be used elsewhere. For example, if you have a
|
||||
==============================================================================
|
||||
*52.2* Autoloading
|
||||
|
||||
TODO: autoloading with import/export
|
||||
|
||||
After splitting your large script into pieces, all the lines will still be
|
||||
loaded and executed the moment the script is used. Every `import` loads the
|
||||
imported script to find the items defined there. Although that is good for
|
||||
@@ -92,27 +140,39 @@ finding errors early, it also takes time. Which is wasted if the
|
||||
functionality is not often used.
|
||||
|
||||
Instead of having `import` load the script immediately, it can be postponed
|
||||
until needed. >
|
||||
import autoload "./LoadLater.vim"
|
||||
until needed. Using the example above, only one change needs to be made in
|
||||
the plugin/theplugin.vim script: >
|
||||
import autoload "../lib/getmessage.vim"
|
||||
|
||||
Now you can use exported items as usual: "LoadLater.GetMonth(4)".
|
||||
However, the type will not be checked. Not even the existence of the
|
||||
GetMonth() function is checked until it is used. You will have to decide what
|
||||
is more important for your script. You can also add the "autoload" argument
|
||||
later, after you have checked everything works.
|
||||
Nothing in the rest of the script needs to change. However, the types will
|
||||
not be checked. Not even the existence of the GetMessage() function is
|
||||
checked until it is used. You will have to decide what is more important for
|
||||
your script: fast startup or getting errors early. You can also add the
|
||||
"autoload" argument later, after you have checked everything works.
|
||||
|
||||
Another form is to use a script name that is not an absolute or relative
|
||||
path: >
|
||||
|
||||
AUTOLOAD DIRECTORY
|
||||
|
||||
Another form is to use autoload with a script name that is not an absolute or
|
||||
relative path: >
|
||||
import autload "monthlib.vim"
|
||||
|
||||
This will search for the script "monthlib.vim" in the autoload directories of
|
||||
'runtimepath'. With Unix the directory often is "~/.vim/autoload".
|
||||
'runtimepath'. With Unix one of the directories often is "~/.vim/autoload".
|
||||
|
||||
The main advantage of this is that this script can be shared with other
|
||||
The main advantage of this is that this script can be easily shared with other
|
||||
scripts. You do need to make sure that the script name is unique, since Vim
|
||||
will search all the "autoload" directories in 'runtimepath', and if you are
|
||||
using several plugins, these may add several directories to 'runtimepath',
|
||||
each of which might have an "autoload" directory.
|
||||
using several plugins with a plugin manager, it may add a directory to
|
||||
'runtimepath', each of which might have an "autoload" directory.
|
||||
|
||||
Without autoload: >
|
||||
import "monthlib.vim"
|
||||
|
||||
Vim will search for the script "monthlib.vim" in the import directories of
|
||||
'runtimepath'. Note that in this case adding or removing "autoload" changes
|
||||
where the script is found. With a relative or absolute path the location does
|
||||
not change.
|
||||
|
||||
==============================================================================
|
||||
*52.3* Autoloading without import/export
|
||||
@@ -256,13 +316,13 @@ In some cases you have a legacy Vim script where you want to use items from a
|
||||
Vim9 script. For example in your .vimrc you want to initialize a plugin. The
|
||||
best way to do this is to use `:import`. For example: >
|
||||
|
||||
import Init as NiceInit from 'myNicePlugin.vim'
|
||||
call NiceInit('today')
|
||||
import 'myNicePlugin.vim'
|
||||
call myNicePlugin.NiceInit('today')
|
||||
|
||||
This finds the exported function "Init" in the Vim9 script file and makes it
|
||||
available as script-local item "NiceInit". `:import` always uses the script
|
||||
namespace, even when "s:" is not given. If "myNicePlugin.vim" was already
|
||||
sourced it is not sourced again.
|
||||
This finds the exported function "NiceInit" in the Vim9 script file and makes
|
||||
it available as script-local item "myNicePlugin.NiceInit". `:import` always
|
||||
uses the script namespace, even when "s:" is not given. If "myNicePlugin.vim"
|
||||
was already sourced it is not sourced again.
|
||||
|
||||
Besides avoiding putting any items in the global namespace (where name clashes
|
||||
can cause unexpected errors), this also means the script is sourced only once,
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
" Vim plugin for using Vim as manpager.
|
||||
" Maintainer: Enno Nagel <ennonagel+vim@gmail.com>
|
||||
" Last Change: 2020 Aug 05
|
||||
" Last Change: 2022 Jun 05
|
||||
|
||||
command! -nargs=0 MANPAGER call s:ManPager() | delcommand MANPAGER
|
||||
|
||||
function! s:ManPager()
|
||||
set nocompatible
|
||||
function s:ManPager()
|
||||
" global options, keep these to a minimum to avoid side effects
|
||||
if &compatible
|
||||
set nocompatible
|
||||
endif
|
||||
if exists('+viminfofile')
|
||||
set viminfofile=NONE
|
||||
endif
|
||||
@@ -27,7 +30,7 @@ function! s:ManPager()
|
||||
if n > 1
|
||||
exe "1," . n-1 . "d"
|
||||
endif
|
||||
setlocal nomodified readonly
|
||||
setlocal nomodifiable nomodified readonly nowrite
|
||||
|
||||
syntax on
|
||||
endfunction
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
" Original Author: Mohamed Boughaba <mohamed dot bgb at gmail dot com>
|
||||
" Maintainer: Quentin Hibon (github user hiqua)
|
||||
" Version: 0.4
|
||||
" Last Change: 2022 May 05
|
||||
" Last Change: 2022 Jun 05
|
||||
|
||||
" References:
|
||||
" http://i3wm.org/docs/userguide.html#configuring
|
||||
@@ -17,9 +17,6 @@ endif
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
" Error
|
||||
syn match i3ConfigError /.*/
|
||||
|
||||
" Todo
|
||||
syn keyword i3ConfigTodo TODO FIXME XXX contained
|
||||
|
||||
@@ -180,13 +177,12 @@ syn match i3ConfigDrawingMarks /^\s*show_marks\s\+\(yes\|no\)\s\?$/ contains=i3C
|
||||
|
||||
" Group mode/bar
|
||||
syn keyword i3ConfigBlockKeyword mode bar colors i3bar_command status_command position exec mode hidden_state modifier id position output background statusline tray_output tray_padding separator separator_symbol workspace_min_width workspace_buttons strip_workspace_numbers binding_mode_indicator focused_workspace active_workspace inactive_workspace urgent_workspace binding_mode contained
|
||||
syn region i3ConfigBlock start=+.*s\?{$+ end=+^}$+ contains=i3ConfigBlockKeyword,i3ConfigString,i3ConfigBind,i3ConfigComment,i3ConfigFont,i3ConfigFocusWrappingType,i3ConfigColor,i3ConfigVariable transparent keepend extend
|
||||
syn region i3ConfigBlock start=+^\s*[^#]*s\?{$+ end=+^\s*[^#]*}$+ contains=i3ConfigBlockKeyword,i3ConfigString,i3ConfigBind,i3ConfigComment,i3ConfigFont,i3ConfigFocusWrappingType,i3ConfigColor,i3ConfigVariable transparent keepend extend
|
||||
|
||||
" Line continuation
|
||||
syn region i3ConfigLineCont start=/^.*\\$/ end=/^.*$/ contains=i3ConfigBlockKeyword,i3ConfigString,i3ConfigBind,i3ConfigComment,i3ConfigFont,i3ConfigFocusWrappingType,i3ConfigColor,i3ConfigVariable transparent keepend extend
|
||||
|
||||
" Define the highlighting.
|
||||
hi def link i3ConfigError Error
|
||||
hi def link i3ConfigTodo Todo
|
||||
hi def link i3ConfigComment Comment
|
||||
hi def link i3ConfigFontContent Type
|
||||
|
||||
+2
-2
@@ -211,8 +211,8 @@ check_unpack(void)
|
||||
{
|
||||
printf("ERROR: Cannot find filetype.vim in \"%s\"\n", installdir);
|
||||
printf("It looks like you did not unpack the runtime archive.\n");
|
||||
printf("You must unpack the runtime archive \"vim%srt.zip\" before installing.\n",
|
||||
VIM_VERSION_NODOT + 3);
|
||||
printf("You must unpack the runtime archive \"%srt.zip\" before installing.\n",
|
||||
VIM_VERSION_NODOT);
|
||||
myexit(1);
|
||||
}
|
||||
|
||||
|
||||
+20
-3
@@ -767,6 +767,7 @@ win_line(
|
||||
{
|
||||
if (wp->w_lcs_chars.space
|
||||
|| wp->w_lcs_chars.multispace != NULL
|
||||
|| wp->w_lcs_chars.leadmultispace != NULL
|
||||
|| wp->w_lcs_chars.trail
|
||||
|| wp->w_lcs_chars.lead
|
||||
|| wp->w_lcs_chars.nbsp)
|
||||
@@ -781,7 +782,7 @@ win_line(
|
||||
trailcol += (colnr_T) (ptr - line);
|
||||
}
|
||||
// find end of leading whitespace
|
||||
if (wp->w_lcs_chars.lead)
|
||||
if (wp->w_lcs_chars.lead || wp->w_lcs_chars.leadmultispace != NULL)
|
||||
{
|
||||
leadcol = 0;
|
||||
while (VIM_ISWHITE(ptr[leadcol]))
|
||||
@@ -2118,8 +2119,24 @@ win_line(
|
||||
if ((trailcol != MAXCOL && ptr > line + trailcol && c == ' ')
|
||||
|| (leadcol != 0 && ptr < line + leadcol && c == ' '))
|
||||
{
|
||||
c = (ptr > line + trailcol) ? wp->w_lcs_chars.trail
|
||||
: wp->w_lcs_chars.lead;
|
||||
if (leadcol != 0 && in_multispace && ptr < line + leadcol
|
||||
&& wp->w_lcs_chars.leadmultispace != NULL)
|
||||
{
|
||||
c = wp->w_lcs_chars.leadmultispace[multispace_pos++];
|
||||
if (wp->w_lcs_chars.leadmultispace[multispace_pos] == NUL)
|
||||
multispace_pos = 0;
|
||||
}
|
||||
|
||||
else if (ptr > line + trailcol && wp->w_lcs_chars.trail)
|
||||
c = wp->w_lcs_chars.trail;
|
||||
|
||||
else if (ptr < line + leadcol && wp->w_lcs_chars.lead)
|
||||
c = wp->w_lcs_chars.lead;
|
||||
|
||||
else if (leadcol != 0 && c == ' ' && wp->w_lcs_chars.space)
|
||||
c = wp->w_lcs_chars.space;
|
||||
|
||||
|
||||
if (!attr_pri)
|
||||
{
|
||||
n_attr = 1;
|
||||
|
||||
+10
-2
@@ -3447,9 +3447,17 @@ theend:
|
||||
static void
|
||||
append_command(char_u *cmd)
|
||||
{
|
||||
char_u *s = cmd;
|
||||
char_u *d;
|
||||
size_t len = STRLEN(IObuff);
|
||||
char_u *s = cmd;
|
||||
char_u *d;
|
||||
|
||||
if (len > IOSIZE - 100)
|
||||
{
|
||||
// Not enough space, truncate and put in "...".
|
||||
d = IObuff + IOSIZE - 100;
|
||||
d -= mb_head_off(IObuff, d);
|
||||
STRCPY(d, "...");
|
||||
}
|
||||
STRCAT(IObuff, ": ");
|
||||
d = IObuff + STRLEN(IObuff);
|
||||
while (*s != NUL && d - IObuff + 5 < IOSIZE)
|
||||
|
||||
@@ -1631,7 +1631,6 @@ retry:
|
||||
* Do the conversion.
|
||||
*/
|
||||
dst = ptr;
|
||||
size = size;
|
||||
while (size > 0)
|
||||
{
|
||||
found_bad = FALSE;
|
||||
|
||||
+2
-2
@@ -3471,8 +3471,8 @@ vgetorpeek(int advance)
|
||||
* get a character: 3. from the user - get it
|
||||
*/
|
||||
if (typebuf.tb_len == 0)
|
||||
// timedout may have been set while waiting for a mapping
|
||||
// that has a <Nop> RHS.
|
||||
// timedout may have been set if a mapping with empty RHS
|
||||
// fully matched while longer mappings timed out.
|
||||
timedout = FALSE;
|
||||
|
||||
if (advance)
|
||||
|
||||
+3
-2
@@ -4153,7 +4153,8 @@ _OnMouseWheel(HWND hwnd, WPARAM wParam, LPARAM lParam, int horizontal)
|
||||
{
|
||||
int button;
|
||||
win_T *wp;
|
||||
int modifiers, kbd_modifiers;
|
||||
int modifiers = 0;
|
||||
int kbd_modifiers;
|
||||
int zDelta = GET_WHEEL_DELTA_WPARAM(wParam);
|
||||
POINT pt;
|
||||
|
||||
@@ -4213,7 +4214,7 @@ _OnMouseWheel(HWND hwnd, WPARAM wParam, LPARAM lParam, int horizontal)
|
||||
pt.y = GET_Y_LPARAM(lParam);
|
||||
ScreenToClient(s_textArea, &pt);
|
||||
|
||||
gui_send_mouse_event(button, pt.x, pt.y, FALSE, kbd_modifiers);
|
||||
gui_send_mouse_event(button, pt.x, pt.y, FALSE, modifiers);
|
||||
}
|
||||
|
||||
#ifdef USE_SYSMENU_FONT
|
||||
|
||||
@@ -446,14 +446,6 @@ next_search_hl(
|
||||
// or none is found in this line.
|
||||
for (;;)
|
||||
{
|
||||
# ifdef FEAT_RELTIME
|
||||
// Stop searching after passing the time limit.
|
||||
if (timed_out)
|
||||
{
|
||||
shl->lnum = 0; // no match found in time
|
||||
break;
|
||||
}
|
||||
# endif
|
||||
// Three situations:
|
||||
// 1. No useful previous match: search from start of line.
|
||||
// 2. Not Vi compatible or empty match: continue at next character.
|
||||
|
||||
+18
-2
@@ -1886,7 +1886,7 @@ msg_prt_line(char_u *s, int list)
|
||||
--trail;
|
||||
}
|
||||
// find end of leading whitespace
|
||||
if (curwin->w_lcs_chars.lead)
|
||||
if (curwin->w_lcs_chars.lead || curwin->w_lcs_chars.leadmultispace != NULL)
|
||||
{
|
||||
lead = s;
|
||||
while (VIM_ISWHITE(lead[0]))
|
||||
@@ -1998,7 +1998,15 @@ msg_prt_line(char_u *s, int list)
|
||||
}
|
||||
else if (c == ' ')
|
||||
{
|
||||
if (lead != NULL && s <= lead)
|
||||
if (list && lead != NULL && s <= lead && in_multispace
|
||||
&& curwin->w_lcs_chars.leadmultispace != NULL)
|
||||
{
|
||||
c = curwin->w_lcs_chars.leadmultispace[multispace_pos++];
|
||||
if (curwin->w_lcs_chars.leadmultispace[multispace_pos] == NUL)
|
||||
multispace_pos = 0;
|
||||
attr = HL_ATTR(HLF_8);
|
||||
}
|
||||
else if (lead != NULL && s <= lead && curwin->w_lcs_chars.lead)
|
||||
{
|
||||
c = curwin->w_lcs_chars.lead;
|
||||
attr = HL_ATTR(HLF_8);
|
||||
@@ -2008,6 +2016,14 @@ msg_prt_line(char_u *s, int list)
|
||||
c = curwin->w_lcs_chars.trail;
|
||||
attr = HL_ATTR(HLF_8);
|
||||
}
|
||||
else if (list && lead != NULL && s <= lead && in_multispace
|
||||
&& curwin->w_lcs_chars.leadmultispace != NULL)
|
||||
{
|
||||
c = curwin->w_lcs_chars.leadmultispace[multispace_pos++];
|
||||
if (curwin->w_lcs_chars.leadmultispace[multispace_pos] == NUL)
|
||||
multispace_pos = 0;
|
||||
attr = HL_ATTR(HLF_8);
|
||||
}
|
||||
else if (list && in_multispace
|
||||
&& curwin->w_lcs_chars.multispace != NULL)
|
||||
{
|
||||
|
||||
+1
-1
@@ -560,7 +560,7 @@ resolve_appexeclink(char_u *fname)
|
||||
&& idx < (int)rb->AppExecLinkReparseBuffer.StringCount
|
||||
&& idx != 2; )
|
||||
{
|
||||
if ((*p++ == L'\0'))
|
||||
if (*p++ == L'\0')
|
||||
++idx;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -8269,7 +8269,7 @@ xsmp_close(void)
|
||||
#endif // USE_XSMP
|
||||
|
||||
#if defined(FEAT_RELTIME) || defined(PROTO)
|
||||
# if defined(HAVE_TIMER_CREATE) || defined(MACOS_X)
|
||||
# if defined(HAVE_TIMER_CREATE)
|
||||
/*
|
||||
* Implement timeout with timer_create() and timer_settime().
|
||||
*/
|
||||
@@ -8444,7 +8444,7 @@ start_timeout(long msec)
|
||||
if (ret == 0)
|
||||
{
|
||||
alarm_pending = sigismember(&sigs, SIGALRM);
|
||||
ret = ret == 0 ? sigprocmask(SIG_SETMASK, &saved_sigs, NULL) : ret;
|
||||
ret = sigprocmask(SIG_SETMASK, &saved_sigs, NULL);
|
||||
}
|
||||
if (unlikely(ret != 0 || alarm_pending < 0))
|
||||
{
|
||||
|
||||
+1
-2
@@ -3495,7 +3495,7 @@ mch_writable(char_u *name)
|
||||
* the allocated memory.
|
||||
*/
|
||||
int
|
||||
mch_can_exe(char_u *name, char_u **path, int use_path)
|
||||
mch_can_exe(char_u *name, char_u **path, int use_path UNUSED)
|
||||
{
|
||||
return executable_exists((char *)name, path, TRUE, TRUE);
|
||||
}
|
||||
@@ -8379,7 +8379,6 @@ stop_timeout(void)
|
||||
const int *
|
||||
start_timeout(long msec)
|
||||
{
|
||||
UINT interval = (UINT)msec;
|
||||
BOOL ret;
|
||||
|
||||
timeout_flag = &timeout_flags[flag_idx];
|
||||
|
||||
-352
File diff suppressed because it is too large
Load Diff
@@ -12,6 +12,9 @@ setl nodiff
|
||||
silent g/^#, c-format\n#/.d
|
||||
silent g/^#\..*\n#/.d
|
||||
|
||||
" c-format comments have no effect, the check.vim scripts checks it.
|
||||
silent g/^#, c-format$/d
|
||||
|
||||
silent g/^#[:~] /d
|
||||
silent g/^#, fuzzy\(, .*\)\=\nmsgid ""\@!/.+1,/^$/-1s/^/#\~ /
|
||||
silent g/^msgstr"/s//msgstr "/
|
||||
|
||||
+17
-751
File diff suppressed because it is too large
Load Diff
+51
-1
@@ -4872,11 +4872,13 @@ get_encoded_char_adv(char_u **p)
|
||||
char *
|
||||
set_chars_option(win_T *wp, char_u **varp)
|
||||
{
|
||||
int round, i, len, entries;
|
||||
int round, i, len, len2, entries;
|
||||
char_u *p, *s;
|
||||
int c1 = 0, c2 = 0, c3 = 0;
|
||||
char_u *last_multispace = NULL; // Last occurrence of "multispace:"
|
||||
char_u *last_lmultispace = NULL; // Last occurrence of "leadmultispace:"
|
||||
int multispace_len = 0; // Length of lcs-multispace string
|
||||
int lead_multispace_len = 0; // Length of lcs-leadmultispace string
|
||||
struct charstab
|
||||
{
|
||||
int *cp;
|
||||
@@ -4950,6 +4952,14 @@ set_chars_option(win_T *wp, char_u **varp)
|
||||
}
|
||||
else
|
||||
lcs_chars.multispace = NULL;
|
||||
|
||||
if (lead_multispace_len > 0)
|
||||
{
|
||||
lcs_chars.leadmultispace = ALLOC_MULT(int, lead_multispace_len + 1);
|
||||
lcs_chars.leadmultispace[lead_multispace_len] = NUL;
|
||||
}
|
||||
else
|
||||
lcs_chars.leadmultispace = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -5013,6 +5023,7 @@ set_chars_option(win_T *wp, char_u **varp)
|
||||
if (i == entries)
|
||||
{
|
||||
len = (int)STRLEN("multispace");
|
||||
len2 = (int)STRLEN("leadmultispace");
|
||||
if ((varp == &p_lcs || varp == &wp->w_p_lcs)
|
||||
&& STRNCMP(p, "multispace", len) == 0
|
||||
&& p[len] == ':'
|
||||
@@ -5049,6 +5060,43 @@ set_chars_option(win_T *wp, char_u **varp)
|
||||
p = s;
|
||||
}
|
||||
}
|
||||
|
||||
else if ((varp == &p_lcs || varp == &wp->w_p_lcs)
|
||||
&& STRNCMP(p, "leadmultispace", len2) == 0
|
||||
&& p[len2] == ':'
|
||||
&& p[len2 + 1] != NUL)
|
||||
{
|
||||
s = p + len2 + 1;
|
||||
if (round == 0)
|
||||
{
|
||||
// Get length of lcsmultispace string in first round
|
||||
last_lmultispace = p;
|
||||
lead_multispace_len = 0;
|
||||
while (*s != NUL && *s != ',')
|
||||
{
|
||||
c1 = get_encoded_char_adv(&s);
|
||||
if (char2cells(c1) > 1)
|
||||
return e_invalid_argument;
|
||||
++lead_multispace_len;
|
||||
}
|
||||
if (lead_multispace_len == 0)
|
||||
// lcsmultispace cannot be an empty string
|
||||
return e_invalid_argument;
|
||||
p = s;
|
||||
}
|
||||
else
|
||||
{
|
||||
int multispace_pos = 0;
|
||||
|
||||
while (*s != NUL && *s != ',')
|
||||
{
|
||||
c1 = get_encoded_char_adv(&s);
|
||||
if (p == last_lmultispace)
|
||||
lcs_chars.leadmultispace[multispace_pos++] = c1;
|
||||
}
|
||||
p = s;
|
||||
}
|
||||
}
|
||||
else
|
||||
return e_invalid_argument;
|
||||
}
|
||||
@@ -5061,6 +5109,8 @@ set_chars_option(win_T *wp, char_u **varp)
|
||||
{
|
||||
if (wp->w_lcs_chars.multispace != NULL)
|
||||
vim_free(wp->w_lcs_chars.multispace);
|
||||
if (wp->w_lcs_chars.leadmultispace != NULL)
|
||||
vim_free(wp->w_lcs_chars.leadmultispace);
|
||||
wp->w_lcs_chars = lcs_chars;
|
||||
}
|
||||
|
||||
|
||||
@@ -3423,6 +3423,7 @@ typedef struct
|
||||
int trail;
|
||||
int lead;
|
||||
int *multispace;
|
||||
int *leadmultispace;
|
||||
#ifdef FEAT_CONCEAL
|
||||
int conceal;
|
||||
#endif
|
||||
|
||||
+4
-4
@@ -78,12 +78,11 @@ myfread(char *buf, int elsize /*ignored*/, int max, FILE *fp)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int append = 0;
|
||||
int numfiles;
|
||||
int opt;
|
||||
size_t numfiles;
|
||||
int maxfiles;
|
||||
FILE **filepointers;
|
||||
int i;
|
||||
@@ -122,7 +121,8 @@ main(int argc, char *argv[])
|
||||
filepointers = calloc(numfiles, sizeof(FILE *));
|
||||
if (filepointers == NULL)
|
||||
{
|
||||
fprintf(stderr, "Error allocating memory for %d files\n", numfiles);
|
||||
fprintf(stderr, "Error allocating memory for %ld files\n",
|
||||
(long)numfiles);
|
||||
exit(1);
|
||||
}
|
||||
for (i = 0; i < numfiles; i++)
|
||||
|
||||
@@ -3413,4 +3413,9 @@ func Test_recursive_register()
|
||||
call assert_equal('yes', caught)
|
||||
endfunc
|
||||
|
||||
func Test_long_error_message()
|
||||
" the error should be truncated, not overrun IObuff
|
||||
silent! norm Q00000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
@@ -132,7 +132,7 @@ func Test_listchars()
|
||||
\ 'h<<<<<<<<<<<$',
|
||||
\ '<<<<<<<<<<<<$',
|
||||
\ '>>>>0xx0<<<<$',
|
||||
\ '$'
|
||||
\ '$'
|
||||
\ ]
|
||||
redraw!
|
||||
for i in range(1, 5)
|
||||
@@ -162,7 +162,7 @@ func Test_listchars()
|
||||
\ ' hyYzZyYzZyY$',
|
||||
\ 'yYzZyYzZyYj $',
|
||||
\ 'yYzZ0yY0yYzZ$',
|
||||
\ '$'
|
||||
\ '$'
|
||||
\ ]
|
||||
redraw!
|
||||
for i in range(1, 5)
|
||||
@@ -172,7 +172,133 @@ func Test_listchars()
|
||||
|
||||
call assert_equal(expected, split(execute("%list"), "\n"))
|
||||
|
||||
" Test leadmultispace + multispace
|
||||
normal ggdG
|
||||
set listchars=eol:$,multispace:yYzZ,nbsp:S
|
||||
set listchars+=leadmultispace:.-+*
|
||||
set list
|
||||
|
||||
call append(0, [
|
||||
\ ' ffff ',
|
||||
\ ' i i gg',
|
||||
\ ' h ',
|
||||
\ ' j ',
|
||||
\ ' 0 0 ',
|
||||
\ ])
|
||||
|
||||
let expected = [
|
||||
\ '.-+*ffffyYzZ$',
|
||||
\ '.-i iSyYzZgg$',
|
||||
\ ' hyYzZyYzZyY$',
|
||||
\ '.-+*.-+*.-j $',
|
||||
\ '.-+*0yY0yYzZ$',
|
||||
\ '$'
|
||||
\ ]
|
||||
redraw!
|
||||
call assert_equal('eol:$,multispace:yYzZ,nbsp:S,leadmultispace:.-+*', &listchars)
|
||||
for i in range(1, 5)
|
||||
call cursor(i, 1)
|
||||
call assert_equal([expected[i - 1]], ScreenLines(i, virtcol('$')))
|
||||
endfor
|
||||
|
||||
call assert_equal(expected, split(execute("%list"), "\n"))
|
||||
|
||||
" Test leadmultispace without multispace
|
||||
normal ggdG
|
||||
set listchars-=multispace:yYzZ
|
||||
set listchars+=space:+,trail:>,eol:$
|
||||
set list
|
||||
|
||||
call append(0, [
|
||||
\ ' ffff ',
|
||||
\ ' i i gg',
|
||||
\ ' h ',
|
||||
\ ' j ',
|
||||
\ ' 0 0 ',
|
||||
\ ])
|
||||
|
||||
let expected = [
|
||||
\ '.-+*ffff>>>>$',
|
||||
\ '.-i+i+++++gg$',
|
||||
\ '+h>>>>>>>>>>$',
|
||||
\ '.-+*.-+*.-j>$',
|
||||
\ '.-+*0++0>>>>$',
|
||||
\ '$',
|
||||
\ ]
|
||||
|
||||
redraw!
|
||||
call assert_equal('eol:$,nbsp:S,leadmultispace:.-+*,space:+,trail:>,eol:$', &listchars)
|
||||
for i in range(1, 5)
|
||||
call cursor(i, 1)
|
||||
call assert_equal([expected[i - 1]], ScreenLines(i, virtcol('$')))
|
||||
endfor
|
||||
|
||||
call assert_equal(expected, split(execute("%list"), "\n"))
|
||||
|
||||
" Test leadmultispace only
|
||||
normal ggdG
|
||||
set listchars&
|
||||
set listchars=leadmultispace:.-+*
|
||||
set list
|
||||
|
||||
call append(0, [
|
||||
\ ' ffff ',
|
||||
\ ' i i gg',
|
||||
\ ' h ',
|
||||
\ ' j ',
|
||||
\ ' 0 0 ',
|
||||
\ ])
|
||||
|
||||
let expected = [
|
||||
\ '.-+*ffff ',
|
||||
\ '.-i i gg',
|
||||
\ ' h ',
|
||||
\ '.-+*.-+*.-j ',
|
||||
\ '.-+*0 0 ',
|
||||
\ ' ',
|
||||
\ ]
|
||||
redraw!
|
||||
call assert_equal('leadmultispace:.-+*', &listchars)
|
||||
for i in range(1, 5)
|
||||
call cursor(i, 1)
|
||||
call assert_equal([expected[i - 1]], ScreenLines(i, 12))
|
||||
endfor
|
||||
call assert_equal(expected, split(execute("%list"), "\n"))
|
||||
|
||||
" Test leadmultispace and lead and space
|
||||
normal ggdG
|
||||
set listchars&
|
||||
set listchars+=lead:<,space:-
|
||||
set listchars+=leadmultispace:.-+*
|
||||
set list
|
||||
|
||||
call append(0, [
|
||||
\ ' ffff ',
|
||||
\ ' i i gg',
|
||||
\ ' h ',
|
||||
\ ' j ',
|
||||
\ ' 0 0 ',
|
||||
\ ])
|
||||
|
||||
let expected = [
|
||||
\ '.-+*ffff----$',
|
||||
\ '.-i-i-----gg$',
|
||||
\ '<h----------$',
|
||||
\ '.-+*.-+*.-j-$',
|
||||
\ '.-+*0--0----$',
|
||||
\ '$',
|
||||
\ ]
|
||||
redraw!
|
||||
call assert_equal('eol:$,lead:<,space:-,leadmultispace:.-+*', &listchars)
|
||||
for i in range(1, 5)
|
||||
call cursor(i, 1)
|
||||
call assert_equal([expected[i - 1]], ScreenLines(i, virtcol('$')))
|
||||
endfor
|
||||
call assert_equal(expected, split(execute("%list"), "\n"))
|
||||
|
||||
" the last occurrence of 'multispace:' is used
|
||||
set listchars&
|
||||
set listchars+=multispace:yYzZ
|
||||
set listchars+=space:x,multispace:XyY
|
||||
|
||||
let expected = [
|
||||
@@ -181,9 +307,10 @@ func Test_listchars()
|
||||
\ 'xhXyYXyYXyYX$',
|
||||
\ 'XyYXyYXyYXjx$',
|
||||
\ 'XyYX0Xy0XyYX$',
|
||||
\ '$'
|
||||
\ '$'
|
||||
\ ]
|
||||
redraw!
|
||||
call assert_equal('eol:$,multispace:yYzZ,space:x,multispace:XyY', &listchars)
|
||||
for i in range(1, 5)
|
||||
call cursor(i, 1)
|
||||
call assert_equal([expected[i - 1]], ScreenLines(i, virtcol('$')))
|
||||
@@ -199,7 +326,7 @@ func Test_listchars()
|
||||
\ '>h<<<<<<<<<<$',
|
||||
\ '>>>>>>>>>>j<$',
|
||||
\ '>>>>0Xy0<<<<$',
|
||||
\ '$'
|
||||
\ '$'
|
||||
\ ]
|
||||
redraw!
|
||||
for i in range(1, 5)
|
||||
@@ -219,7 +346,7 @@ func Test_listchars()
|
||||
\ '>h<<<<<<<<<<$',
|
||||
\ '>>>>>>>>>>j<$',
|
||||
\ '>>>>0xx0<<<<$',
|
||||
\ '$'
|
||||
\ '$'
|
||||
\ ]
|
||||
redraw!
|
||||
for i in range(1, 5)
|
||||
@@ -315,11 +442,13 @@ func Test_listchars_invalid()
|
||||
call assert_fails('set listchars=x', 'E474:')
|
||||
call assert_fails('set listchars=x', 'E474:')
|
||||
call assert_fails('set listchars=multispace', 'E474:')
|
||||
call assert_fails('set listchars=leadmultispace', 'E474:')
|
||||
|
||||
" Too short
|
||||
call assert_fails('set listchars=space:', 'E474:')
|
||||
call assert_fails('set listchars=tab:x', 'E474:')
|
||||
call assert_fails('set listchars=multispace:', 'E474:')
|
||||
call assert_fails('set listchars=leadmultispace:', 'E474:')
|
||||
|
||||
" One occurrence too short
|
||||
call assert_fails('set listchars=space:,space:x', 'E474:')
|
||||
@@ -328,6 +457,8 @@ func Test_listchars_invalid()
|
||||
call assert_fails('set listchars=tab:xx,tab:x', 'E474:')
|
||||
call assert_fails('set listchars=multispace:,multispace:x', 'E474:')
|
||||
call assert_fails('set listchars=multispace:x,multispace:', 'E474:')
|
||||
call assert_fails('set listchars=leadmultispace:,leadmultispace:x', 'E474:')
|
||||
call assert_fails('set listchars=leadmultispace:x,leadmultispace:', 'E474:')
|
||||
|
||||
" Too long
|
||||
call assert_fails('set listchars=space:xx', 'E474:')
|
||||
@@ -340,6 +471,8 @@ func Test_listchars_invalid()
|
||||
call assert_fails('set listchars=tab:xx·', 'E474:')
|
||||
call assert_fails('set listchars=multispace:·', 'E474:')
|
||||
call assert_fails('set listchars=multispace:xxx·', 'E474:')
|
||||
call assert_fails('set listchars=leadmultispace:·', 'E474:')
|
||||
call assert_fails('set listchars=leadmultispace:xxx·', 'E474:')
|
||||
|
||||
" Has control character
|
||||
call assert_fails("set listchars=space:\x01", 'E474:')
|
||||
@@ -354,6 +487,10 @@ func Test_listchars_invalid()
|
||||
call assert_fails('set listchars=tab:xx\\x01', 'E474:')
|
||||
call assert_fails('set listchars=multispace:\\x01', 'E474:')
|
||||
call assert_fails('set listchars=multispace:xxx\\x01', 'E474:')
|
||||
call assert_fails("set listchars=leadmultispace:\x01", 'E474:')
|
||||
call assert_fails('set listchars=leadmultispace:\\x01', 'E474:')
|
||||
call assert_fails("set listchars=leadmultispace:xxx\x01", 'E474:')
|
||||
call assert_fails('set listchars=leadmultispace:xxx\\x01', 'E474:')
|
||||
|
||||
enew!
|
||||
set ambiwidth& listchars& ff&
|
||||
|
||||
@@ -1685,4 +1685,34 @@ func Test_expr_map_escape_special()
|
||||
nunmap …
|
||||
endfunc
|
||||
|
||||
" Testing for mapping after an <Nop> mapping is triggered on timeout.
|
||||
" Test for what patch 8.1.0052 fixes.
|
||||
func Test_map_after_timed_out_nop()
|
||||
CheckRunVimInTerminal
|
||||
|
||||
let lines =<< trim END
|
||||
set timeout timeoutlen=400
|
||||
inoremap ab TEST
|
||||
inoremap a <Nop>
|
||||
END
|
||||
call writefile(lines, 'Xtest_map_after_timed_out_nop')
|
||||
let buf = RunVimInTerminal('-S Xtest_map_after_timed_out_nop', #{rows: 6})
|
||||
|
||||
" Enter Insert mode
|
||||
call term_sendkeys(buf, 'i')
|
||||
" Wait for the "a" mapping to timeout
|
||||
call term_sendkeys(buf, 'a')
|
||||
call term_wait(buf, 500)
|
||||
" Send "a" and wait for a period shorter than 'timeoutlen'
|
||||
call term_sendkeys(buf, 'a')
|
||||
call term_wait(buf, 100)
|
||||
" Send "b", should trigger the "ab" mapping
|
||||
call term_sendkeys(buf, 'b')
|
||||
call WaitForAssert({-> assert_equal("TEST", term_getline(buf, 1))})
|
||||
|
||||
" clean up
|
||||
call StopVimInTerminal(buf)
|
||||
call delete('Xtest_map_after_timed_out_nop')
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
@@ -749,6 +749,22 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
5069,
|
||||
/**/
|
||||
5068,
|
||||
/**/
|
||||
5067,
|
||||
/**/
|
||||
5066,
|
||||
/**/
|
||||
5065,
|
||||
/**/
|
||||
5064,
|
||||
/**/
|
||||
5063,
|
||||
/**/
|
||||
5062,
|
||||
/**/
|
||||
5061,
|
||||
/**/
|
||||
|
||||
@@ -5193,6 +5193,7 @@ win_free(
|
||||
clear_winopt(&wp->w_allbuf_opt);
|
||||
|
||||
vim_free(wp->w_lcs_chars.multispace);
|
||||
vim_free(wp->w_lcs_chars.leadmultispace);
|
||||
|
||||
#ifdef FEAT_EVAL
|
||||
vars_clear(&wp->w_vars->dv_hashtab); // free all w: variables
|
||||
|
||||
Reference in New Issue
Block a user