diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2024-11-25 19:15:05 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2024-11-25 19:27:38 +0000 |
commit | c5d770d311841ea5230426cc4c868e8db27300a8 (patch) | |
tree | dd21f70127b4b8b5f109baefc8ecc5016f507c91 /src/nvim/eval.lua | |
parent | 9be89f131f87608f224f0ee06d199fcd09d32176 (diff) | |
parent | 081beb3659bd6d8efc3e977a160b1e72becbd8a2 (diff) | |
download | rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.gz rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.bz2 rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.zip |
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'src/nvim/eval.lua')
-rw-r--r-- | src/nvim/eval.lua | 124 |
1 files changed, 73 insertions, 51 deletions
diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua index 50aaf9e03b..a418b34909 100644 --- a/src/nvim/eval.lua +++ b/src/nvim/eval.lua @@ -326,17 +326,17 @@ M.funcs = { args = { 2, 3 }, base = 1, desc = [=[ - When the files {fname-one} and {fname-two} do not contain + When the files {fname_one} and {fname_two} do not contain exactly the same text an error message is added to |v:errors|. Also see |assert-return|. - When {fname-one} or {fname-two} does not exist the error will + When {fname_one} or {fname_two} does not exist the error will mention that. ]=], name = 'assert_equalfile', - params = { { 'fname-one', 'string' }, { 'fname-two', 'string' } }, + params = { { 'fname_one', 'string' }, { 'fname_two', 'string' } }, returns = '0|1', - signature = 'assert_equalfile({fname-one}, {fname-two})', + signature = 'assert_equalfile({fname_one}, {fname_two})', }, assert_exception = { args = { 1, 2 }, @@ -1111,7 +1111,7 @@ M.funcs = { The character class is one of: 0 blank 1 punctuation - 2 word character + 2 word character (depends on 'iskeyword') 3 emoji other specific Unicode class The class is used in patterns and word motions. @@ -1137,7 +1137,7 @@ M.funcs = { ]=], name = 'charcol', - params = { { 'expr', 'string|integer[]' }, { 'winid', 'integer' } }, + params = { { 'expr', 'string|any[]' }, { 'winid', 'integer' } }, returns = 'integer', signature = 'charcol({expr} [, {winid}])', }, @@ -1296,7 +1296,7 @@ M.funcs = { ]=], name = 'col', - params = { { 'expr', 'string|integer[]' }, { 'winid', 'integer' } }, + params = { { 'expr', 'string|any[]' }, { 'winid', 'integer' } }, returns = 'integer', signature = 'col({expr} [, {winid}])', }, @@ -2165,6 +2165,7 @@ M.funcs = { If {expr} starts with "./" the |current-directory| is used. ]=], + fast = true, name = 'exepath', params = { { 'expr', 'string' } }, signature = 'exepath({expr})', @@ -3611,6 +3612,20 @@ M.funcs = { returns = 'string', signature = 'getcharstr([{expr}])', }, + getcmdcomplpat = { + desc = [=[ + Return completion pattern of the current command-line. + Only works when the command line is being edited, thus + requires use of |c_CTRL-\_e| or |c_CTRL-R_=|. + Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()|, + |getcmdprompt()|, |getcmdcompltype()| and |setcmdline()|. + Returns an empty string when completion is not defined. + ]=], + name = 'getcmdcomplpat', + params = {}, + returns = 'string', + signature = 'getcmdcomplpat()', + }, getcmdcompltype = { desc = [=[ Return the type of the current command-line completion. @@ -3618,7 +3633,7 @@ M.funcs = { requires use of |c_CTRL-\_e| or |c_CTRL-R_=|. See |:command-completion| for the return string. Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()|, - |getcmdprompt()| and |setcmdline()|. + |getcmdprompt()|, |getcmdcomplpat()| and |setcmdline()|. Returns an empty string when completion is not defined. ]=], name = 'getcmdcompltype', @@ -3761,6 +3776,7 @@ M.funcs = { runtime |:runtime| completion scriptnames sourced script names |:scriptnames| shellcmd Shell command + shellcmdline Shell command line with filename arguments sign |:sign| suboptions syntax syntax file names |'syntax'| syntime |:syntime| suboptions @@ -6391,7 +6407,7 @@ M.funcs = { base = 1, desc = [=[ {expr1} must be a |List|, |String|, |Blob| or |Dictionary|. - When {expr1} is a |List|| or |Dictionary|, replace each + When {expr1} is a |List| or |Dictionary|, replace each item in {expr1} with the result of evaluating {expr2}. For a |Blob| each byte is replaced. For a |String|, each character, including composing @@ -9525,7 +9541,7 @@ M.funcs = { To clear the overrides pass an empty {list}: >vim call setcellwidths([]) - <You can use the script $VIMRUNTIME/tools/emoji_list.lua to see + <You can use the script $VIMRUNTIME/scripts/emoji_list.lua to see the effect for known emoji characters. Move the cursor through the text to check if the cell widths of your terminal match with what Vim knows about each emoji. If it doesn't @@ -9881,6 +9897,8 @@ M.funcs = { clear the list: >vim call setqflist([], 'r') < + 'u' Like 'r', but tries to preserve the current selection + in the quickfix list. 'f' All the quickfix lists in the quickfix stack are freed. @@ -9938,7 +9956,11 @@ M.funcs = { ]=], name = 'setqflist', - params = { { 'list', 'any[]' }, { 'action', 'string' }, { 'what', 'table' } }, + params = { + { 'list', 'vim.quickfix.entry[]' }, + { 'action', 'string' }, + { 'what', 'vim.fn.setqflist.what' }, + }, signature = 'setqflist({list} [, {action} [, {what}]])', }, setreg = { @@ -10994,6 +11016,44 @@ M.funcs = { params = { { 'expr', 'number' } }, signature = 'srand([{expr}])', }, + state = { + args = { 0, 1 }, + base = 1, + desc = [=[ + Return a string which contains characters indicating the + current state. Mostly useful in callbacks that want to do + work that may not always be safe. Roughly this works like: + - callback uses state() to check if work is safe to do. + Yes: then do it right away. + No: add to work queue and add a |SafeState| autocommand. + - When SafeState is triggered and executes your autocommand, + check with `state()` if the work can be done now, and if yes + remove it from the queue and execute. + Remove the autocommand if the queue is now empty. + Also see |mode()|. + + When {what} is given only characters in this string will be + added. E.g, this checks if the screen has scrolled: >vim + if state('s') == '' + " screen has not scrolled + < + These characters indicate the state, generally indicating that + something is busy: + m halfway a mapping, :normal command, feedkeys() or + stuffed command + o operator pending, e.g. after |d| + a Insert mode autocomplete active + x executing an autocommand + S not triggering SafeState, e.g. after |f| or a count + c callback invoked, including timer (repeats for + recursiveness up to "ccc") + s screen has scrolled for messages + ]=], + fast = true, + name = 'state', + params = { { 'what', 'string' } }, + signature = 'state([{what}])', + }, stdioopen = { args = 1, desc = [=[ @@ -11052,44 +11112,6 @@ M.funcs = { returns = 'string|string[]', signature = 'stdpath({what})', }, - state = { - args = { 0, 1 }, - base = 1, - desc = [=[ - Return a string which contains characters indicating the - current state. Mostly useful in callbacks that want to do - work that may not always be safe. Roughly this works like: - - callback uses state() to check if work is safe to do. - Yes: then do it right away. - No: add to work queue and add a |SafeState| autocommand. - - When SafeState is triggered and executes your autocommand, - check with `state()` if the work can be done now, and if yes - remove it from the queue and execute. - Remove the autocommand if the queue is now empty. - Also see |mode()|. - - When {what} is given only characters in this string will be - added. E.g, this checks if the screen has scrolled: >vim - if state('s') == '' - " screen has not scrolled - < - These characters indicate the state, generally indicating that - something is busy: - m halfway a mapping, :normal command, feedkeys() or - stuffed command - o operator pending, e.g. after |d| - a Insert mode autocomplete active - x executing an autocommand - S not triggering SafeState, e.g. after |f| or a count - c callback invoked, including timer (repeats for - recursiveness up to "ccc") - s screen has scrolled for messages - ]=], - fast = true, - name = 'state', - params = { { 'what', 'string' } }, - signature = 'state([{what}])', - }, str2float = { args = 1, base = 1, @@ -12662,7 +12684,7 @@ M.funcs = { ]=], name = 'virtcol', - params = { { 'expr', 'string|integer[]' }, { 'list', 'boolean' }, { 'winid', 'integer' } }, + params = { { 'expr', 'string|any[]' }, { 'list', 'boolean' }, { 'winid', 'integer' } }, signature = 'virtcol({expr} [, {list} [, {winid}]])', }, virtcol2col = { @@ -12751,7 +12773,7 @@ M.funcs = { For example to make <c-j> work like <down> in wildmode, use: >vim cnoremap <expr> <C-j> wildmenumode() ? "\<Down>\<Tab>" : "\<c-j>" < - (Note, this needs the 'wildcharm' option set appropriately). + (Note: this needs the 'wildcharm' option set appropriately). ]=], name = 'wildmenumode', params = {}, |