Compare commits

...

8 Commits

Author SHA1 Message Date
8ba2738f06 filetype: cake filetype is not recognized
Problem: filetype: cake filetype is not recognized
Solution: detect cake files as cs
2025-01-02 18:48:29 +01:00
ichizok
663d18d610 patch 9.1.0984: exception handling can be improved
Problem:  exception handling can be improved
Solution: add v:stacktrace and getstacktrace()

closes: #16360

Co-authored-by: Naruhiko Nishino <naru123456789@gmail.com>
Signed-off-by: ichizok <gclient.gaap@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-01-02 18:06:00 +01:00
h-east
fd771613b3 runtime(doc): update doc for :horizontal
Revert the documentation for :horizontal from commit
0c3e57b403 because :horizontal cannot be shortened to :ho

closes: #16362

Signed-off-by: h-east <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-01-02 17:34:55 +01:00
h-east
0c3e57b403 runtime(doc): update index.txt, windows.txt and version9.txt
closes: #16357

Co-authored-by: Aliaksei Budavei <32549825+zzzyxwvut@users.noreply.github.com>
Signed-off-by: h-east <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-01-02 11:00:49 +01:00
h-east
e80f345b5d runtime(doc): Tweak documentation about base64 function
closes: #16353

Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-01-02 10:42:07 +01:00
nibo
8dc98bf427 runtime(chordpro): update syntax script
References:
https://chordpro.org/beta/directives-define/#defining-chords-for-keyboard-instruments

Signed-off-by: nibo <nibo@relim.de>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-12-31 11:24:46 +01:00
glepnir
d4088edae2 patch 9.1.0983: not able to get the displayed items in complete_info()
Problem:  not able to get the displayed items in complete_info()
          (Evgeni Chasnovski)
Solution: return the visible items via the "matches" key for
          complete_info() (glepnir)

fixes: #10007
closes: #16307

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-12-31 10:58:30 +01:00
Andrea Pappacoda
34e271b321 runtime(doc): use standard SGR format at :h xterm-true-color
By default, Vim uses the non-standard, but widely supported, legacy
xterm/Konsole format for setting "direct colors" with set setaf and
setbf escape codes, which use semicolons as separators.

The documentation for xterm-true-color mentions that, as an alternative,
users can set alternative sequences that use colons instead of
semicolons. This format, though, isn't standard and it is unclear how
widely supported it is; it was added by xterm patch 282 due to a
misinterpretation of the ISO 8613-6 (ITU T.416) standard, and was later
changed to the format suggested by this patch, which is the one
specified in the standard.

Today, looking at ncurses' [terminfo], it seems that all terminal
emulators use either the standard format (named "xterm+direct" in the
terminfo source) or the legacy format (named "xterm+indirect" in the
terminfo source).

Hence, I believe it makes sense to align the docs with reality.

If you're interested in the story of this escape sequence, I'd recommend
reading
<https://invisible-island.net/ncurses/ncurses.faq.html#xterm_16MegaColors>.

[terminfo]: https://invisible-island.net/ncurses/terminfo.ti.html

closes: #16350

Signed-off-by: Christian Brabandt <cb@256bit.org>
Signed-off-by: Andrea Pappacoda <andrea@pappacoda.it>
2024-12-31 10:46:22 +01:00
26 changed files with 440 additions and 98 deletions

View File

@@ -1,4 +1,4 @@
*builtin.txt* For Vim version 9.1. Last change: 2024 Dec 30
*builtin.txt* For Vim version 9.1. Last change: 2025 Jan 02
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -67,8 +67,8 @@ autocmd_get([{opts}]) List return a list of autocmds
balloon_gettext() String current text in the balloon
balloon_show({expr}) none show {expr} inside the balloon
balloon_split({msg}) List split {msg} as used for a balloon
base64_decode({string}) Blob base-64 decode {string} characters
base64_encode({blob}) String base-64 encode the bytes in {blob}
base64_decode({string}) Blob base64 decode {string} characters
base64_encode({blob}) String base64 encode the bytes in {blob}
bindtextdomain({package}, {path})
Bool bind text domain to specified path
blob2list({blob}) List convert {blob} into a list of numbers
@@ -279,6 +279,7 @@ getregionpos({pos1}, {pos2} [, {opts}])
List get a list of positions for a region
getregtype([{regname}]) String type of a register
getscriptinfo([{opts}]) List list of sourced scripts
getstacktrace() List get current stack trace of Vim scripts
gettabinfo([{expr}]) List list of tab pages
gettabvar({nr}, {varname} [, {def}])
any variable {varname} in tab {nr} or {def}
@@ -1171,43 +1172,6 @@ autocmd_get([{opts}]) *autocmd_get()*
Return type: list<dict<any>>
base64_decode({string}) *base64_decode()*
Return a Blob containing the bytes decoded from the base64
characters in {string}.
The {string} argument should contain only base64-encoded
characters and should have a length that is a multiple of 4.
Returns an empty blob on error.
Examples: >
" Write the decoded contents to a binary file
call writefile(base64_decode(s), 'tools.bmp')
" Decode a base64-encoded string
echo list2str(blob2list(base64_decode(encodedstr)))
<
Can also be used as a |method|: >
GetEncodedString()->base64_decode()
<
Return type: |Blob|
base64_encode({blob}) *base64_encode()*
Return a base64-encoded String representing the bytes in
{blob}. The base64 alphabet defined in RFC 4648 is used.
Examples: >
" Encode the contents of a binary file
echo base64_encode(readblob('somefile.bin'))
" Encode a string
echo base64_encode(list2blob(str2list(somestr)))
<
Can also be used as a |method|: >
GetBinaryData()->base64_encode()
<
Return type: |String|
balloon_gettext() *balloon_gettext()*
Return the current text in the balloon. Only for the string,
not used for the List. Returns an empty string if balloon
@@ -1264,6 +1228,43 @@ balloon_split({msg}) *balloon_split()*
Return type: list<any> or list<string>
base64_decode({string}) *base64_decode()*
Return a Blob containing the bytes decoded from the base64
encoded characters in {string}.
The {string} argument should contain only base64-encoded
characters and should have a length that is a multiple of 4.
Returns an empty blob on error.
Examples: >
" Write the decoded contents to a binary file
call writefile(base64_decode(s), 'tools.bmp')
" Decode a base64-encoded string
echo list2str(blob2list(base64_decode(encodedstr)))
<
Can also be used as a |method|: >
GetEncodedString()->base64_decode()
<
Return type: |Blob|
base64_encode({blob}) *base64_encode()*
Return a base64-encoded String representing the bytes in
{blob}. The base64 alphabet defined in RFC 4648 is used.
Examples: >
" Encode the contents of a binary file
echo base64_encode(readblob('somefile.bin'))
" Encode a string
echo base64_encode(list2blob(str2list(somestr)))
<
Can also be used as a |method|: >
GetBinaryData()->base64_encode()
<
Return type: |String|
bindtextdomain({package}, {path}) *bindtextdomain()*
Bind a specific {package} to a {path} so that the
|gettext()| function can be used to get language-specific
@@ -1896,10 +1897,15 @@ complete_info([{what}]) *complete_info()*
See |complete_info_mode| for the values.
pum_visible |TRUE| if popup menu is visible.
See |pumvisible()|.
items List of completion matches. Each item is a
dictionary containing the entries "word",
items List of all completion candidates. Each item
is a dictionary containing the entries "word",
"abbr", "menu", "kind", "info" and "user_data".
See |complete-items|.
matches Same as "items", but only returns items that
are matching current query. If both "matches"
and "items" are in "what", the returned list
will still be named "items", but each item
will have an additional "match" field.
selected Selected item index. First index is zero.
Index is -1 if no item is selected (showing
typed text only, or the last completion after
@@ -4992,6 +4998,21 @@ getscriptinfo([{opts}]) *getscriptinfo()*
Return type: list<dict<any>>
getstacktrace() *getstacktrace()*
Returns the current stack trace of Vim scripts.
Stack trace is a |List|, of which each item is a |Dictionary|
with the following items:
funcref The funcref if the stack is at the function,
otherwise this item is not exist.
event The string of the event description if the
stack is at autocmd event, otherwise this item
is not exist.
lnum The line number of the script on the stack.
filepath The file path of the script on the stack.
Return type: list<dict<any>>
gettabinfo([{tabnr}]) *gettabinfo()*
If {tabnr} is not specified, then information about all the
tab pages is returned as a |List|. Each List item is a

View File

@@ -1,4 +1,4 @@
*eval.txt* For Vim version 9.1. Last change: 2024 Dec 23
*eval.txt* For Vim version 9.1. Last change: 2025 Jan 02
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1953,7 +1953,8 @@ variables for each buffer. Use local buffer variables instead |b:var|.
PREDEFINED VIM VARIABLES *vim-variable* *v:var* *v:*
*E963* *E1063*
Some variables can be set by the user, but the type cannot be changed.
Most variables are read-only, when a variable can be set by the user, it will
be mentioned at the variable description below. The type cannot be changed.
*v:argv* *argv-variable*
v:argv The command line arguments Vim was invoked with. This is a
@@ -2172,7 +2173,8 @@ v:event Dictionary containing information about the current
<
*v:exception* *exception-variable*
v:exception The value of the exception most recently caught and not
finished. See also |v:throwpoint| and |throw-variables|.
finished. See also |v:stacktrace|, |v:throwpoint|, and
|throw-variables|.
Example: >
:try
: throw "oops"
@@ -2548,6 +2550,12 @@ v:sizeofpointer Number of bytes in a pointer. Depends on how Vim was compiled.
This is only useful for deciding whether a test will give the
expected result.
*v:stacktrace* *stacktrace-variable*
v:stacktrace The stack trace of the exception most recently caught and
not finished. Refer to |getstacktrace()| for the structure of
stack trace. See also |v:exception|, |v:throwpoint|, and
|throw-variables|.
*v:statusmsg* *statusmsg-variable*
v:statusmsg Last given status message. It's allowed to set this variable.
@@ -2676,7 +2684,7 @@ v:this_session Full filename of the last loaded or saved session file. See
*v:throwpoint* *throwpoint-variable*
v:throwpoint The point where the exception most recently caught and not
finished was thrown. Not set when commands are typed. See
also |v:exception| and |throw-variables|.
also |v:exception|, |v:stacktrace|, and |throw-variables|.
Example: >
:try
: throw "oops"
@@ -3856,7 +3864,8 @@ in the variable |v:exception|: >
: echo "Number thrown. Value is" v:exception
You may also be interested where an exception was thrown. This is stored in
|v:throwpoint|. Note that "v:exception" and "v:throwpoint" are valid for the
|v:throwpoint|. And you can obtain the stack trace from |v:stacktrace|.
Note that "v:exception", "v:stacktrace" and "v:throwpoint" are valid for the
exception most recently caught as long it is not finished.
Example: >

View File

@@ -1,4 +1,4 @@
*index.txt* For Vim version 9.1. Last change: 2024 Dec 15
*index.txt* For Vim version 9.1. Last change: 2025 Jan 02
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1185,6 +1185,7 @@ tag command action ~
|:abbreviate| :ab[breviate] enter abbreviation
|:abclear| :abc[lear] remove all abbreviations
|:aboveleft| :abo[veleft] make split window appear left or above
|:abstract| :abstract declare a Vim9 abstract class
|:all| :al[l] open a window for each file in the argument
list
|:amenu| :am[enu] enter new menu item for all modes
@@ -1224,7 +1225,7 @@ tag command action ~
|:breakdel| :breakd[el] delete a debugger breakpoint
|:breaklist| :breakl[ist] list debugger breakpoints
|:browse| :bro[wse] use file selection dialog
|:bufdo| :bufdo execute command in each listed buffer
|:bufdo| :bufd[o] execute command in each listed buffer
|:buffers| :buffers list all files in the buffer list
|:bunload| :bun[load] unload a specific buffer
|:bwipeout| :bw[ipeout] really delete a buffer
@@ -1240,7 +1241,7 @@ tag command action ~
|:cafter| :caf[ter] go to error after current cursor
|:call| :cal[l] call a function
|:catch| :cat[ch] part of a :try command
|:cbefore| :cbef[ore] go to error before current cursor
|:cbefore| :cbe[fore] go to error before current cursor
|:cbelow| :cbel[ow] go to error below current line
|:cbottom| :cbo[ttom] scroll to the bottom of the quickfix window
|:cbuffer| :cb[uffer] parse error messages and jump to first error
@@ -1300,7 +1301,7 @@ tag command action ~
|:debuggreedy| :debugg[reedy] read debug mode commands from normal input
|:def| :def define a Vim9 user function
|:defcompile| :defc[ompile] compile Vim9 user functions in current script
|:defer| :defer call function when current function is done
|:defer| :defe[r] call function when current function is done
|:delcommand| :delc[ommand] delete user-defined command
|:delfunction| :delf[unction] delete a user function
|:delmarks| :delm[arks] delete marks
@@ -1310,7 +1311,7 @@ tag command action ~
|:diffpatch| :diffp[atch] apply a patch and show differences
|:diffput| :diffpu[t] remove differences in other buffer
|:diffsplit| :diffs[plit] show differences with another file
|:diffthis| :diffthis make current window a diff window
|:diffthis| :difft[his] make current window a diff window
|:digraphs| :dig[raphs] show or enter digraphs
|:display| :di[splay] display registers
|:disassemble| :disa[ssemble] disassemble Vim9 user function
@@ -1338,12 +1339,15 @@ tag command action ~
|:emenu| :em[enu] execute a menu by name
|:endclass| :endclass end of a class specification
|:enddef| :enddef end of a user function started with :def
|:endenum| :endenum end of an enum specification
|:endif| :en[dif] end previous :if
|:endinterface| :endinterface end of an interface specification
|:endfor| :endfo[r] end previous :for
|:endfunction| :endf[unction] end of a user function started with :function
|:endtry| :endt[ry] end previous :try
|:endwhile| :endw[hile] end previous :while
|:enew| :ene[w] edit a new, unnamed buffer
|:enum| :enum start of an enum declaration
|:eval| :ev[al] evaluate an expression and discard the result
|:ex| :ex same as ":edit"
|:execute| :exe[cute] execute result of expressions
@@ -1397,6 +1401,7 @@ tag command action ~
|:inoreabbrev| :inorea[bbrev] like ":noreabbrev" but for Insert mode
|:inoremenu| :inoreme[nu] like ":noremenu" but for Insert mode
|:intro| :int[ro] print the introductory message
|:interface| :interface start of an interface declaration
|:isearch| :is[earch] list one line where identifier matches
|:isplit| :isp[lit] split window and jump to definition of
identifier
@@ -1421,7 +1426,7 @@ tag command action ~
|:last| :la[st] go to the last file in the argument list
|:language| :lan[guage] set the language (locale)
|:later| :lat[er] go to newer change, redo
|:lbefore| :lbef[ore] go to location before current cursor
|:lbefore| :lbe[fore] go to location before current cursor
|:lbelow| :lbel[ow] go to location below current line
|:lbottom| :lbo[ttom] scroll to the bottom of the location window
|:lbuffer| :lb[uffer] parse locations and jump to first location
@@ -1461,7 +1466,7 @@ tag command action ~
|:lockmarks| :loc[kmarks] following command keeps marks where they are
|:lockvar| :lockv[ar] lock variables
|:lolder| :lol[der] go to older location list
|:lopen| :lope[n] open location window
|:lopen| :lop[en] open location window
|:lprevious| :lp[revious] go to previous location
|:lpfile| :lpf[ile] go to last location in previous file
|:lrewind| :lr[ewind] go to the specified location, default first one
@@ -1496,7 +1501,7 @@ tag command action ~
|:mzfile| :mzf[ile] execute MzScheme script file
|:nbclose| :nbc[lose] close the current Netbeans session
|:nbkey| :nb[key] pass a key to Netbeans
|:nbstart| :nbs[art] start a new Netbeans session
|:nbstart| :nbs[tart] start a new Netbeans session
|:next| :n[ext] go to next file in the argument list
|:new| :new create a new empty window
|:nmap| :nm[ap] like ":map" but for Normal mode
@@ -1682,7 +1687,7 @@ tag command action ~
|:tNext| :tN[ext] jump to previous matching tag
|:tabNext| :tabN[ext] go to previous tab page
|:tabclose| :tabc[lose] close current tab page
|:tabdo| :tabdo execute command in each tab page
|:tabdo| :tabd[o] execute command in each tab page
|:tabedit| :tabe[dit] edit a file in a new tab page
|:tabfind| :tabf[ind] find file in 'path', edit it in a new tab page
|:tabfirst| :tabfir[st] go to first tab page
@@ -1706,6 +1711,8 @@ tag command action ~
|:terminal| :ter[minal] open a terminal window
|:tfirst| :tf[irst] jump to first matching tag
|:throw| :th[row] throw an exception
|:this| :this prefix for an object member during
initialization (e.g. on |new()|)
|:tjump| :tj[ump] like ":tselect", but jump directly when there
is only one match
|:tlast| :tl[ast] jump to last matching tag
@@ -1724,6 +1731,7 @@ tag command action ~
|:tselect| :ts[elect] list matching tags and select one
|:tunmap| :tunma[p] like ":unmap" but for Terminal-Job mode
|:tunmenu| :tu[nmenu] remove menu tooltip
|:type| :type create a type alias
|:undo| :u[ndo] undo last change(s)
|:undojoin| :undoj[oin] join next change with previous undo block
|:undolist| :undol[ist] list leafs of the undo tree
@@ -1757,7 +1765,7 @@ tag command action ~
|:vsplit| :vs[plit] split current window vertically
|:vunmap| :vu[nmap] like ":unmap" but for Visual+Select mode
|:vunmenu| :vunme[nu] remove menu for Visual+Select mode
|:windo| :windo execute command in each window
|:windo| :wind[o] execute command in each window
|:write| :w[rite] write to a file
|:wNext| :wN[ext] write to a file and go to previous file in
argument list

View File

@@ -1,4 +1,4 @@
*insert.txt* For Vim version 9.1. Last change: 2024 Dec 28
*insert.txt* For Vim version 9.1. Last change: 2024 Dec 31
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1195,6 +1195,7 @@ items:
|hl-PmenuKind| highlight group, allowing for the
customization of ctermfg and guifg properties for the
completion kind
match See "matches" in |complete_info()|.
All of these except "icase", "equal", "dup" and "empty" must be a string. If
an item does not meet these requirements then an error message is given and

View File

@@ -3058,9 +3058,9 @@ $quote eval.txt /*$quote*
:promptrepl change.txt /*:promptrepl*
:ps windows.txt /*:ps*
:psearch windows.txt /*:psearch*
:pt windows.txt /*:pt*
:ptN tagsrch.txt /*:ptN*
:ptNext tagsrch.txt /*:ptNext*
:pta windows.txt /*:pta*
:ptag windows.txt /*:ptag*
:ptf tagsrch.txt /*:ptf*
:ptfirst tagsrch.txt /*:ptfirst*
@@ -7908,6 +7908,7 @@ getscript-history pi_getscript.txt /*getscript-history*
getscript-plugins pi_getscript.txt /*getscript-plugins*
getscript-start pi_getscript.txt /*getscript-start*
getscriptinfo() builtin.txt /*getscriptinfo()*
getstacktrace() builtin.txt /*getstacktrace()*
gettabinfo() builtin.txt /*gettabinfo()*
gettabvar() builtin.txt /*gettabvar()*
gettabwinvar() builtin.txt /*gettabwinvar()*
@@ -10218,6 +10219,7 @@ sqrt() builtin.txt /*sqrt()*
squirrel.vim syntax.txt /*squirrel.vim*
srand() builtin.txt /*srand()*
sscanf eval.txt /*sscanf*
stacktrace-variable eval.txt /*stacktrace-variable*
standard-plugin usr_05.txt /*standard-plugin*
standard-plugin-list help.txt /*standard-plugin-list*
standout syntax.txt /*standout*
@@ -11038,6 +11040,7 @@ v:shell_error eval.txt /*v:shell_error*
v:sizeofint eval.txt /*v:sizeofint*
v:sizeoflong eval.txt /*v:sizeoflong*
v:sizeofpointer eval.txt /*v:sizeofpointer*
v:stacktrace eval.txt /*v:stacktrace*
v:statusmsg eval.txt /*v:statusmsg*
v:swapchoice eval.txt /*v:swapchoice*
v:swapcommand eval.txt /*v:swapcommand*

View File

@@ -1,4 +1,4 @@
*term.txt* For Vim version 9.1. Last change: 2024 Oct 05
*term.txt* For Vim version 9.1. Last change: 2024 Dec 31
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -688,10 +688,11 @@ The default values are set like this: >
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
Some terminals accept the same sequences, but with all semicolons replaced by
colons (this is actually more compatible, but less widely supported): >
let &t_8f = "\<Esc>[38:2:%lu:%lu:%lum"
let &t_8b = "\<Esc>[48:2:%lu:%lu:%lum"
Some terminals accept similar sequences, with semicolons replaced by colons
and an extra colon after the number 2 (this is conformant to the ISO 8613-6
standard, but less widely supported): >
let &t_8f = "\<Esc>[38:2::%lu:%lu:%lum"
let &t_8b = "\<Esc>[48:2::%lu:%lu:%lum"
These options contain printf strings, with |printf()| (actually, its C
equivalent hence `l` modifier) invoked with the t_ option value and three

View File

@@ -1,4 +1,4 @@
*usr_41.txt* For Vim version 9.1. Last change: 2024 Dec 30
*usr_41.txt* For Vim version 9.1. Last change: 2025 Jan 02
VIM USER MANUAL - by Bram Moolenaar
@@ -1399,7 +1399,8 @@ Various: *various-functions*
eventhandler() check if invoked by an event handler
getcellpixels() get List of cell pixel size
getpid() get process ID of Vim
getscriptinfo() get list of sourced vim scripts
getscriptinfo() get list of sourced Vim scripts
getstacktrace() get current stack trace of Vim scripts
getimstatus() check if IME status is active
interrupt() interrupt script execution
windowsversion() get MS-Windows version

View File

@@ -1,4 +1,4 @@
*version9.txt* For Vim version 9.1. Last change: 2024 Dec 30
*version9.txt* For Vim version 9.1. Last change: 2025 Jan 02
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -31849,14 +31849,14 @@ Autocommands: ~
Commands: ~
|:abstract| define a Vim9 abstract class
|:class| start of a class specification
|:abstract| declare a Vim9 abstract class
|:class| start of a class declaration
|:defer| call function when current function is done
|:echowindow| same as :echomsg, but use a popup window
|:endinterface| end of an interface specification
|:endclass| end of a class specification
|:endinterface| end of an interface declaration
|:endclass| end of a class declaration
|:horizontal| following window command works horizontally
|:interface| start of an interface specification
|:interface| start of an interface declaration
|:public| prefix for a class or object member
|:static| prefix for a class member or function
|:this| prefix for an object member
@@ -41621,6 +41621,10 @@ Changed~
instead of the "sh" filetype
- the default value of the 'keyprotocol' option has been updated by support
for the ghostty terminal emulator (using kitty protocol)
- |complete_info()| returns the list of matches shown in the poppu menu via
the "matches" key
- |v:stacktrace| The stack trace of the exception most recently caught and
not finished
*added-9.2*
Added ~
@@ -41640,6 +41644,7 @@ Functions: ~
|getcmdprompt()| get prompt for input()/confirm()
|getregion()| get a region of text from a buffer
|getregionpos()| get a list of positions for a region
|getstacktrace()| get current stack trace of Vim scripts
|id()| get unique identifier for a Dict, List, Object,
Channel or Blob variable
|matchbufline()| all the matches of a pattern in a buffer

View File

@@ -1,4 +1,4 @@
*windows.txt* For Vim version 9.1. Last change: 2024 Dec 29
*windows.txt* For Vim version 9.1. Last change: 2025 Jan 02
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -968,8 +968,8 @@ A few peculiarities:
trigger the ATTENTION and responding "A" for Abort, the preview window will
become empty.
*:pta* *:ptag*
:pta[g][!] [tagname]
*:pt* *:ptag*
:pt[ag][!] [tagname]
Does ":tag[!] [tagname]" and shows the found tag in a
"Preview" window without changing the current buffer or cursor
position. If a "Preview" window already exists, it is re-used

View File

@@ -342,7 +342,7 @@ au BufNewFile,BufRead *.capnp setf capnp
au BufNewFile,BufRead cgdbrc setf cgdbrc
" C#
au BufNewFile,BufRead *.cs,*.csx setf cs
au BufNewFile,BufRead *.cs,*.csx,*.cake setf cs
" CSDL
au BufNewFile,BufRead *.csdl setf csdl

View File

@@ -2,6 +2,7 @@
" Language: ChordPro 6 (https://www.chordpro.org)
" Maintainer: Niels Bo Andersen <niels@niboan.dk>
" Last Change: 2022-04-15
" 2024 Dec 31: add "keys" as syntax keyword (via: https://groups.google.com/g/vim_dev/c/vP4epus0euM/m/mNoDY6hsCQAJ)
" Quit when a syntax file was already loaded
if exists("b:current_syntax")
@@ -104,7 +105,7 @@ syn match chordproStandardMetadata /instrument\.description/ contained
syn match chordproStandardMetadata /user\.name/ contained
syn match chordproStandardMetadata /user\.fullname/ contained
syn keyword chordproDefineKeyword contained frets fingers
syn keyword chordproDefineKeyword contained frets fingers keys
syn match chordproDefineKeyword /base-fret/ contained
syn match chordproArgumentsNumber /\d\+/ contained

View File

@@ -531,6 +531,29 @@ dict_add_callback(dict_T *d, char *key, callback_T *cb)
return OK;
}
/*
* Add a function entry to dictionary "d".
* Returns FAIL when out of memory and when key already exists.
*/
int
dict_add_func(dict_T *d, char *key, ufunc_T *fp)
{
dictitem_T *item;
item = dictitem_alloc((char_u *)key);
if (item == NULL)
return FAIL;
item->di_tv.v_type = VAR_FUNC;
item->di_tv.vval.v_string = vim_strsave(fp->uf_name);
if (dict_add(d, item) == FAIL)
{
dictitem_free(item);
return FAIL;
}
func_ref(item->di_tv.vval.v_string);
return OK;
}
/*
* Initializes "iter" for iterating over dictionary items with
* dict_iterate_next().

View File

@@ -2170,6 +2170,8 @@ static funcentry_T global_functions[] =
ret_string, f_getregtype},
{"getscriptinfo", 0, 1, 0, arg1_dict_any,
ret_list_dict_any, f_getscriptinfo},
{"getstacktrace", 0, 0, 0, NULL,
ret_list_dict_any, f_getstacktrace},
{"gettabinfo", 0, 1, FEARG_1, arg1_number,
ret_list_dict_any, f_gettabinfo},
{"gettabvar", 2, 3, FEARG_1, arg3_number_string_any,

View File

@@ -160,7 +160,8 @@ static struct vimvar
{VV_NAME("python3_version", VAR_NUMBER), NULL, VV_RO},
{VV_NAME("t_typealias", VAR_NUMBER), NULL, VV_RO},
{VV_NAME("t_enum", VAR_NUMBER), NULL, VV_RO},
{VV_NAME("t_enumvalue", VAR_NUMBER), NULL, VV_RO}
{VV_NAME("t_enumvalue", VAR_NUMBER), NULL, VV_RO},
{VV_NAME("stacktrace", VAR_LIST), &t_list_string, VV_RO},
};
// shorthand

View File

@@ -562,6 +562,10 @@ throw_exception(void *value, except_type_T type, char_u *cmdname)
excp->throw_lnum = SOURCING_LNUM;
}
excp->stacktrace = stacktrace_create();
if (excp->stacktrace != NULL)
excp->stacktrace->lv_refcount = 1;
if (p_verbose >= 13 || debug_break_level > 0)
{
int save_msg_silent = msg_silent;
@@ -647,6 +651,7 @@ discard_exception(except_T *excp, int was_finished)
if (excp->type == ET_ERROR)
free_msglist(excp->messages);
vim_free(excp->throw_name);
list_unref(excp->stacktrace);
vim_free(excp);
}
@@ -671,6 +676,7 @@ catch_exception(except_T *excp)
excp->caught = caught_stack;
caught_stack = excp;
set_vim_var_string(VV_EXCEPTION, (char_u *)excp->value, -1);
set_vim_var_list(VV_STACKTRACE, excp->stacktrace);
if (*excp->throw_name != NUL)
{
if (excp->throw_lnum != 0)
@@ -721,6 +727,7 @@ finish_exception(except_T *excp)
if (caught_stack != NULL)
{
set_vim_var_string(VV_EXCEPTION, (char_u *)caught_stack->value, -1);
set_vim_var_list(VV_STACKTRACE, caught_stack->stacktrace);
if (*caught_stack->throw_name != NUL)
{
if (caught_stack->throw_lnum != 0)
@@ -741,6 +748,7 @@ finish_exception(except_T *excp)
{
set_vim_var_string(VV_EXCEPTION, NULL, -1);
set_vim_var_string(VV_THROWPOINT, NULL, -1);
set_vim_var_list(VV_STACKTRACE, NULL);
}
// Discard the exception, but use the finish message for 'verbose'.

View File

@@ -106,6 +106,7 @@ struct compl_S
int cp_flags; // CP_ values
int cp_number; // sequence number
int cp_score; // fuzzy match score
int cp_in_match_array; // collected by compl_match_array
int cp_user_abbr_hlattr; // highlight attribute for abbr
int cp_user_kind_hlattr; // highlight attribute for kind
};
@@ -1282,6 +1283,7 @@ ins_compl_build_pum(void)
do
{
compl->cp_in_match_array = FALSE;
// When 'completeopt' contains "fuzzy" and leader is not NULL or empty,
// set the cp_score for later comparisons.
if (compl_fuzzy_match && compl_leader.string != NULL && compl_leader.length > 0)
@@ -1293,6 +1295,7 @@ ins_compl_build_pum(void)
|| (compl_fuzzy_match && compl->cp_score > 0)))
{
++compl_match_arraysize;
compl->cp_in_match_array = TRUE;
if (match_head == NULL)
match_head = compl;
else
@@ -3259,11 +3262,12 @@ get_complete_info(list_T *what_list, dict_T *retdict)
#define CI_WHAT_ITEMS 0x04
#define CI_WHAT_SELECTED 0x08
#define CI_WHAT_INSERTED 0x10
#define CI_WHAT_MATCHES 0x20
#define CI_WHAT_ALL 0xff
int what_flag;
if (what_list == NULL)
what_flag = CI_WHAT_ALL;
what_flag = CI_WHAT_ALL & ~CI_WHAT_MATCHES;
else
{
what_flag = 0;
@@ -3282,6 +3286,8 @@ get_complete_info(list_T *what_list, dict_T *retdict)
what_flag |= CI_WHAT_SELECTED;
else if (STRCMP(what, "inserted") == 0)
what_flag |= CI_WHAT_INSERTED;
else if (STRCMP(what, "matches") == 0)
what_flag |= CI_WHAT_MATCHES;
}
}
@@ -3291,19 +3297,23 @@ get_complete_info(list_T *what_list, dict_T *retdict)
if (ret == OK && (what_flag & CI_WHAT_PUM_VISIBLE))
ret = dict_add_number(retdict, "pum_visible", pum_visible());
if (ret == OK && (what_flag & CI_WHAT_ITEMS || what_flag & CI_WHAT_SELECTED))
if (ret == OK && (what_flag & CI_WHAT_ITEMS || what_flag & CI_WHAT_SELECTED
|| what_flag & CI_WHAT_MATCHES))
{
list_T *li = NULL;
dict_T *di;
compl_T *match;
int selected_idx = -1;
int has_items = what_flag & CI_WHAT_ITEMS;
int has_matches = what_flag & CI_WHAT_MATCHES;
if (what_flag & CI_WHAT_ITEMS)
if (has_items || has_matches)
{
li = list_alloc();
if (li == NULL)
return;
ret = dict_add_list(retdict, "items", li);
ret = dict_add_list(retdict, (has_matches && !has_items)
? "matches" : "items", li);
}
if (ret == OK && what_flag & CI_WHAT_SELECTED)
if (compl_curr_match != NULL && compl_curr_match->cp_number == -1)
@@ -3316,7 +3326,8 @@ get_complete_info(list_T *what_list, dict_T *retdict)
{
if (!match_at_original_text(match))
{
if (what_flag & CI_WHAT_ITEMS)
if (has_items
|| (has_matches && match->cp_in_match_array))
{
di = dict_alloc();
if (di == NULL)
@@ -3329,13 +3340,16 @@ get_complete_info(list_T *what_list, dict_T *retdict)
dict_add_string(di, "menu", match->cp_text[CPT_MENU]);
dict_add_string(di, "kind", match->cp_text[CPT_KIND]);
dict_add_string(di, "info", match->cp_text[CPT_INFO]);
if (has_matches && has_items)
dict_add_bool(di, "match", match->cp_in_match_array);
if (match->cp_user_data.v_type == VAR_UNKNOWN)
// Add an empty string for backwards compatibility
dict_add_string(di, "user_data", (char_u *)"");
else
dict_add_tv(di, "user_data", &match->cp_user_data);
}
if (compl_curr_match != NULL && compl_curr_match->cp_number == match->cp_number)
if (compl_curr_match != NULL
&& compl_curr_match->cp_number == match->cp_number)
selected_idx = list_idx;
list_idx += 1;
}

View File

@@ -22,6 +22,7 @@ int dict_add_string_len(dict_T *d, char *key, char_u *str, int len);
int dict_add_list(dict_T *d, char *key, list_T *list);
int dict_add_tv(dict_T *d, char *key, typval_T *tv);
int dict_add_callback(dict_T *d, char *key, callback_T *cb);
int dict_add_func(dict_T *d, char *key, ufunc_T *fp);
void dict_iterate_start(typval_T *var, dict_iterator_T *iter);
char_u *dict_iterate_next(dict_iterator_T *iter, typval_T **tv_result);
int dict_add_dict(dict_T *d, char *key, dict_T *dict);

View File

@@ -5,6 +5,8 @@ estack_T *estack_push_ufunc(ufunc_T *ufunc, long lnum);
int estack_top_is_ufunc(ufunc_T *ufunc, long lnum);
estack_T *estack_pop(void);
char_u *estack_sfile(estack_arg_T which);
list_T *stacktrace_create(void);
void f_getstacktrace(typval_T *argvars, typval_T *rettv);
void ex_runtime(exarg_T *eap);
void set_context_in_runtime_cmd(expand_T *xp, char_u *arg);
int find_script_by_name(char_u *name);

View File

@@ -237,6 +237,89 @@ estack_sfile(estack_arg_T which UNUSED)
#endif
}
#ifdef FEAT_EVAL
static void
stacktrace_push_item(
list_T *l,
ufunc_T *fp,
char_u *event,
linenr_T lnum,
char_u *filepath)
{
dict_T *d;
typval_T tv;
d = dict_alloc_lock(VAR_FIXED);
if (d == NULL)
return;
tv.v_type = VAR_DICT;
tv.v_lock = VAR_LOCKED;
tv.vval.v_dict = d;
if (fp != NULL)
dict_add_func(d, "funcref", fp);
if (event != NULL)
dict_add_string(d, "event", event);
dict_add_number(d, "lnum", lnum);
dict_add_string(d, "filepath", filepath);
list_append_tv(l, &tv);
}
/*
* Create the stacktrace from exestack.
*/
list_T *
stacktrace_create(void)
{
list_T *l;
int i;
l = list_alloc();
if (l == NULL)
return NULL;
for (i = 0; i < exestack.ga_len; ++i)
{
estack_T *entry = &((estack_T *)exestack.ga_data)[i];
linenr_T lnum = entry->es_lnum;
if (entry->es_type == ETYPE_SCRIPT)
stacktrace_push_item(l, NULL, NULL, lnum, entry->es_name);
else if (entry->es_type == ETYPE_UFUNC)
{
ufunc_T *fp = entry->es_info.ufunc;
sctx_T sctx = fp->uf_script_ctx;
char_u *filepath = sctx.sc_sid > 0 ?
get_scriptname(sctx.sc_sid) : (char_u *)"";
lnum += sctx.sc_lnum;
stacktrace_push_item(l, fp, NULL, lnum, filepath);
}
else if (entry->es_type == ETYPE_AUCMD)
{
sctx_T sctx = *acp_script_ctx(entry->es_info.aucmd);
char_u *filepath = sctx.sc_sid > 0 ?
get_scriptname(sctx.sc_sid) : (char_u *)"";
lnum += sctx.sc_lnum;
stacktrace_push_item(l, NULL, entry->es_name, lnum, filepath);
}
}
return l;
}
/*
* getstacktrace() function
*/
void
f_getstacktrace(typval_T *argvars UNUSED, typval_T *rettv)
{
rettv_list_set(rettv, stacktrace_create());
}
#endif
/*
* Get DIP_ flags from the [where] argument of a :runtime command.
* "*argp" is advanced to after the [where] argument if it is found.

View File

@@ -63,6 +63,17 @@ typedef struct growarray
#define GA_EMPTY {0, 0, 0, 0, NULL}
// On rare systems "char" is unsigned, sometimes we really want a signed 8-bit
// value.
typedef signed char int8_T;
typedef double float_T;
typedef struct typval_S typval_T;
typedef struct listvar_S list_T;
typedef struct dictvar_S dict_T;
typedef struct partial_S partial_T;
typedef struct blobvar_S blob_T;
typedef struct window_S win_T;
typedef struct wininfo_S wininfo_T;
typedef struct frame_S frame_T;
@@ -1087,6 +1098,7 @@ struct vim_exception
struct msglist *messages; // message(s) causing error exception
char_u *throw_name; // name of the throw point
linenr_T throw_lnum; // line number of the throw point
list_T *stacktrace; // stacktrace
except_T *caught; // next exception on the caught stack
};
@@ -1447,18 +1459,6 @@ typedef long_u hash_T; // Type for hi_hash
# endif
#endif
// On rare systems "char" is unsigned, sometimes we really want a signed 8-bit
// value.
typedef signed char int8_T;
typedef double float_T;
typedef struct typval_S typval_T;
typedef struct listvar_S list_T;
typedef struct dictvar_S dict_T;
typedef struct partial_S partial_T;
typedef struct blobvar_S blob_T;
// Struct that holds both a normal function name and a partial_T, as used for a
// callback argument.
// When used temporarily "cb_name" is not allocated. The refcounts to either

View File

@@ -292,6 +292,7 @@ NEW_TESTS = \
test_spell_utf8 \
test_spellfile \
test_spellrare \
test_stacktrace \
test_startup \
test_startup_utf8 \
test_stat \
@@ -545,6 +546,7 @@ NEW_TESTS_RES = \
test_spell_utf8.res \
test_spellfile.res \
test_spellrare.res \
test_stacktrace.res \
test_startup.res \
test_stat.res \
test_statusline.res \

View File

@@ -196,7 +196,7 @@ def s:GetFilenameChecks(): dict<list<string>>
crm: ['file.crm'],
crontab: ['crontab', 'crontab.file', '/etc/cron.d/file', 'any/etc/cron.d/file'],
crystal: ['file.cr'],
cs: ['file.cs', 'file.csx'],
cs: ['file.cs', 'file.csx', 'file.cake'],
csc: ['file.csc'],
csdl: ['file.csdl'],
csp: ['file.csp', 'file.fdr'],

View File

@@ -2931,4 +2931,48 @@ func Test_complete_backwards_default()
bw!
endfunc
func Test_complete_info_matches()
let g:what = ['matches']
func ShownInfo()
let g:compl_info = complete_info(g:what)
return ''
endfunc
set completeopt+=noinsert
new
call setline(1, ['aaa', 'aab', 'aba', 'abb'])
inoremap <buffer><F5> <C-R>=ShownInfo()<CR>
call feedkeys("Go\<C-X>\<C-N>\<F5>\<Esc>dd", 'tx')
call assert_equal([
\ {'word': 'aaa', 'menu': '', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''},
\ {'word': 'aab', 'menu': '', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''},
\ {'word': 'aba', 'menu': '', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''},
\ {'word': 'abb', 'menu': '', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''},
\], g:compl_info['matches'])
call feedkeys("Goa\<C-X>\<C-N>b\<F5>\<Esc>dd", 'tx')
call assert_equal([
\ {'word': 'aba', 'menu': '', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''},
\ {'word': 'abb', 'menu': '', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''},
\], g:compl_info['matches'])
" items and matches both in what
let g:what = ['items', 'matches']
call feedkeys("Goa\<C-X>\<C-N>b\<F5>\<Esc>dd", 'tx')
call assert_equal([
\ {'word': 'aaa', 'menu': '', 'user_data': '', 'match': v:false, 'info': '', 'kind': '', 'abbr': ''},
\ {'word': 'aab', 'menu': '', 'user_data': '', 'match': v:false, 'info': '', 'kind': '', 'abbr': ''},
\ {'word': 'aba', 'menu': '', 'user_data': '', 'match': v:true, 'info': '', 'kind': '', 'abbr': ''},
\ {'word': 'abb', 'menu': '', 'user_data': '', 'match': v:true, 'info': '', 'kind': '', 'abbr': ''},
\], g:compl_info['items'])
call assert_false(has_key(g:compl_info, 'matches'))
bw!
bw!
unlet g:what
delfunc ShownInfo
set cot&
endfunc
" vim: shiftwidth=2 sts=2 expandtab nofoldenable

View File

@@ -0,0 +1,107 @@
" Test for getstacktrace() and v:stacktrace
let s:thisfile = expand('%:p')
let s:testdir = s:thisfile->fnamemodify(':h')
func Filepath(name)
return s:testdir .. '/' .. a:name
endfunc
func AssertStacktrace(expect, actual)
call assert_equal(#{lnum: 617, filepath: Filepath('runtest.vim')}, a:actual[0])
call assert_equal(a:expect, a:actual[-len(a:expect):])
endfunc
func Test_getstacktrace()
let g:stacktrace = []
let lines1 =<< trim [SCRIPT]
" Xscript1
source Xscript2
func Xfunc1()
" Xfunc1
call Xfunc2()
endfunc
[SCRIPT]
let lines2 =<< trim [SCRIPT]
" Xscript2
func Xfunc2()
" Xfunc2
let g:stacktrace = getstacktrace()
endfunc
[SCRIPT]
call writefile(lines1, 'Xscript1', 'D')
call writefile(lines2, 'Xscript2', 'D')
source Xscript1
call Xfunc1()
call AssertStacktrace([
\ #{funcref: funcref('Test_getstacktrace'), lnum: 35, filepath: s:thisfile},
\ #{funcref: funcref('Xfunc1'), lnum: 5, filepath: Filepath('Xscript1')},
\ #{funcref: funcref('Xfunc2'), lnum: 4, filepath: Filepath('Xscript2')},
\ ], g:stacktrace)
unlet g:stacktrace
endfunc
func Test_getstacktrace_event()
let g:stacktrace = []
let lines1 =<< trim [SCRIPT]
" Xscript1
func Xfunc()
" Xfunc
let g:stacktrace = getstacktrace()
endfunc
augroup test_stacktrace
autocmd SourcePre * call Xfunc()
augroup END
[SCRIPT]
let lines2 =<< trim [SCRIPT]
" Xscript2
[SCRIPT]
call writefile(lines1, 'Xscript1', 'D')
call writefile(lines2, 'Xscript2', 'D')
source Xscript1
source Xscript2
call AssertStacktrace([
\ #{funcref: funcref('Test_getstacktrace_event'), lnum: 62, filepath: s:thisfile},
\ #{event: 'SourcePre Autocommands for "*"', lnum: 7, filepath: Filepath('Xscript1')},
\ #{funcref: funcref('Xfunc'), lnum: 4, filepath: Filepath('Xscript1')},
\ ], g:stacktrace)
augroup test_stacktrace
autocmd!
augroup END
unlet g:stacktrace
endfunc
func Test_vstacktrace()
let lines1 =<< trim [SCRIPT]
" Xscript1
source Xscript2
func Xfunc1()
" Xfunc1
call Xfunc2()
endfunc
[SCRIPT]
let lines2 =<< trim [SCRIPT]
" Xscript2
func Xfunc2()
" Xfunc2
throw 'Exception from Xfunc2'
endfunc
[SCRIPT]
call writefile(lines1, 'Xscript1', 'D')
call writefile(lines2, 'Xscript2', 'D')
source Xscript1
call assert_equal([], v:stacktrace)
try
call Xfunc1()
catch
let stacktrace = v:stacktrace
endtry
call assert_equal([], v:stacktrace)
call AssertStacktrace([
\ #{funcref: funcref('Test_vstacktrace'), lnum: 95, filepath: s:thisfile},
\ #{funcref: funcref('Xfunc1'), lnum: 5, filepath: Filepath('Xscript1')},
\ #{funcref: funcref('Xfunc2'), lnum: 4, filepath: Filepath('Xscript2')},
\ ], stacktrace)
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -704,6 +704,10 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
984,
/**/
983,
/**/
982,
/**/

View File

@@ -2190,7 +2190,8 @@ typedef int sock_T;
#define VV_TYPE_TYPEALIAS 107
#define VV_TYPE_ENUM 108
#define VV_TYPE_ENUMVALUE 109
#define VV_LEN 110 // number of v: vars
#define VV_STACKTRACE 110
#define VV_LEN 111 // number of v: vars
// used for v_number in VAR_BOOL and VAR_SPECIAL
#define VVAL_FALSE 0L // VAR_BOOL