summaryrefslogtreecommitdiffstatshomepage
path: root/src/nvim/eval.c
AgeCommit message (Collapse)AuthorFiles
2026-04-20vim-patch:8.2.4912: using execute() to define a lambda doesn't work (#39229)Jan Edmund Lazo1
Problem: Using execute() to define a lambda doesn't work. (Ernie Rael) Solution: Put the getline function in evalarg. (closes vim/vim#10375) https://github.com/vim/vim/commit/a7583c42cd6b64fd276a5d7bb0db5ce7bfafa730 Co-authored-by: Bram Moolenaar <Bram@vim.org>
2026-04-14build: update clang v21, fix warningsdundargoc1
- `src/nvim/ex_cmds_defs.h`: use "U" instead of "u" per `readability-uppercase-literal-suffix`
2026-03-27feat(prompt): prompt_appendbuf() appends to prompt buffer #37763Shadman1
Problem: Currently, we recommend always inserting text above prompt-line in prompt-buffer. This can be done using the `:` mark. However, although we recommend it this way it can sometimes get confusing how to do it best. Solution: Provide an api to append text to prompt buffer. This is a common use-case for things using prompt-buffer.
2026-03-24fix(messages): emit empty msg_show event for :echo #38467luukvbaal1
Problem: No empty msg_show event for :echo without arguments. Solution: Emit empty msg_show event when :echo is invoked without arguments.
2026-03-14vim-patch:9.2.0152: concatenating strings is slow (#38286)zeertzjq1
Problem: concatenating strings is slow Solution: Use grow_string_tv() to grow the existing string buffer in place when possible (Yasuhiro Matsumoto). closes: vim/vim#19642 https://github.com/vim/vim/commit/16d421a4d95b45ebbcf47ab60173cdb1b87ce419 Co-authored-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
2026-02-26vim-patch:9.2.0054: eval_addblob() is inefficient (#38067)zeertzjq1
Problem: eval_addblob() is inefficient Solution: Replace per-byte ga_append() loop with a single ga_grow() and mch_memmove() for each source blob. This eliminates N grow checks and function call overhead for blob concatenation (Yasuhiro Matsumoto). closes: vim/vim#19494 https://github.com/vim/vim/commit/c389ae8c4467e93827a9737abd907ebc27b998b3 Omit the pointless int -> long changes in other functions. Co-authored-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
2026-02-16vim-patch:9.1.1954: Setting a byte in a blob, accepts values outside 0-255zeertzjq1
Problem: Setting a byte in a blob, accepts values outside 0-255 Solution: When setting a byte in a blob, check for valid values (Yegappan Lakshmanan) closes: vim/vim#18870 https://github.com/vim/vim/commit/f4a299700e211a728f0f7398eb8fceaf44165711 Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2026-02-14feat(prompt): plugins can update prompt during user input #37743Shadman1
Problem: Currently, if prompt gets changed during user-input with prompt_setprompt() it only gets reflected in next prompt. And that behavior is not also consistent. If user re-enters insert mode then the user input gets discarded and a new prompt gets created with the new prompt. Solution: Handle prompt_setprompt eagerly. Update the prompt display, preserve user input.
2026-02-08fix(messages): unwanted newlines with ext_messages #37733luukvbaal1
Problem: Newlines intended to write messages below the cmdline or to mark the start of a new message on message grid are emitted through ext_messages. This results in unnecessary newlines for a UI that has decoupled its message area from the cmdline. msg_col is set directly in some places which is not transmitted to msg_show events. Various missing message kind for list commands. Trailing newlines on various list commands. Solution: Only emit such newlines without ext_messages enabled. Use msg_advance() instead of setting msg_col directly. Assign them the "list_cmd" kind. Ensure no trailing newline is printed.
2026-02-03fix(prompt): ensure prompt-mark col gets reseted properly #37669Shadman1
problem: currently when empty string is set as prompt the prompt-mark column doesn't update. solution: ensure the column is reset to 0 when starting prompt buffer and before creating a new prompt after prompt-callback.
2026-01-31vim-patch:9.1.2123: using NOT with a float returns a float in legacy script ↵zeertzjq1
(#37639) Problem: using NOT with a float returns a float in legacy vim script (kennypete) Solution: Return a number instead of a float (Yegappan Lakshmanan) fixes: vim/vim#19282 closes: vim/vim#19289 https://github.com/vim/vim/commit/ecc3faef61cb02f28028f27184ccd2aadcee7c24 N/A patches: vim-patch:8.2.1980: Vim9: some tests are not done at the script level vim-patch:9.1.2122: Vim9: Negating a float doesn't result in a bool Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2026-01-30fix(prompt): also store column info in ': mark #36194Shadman1
Problem: Currently, : mark is set in start of prompt-line. But more relevant location is where the user text starts. Solution: Store and update column info on ': just like the line info
2026-01-15vim-patch:9.1.2086: Memory leak when skipping invalid literal dictSean Dewar1
Problem: memory leak when not evaluating (just parsing) invalid literal dict. Solution: Always clear the key's typval (Sean Dewar) Though "check_typval_is_value(&tv) == FAIL && !evaluate" is maybe never true, also always clear tvs if check_typval_is_value fails; at worst this would be a no-op as their initial types are VAR_UNKNOWN. closes: vim/vim#19178 https://github.com/vim/vim/commit/b10a3e1a20c444ffea34be820e8ceba4b2503287 check_typval_is_value change is for Vim9 script. (from 9.0.2163) N/A patch: vim-patch:9.0.2163: Vim9: type can be assigned to list/dict Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
2026-01-01vim-patch:8.2.2198: ml_get error when resizing window and using text propertyJan Edmund Lazo1
Problem: ml_get error when resizing window and using text property. Solution: Validate botline of the right window. (closes vim/vim#7528) https://github.com/vim/vim/commit/23999d799cfe844b604f193183f8f84052c8e746 Migrate to Vim's (in)validate_botline_win() API. Nvim wants to pass "curwin" instead of hiding them behind alias/macro/inline-function. https://github.com/neovim/neovim/pull/37164#discussion_r2655006908 Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-12-22fix(marks): wrong line('w$', win) with conceal_lines (#37047)Jaehwang Jung1
Background: Suppose a window has concealed lines, and sets conceallevel>2, concealcursor="". The concealed lines are displayed if the window is curwin and the cursor is on the those lines. Problem: line('w$', win) switches curwin to win, and then does validate_botline for curwin. It computes botline assuming the concealed lines displayed, resulting in a smaller value than the actual botline that the user sees. Solution: Evaluate line('w$', win) without switching curwin. Apply similar changes to other functions that switches curwin. Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2025-10-26vim-patch:8.1.1939: code for handling v: variables in generic eval file (#36312)Jan Edmund Lazo1
Problem: Code for handling v: variables in generic eval file. Solution: Move v: variables to evalvars.c. (Yegappan Lakshmanan, closes vim/vim#4872) https://github.com/vim/vim/commit/e5cdf153bcb348c68011b308c8988cea42d6ddeb Cherry-pick get_vim_var_name() from 8.2.0149. Cherry-pick evalvars.c changes from 8.2.1788. Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-10-19vim-patch:9.0.0433: Coverity warns for not checking allocation failureJan Edmund Lazo1
Problem: Coverity warns for not checking allocation failure. Solution: Check that allocating a list or blob succeeded. https://github.com/vim/vim/commit/12553ada3b1ceee0179527abc9980b8392fd6c7e Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-10-15vim-patch:8.1.1979: code for handling file names is spread out (#36176)Jan Edmund Lazo1
Problem: Code for handling file names is spread out. Solution: Move code to new filepath.c file. Graduate FEAT_MODIFY_FNAME. https://github.com/vim/vim/commit/b005cd80cfda591be95146024d9b97eef383500f Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-10-13fix(api): nvim_parse_cmd handle nextcmd for commands without EX_TRLBAR (#36055)glepnir1
Problem: nvim_parse_cmd('exe "ls"|edit foo', {}) fails to separate nextcmd, returning args as { '"ls"|edit', 'foo' } instead of { '"ls"' } with nextcmd='edit foo'. Solution: Skip expressions before checking for '|' separator.
2025-10-06vim-patch:8.1.1978: the eval.c file is too bigJan Edmund Lazo1
Problem: The eval.c file is too big. Solution: Move filter() and map() to list.c. https://github.com/vim/vim/commit/1e1d30048e722906a13665bd6c3c24c87eb2fe25 Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-10-05vim-patch:8.2.0200: Vim9 script commands not sufficiently testedJan Edmund Lazo1
Problem: Vim9 script commands not sufficiently tested. Solution: Add more tests. Fix storing global variable. Make script variables work. https://github.com/vim/vim/commit/b283a8a6802ef8a46b17cb439f9514840c03698f Vim9 is N/A. Skip. "set_vim_var_tv()" does not throw E1063 on type mismatch. See https://github.com/neovim/neovim/pull/25394 . Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-10-05vim-patch:8.1.1957: more code can be moved to evalvars.cJan Edmund Lazo1
Problem: More code can be moved to evalvars.c. Solution: Move code to where it fits better. (Yegappan Lakshmanan, closes vim/vim#4883) https://github.com/vim/vim/commit/da6c03342117fb7f4a8110bd9e8627b612a05a64 Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-10-04vim-patch:partial:8.1.1939: code for handling v: variables in generic eval ↵Jan Edmund Lazo1
file (#35968) Problem: Code for handling v: variables in generic eval file. Solution: Move v: variables to evalvars.c. (Yegappan Lakshmanan, closes vim/vim#4872) https://github.com/vim/vim/commit/e5cdf153bcb348c68011b308c8988cea42d6ddeb Remove direct reference to "vimvars" for following functions: - assert_error() - get_vim_var_nr() - get_vim_var_list() - get_vim_var_dict() - get_vim_var_str() - set_cmdarg() - set_reg_var() - set_vcount() - set_vexception() - set_vthrowpoint() - set_vim_var_bool() - set_vim_var_dict() - set_vim_var_list() - set_vim_var_nr() - set_vim_var_special() - set_vim_var_string() - set_vim_var_type() Reorder functions based on v8.2.4930 for eval_one_expr_in_str() and eval_all_expr_in_str(). Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-09-26vim-patch:8.1.2077: the ops.c file is too bigJan Edmund Lazo1
Problem: The ops.c file is too big. Solution: Move code for dealing with registers to a new file. (Yegappan Lakshmanan, closes vim/vim#4982) https://github.com/vim/vim/commit/4aea03eb875613e3eae2125b84f02b7cd898b2f8 Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-09-23vim-patch:8.1.2021: some global functions can be local to the fileJan Edmund Lazo1
Problem: Some global functions can be local to the file. Solution: Add "static". (Yegappan Lakshmanan, closes vim/vim#4917) https://github.com/vim/vim/commit/840d16fd36bfd1a9fac8200e3dc016b1e3f9c328 Partial port because patch 8.2.0256 moves the timer functions to time.c. Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-09-23vim-patch:9.1.1781: some functions could be defined staticzeertzjq1
Problem: some functions could be defined static Solution: Change function definitions and make them static (Yegappan Lakshmanan) closes: vim/vim#18354 https://github.com/vim/vim/commit/3a6cf6d53b0ecf84ae4a0f8073996b34117251db Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2025-09-13vim-patch:8.1.1964: crash when using nested map() and filter() (#35715)Jan Edmund Lazo1
Problem: Crash when using nested map() and filter(). Solution: Do not set the v:key type to string without clearing the pointer. https://github.com/vim/vim/commit/c36350bca3eed8ef97061e28c38b5b89cae1f13e Port filter_map() changes from patch 8.1.1939. Note: v8.1.1964 reverts a redundant change for `filter_map()` (now within `filter_map_dict()`) from v8.1.1957. Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-09-09vim-patch:8.1.1940: script tests failJan Edmund Lazo1
Problem: Script tests fail. Solution: Don't set vimvars type in set_vim_var_nr(). https://github.com/vim/vim/commit/34ed68d40eb9c71f34a44b94263f5e7e6856cba0 Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-23vim-patch:9.1.1667: Another outdated comment in eval.c (#35438)zeertzjq1
Problem: Another outdated comment in eval.c (after 9.1.1665). Solution: Remove that comment as well. Add a few more tests for mapnew() that fail without patch 8.2.1672 (zeertzjq). closes: vim/vim#18089 https://github.com/vim/vim/commit/6b5671180440f07f9f6955f46bab380bdc23f950
2025-08-23vim-patch:9.1.1665: Outdated comment in eval.c (#35436)zeertzjq1
Problem: Outdated comment in eval.c. Solution: Remove the comment, which is no longer true after 8.2.1672. Also fix a typo in version9.txt (zeertzjq). closes: vim/vim#18077 https://github.com/vim/vim/commit/5d3c39af2a54996dc365b5b38e3eaa6c971ae33a
2025-08-22vim-patch:8.2.1672: v_lock is used when it is not initialized (#35416)zeertzjq1
Problem: v_lock is used when it is not initialized. (Yegappan Lakshmanan) Solution: Initialize the typval in eval1(). https://github.com/vim/vim/commit/4a091b9978122428e7d9154d034c640c9c8d8c13 Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-08-14refactor(build): remove INCLUDE_GENERATED_DECLARATIONS guardsbfredl1
These are not needed after #35129 but making uncrustify still play nice with them was a bit tricky. Unfortunately `uncrustify --update-config-with-doc` breaks strings with backslashes. This issue has been reported upstream, and in the meanwhile auto-update on every single run has been disabled.
2025-08-09vim-patch:9.1.1603: completion: cannot use autoloaded funcs in 'complete' ↵zeertzjq1
F{func} Problem: completion: cannot use autoloaded funcs in 'complete' F{func} (Maxim Kim) Solution: Make it work (Girish Palya) fixes: vim/vim#17869 closes: vim/vim#17885 https://github.com/vim/vim/commit/1bfe86a7d37ea849078255f16f99ed69fbf205dc Cherry-pick Test_omni_autoload() from patch 8.2.3223. Co-authored-by: Girish Palya <girishji@gmail.com>
2025-07-20vim-patch:8.1.1526: no numerical value for the patchlevelJan Edmund Lazo1
Problem: No numerical value for the patchlevel. Solution: Add v:versionlong. https://github.com/vim/vim/commit/37df9a4401f6737d6216306ea77a7e080c942aea Restore "highest_patch()" solely for "v:versionlong". Copy/paste Test_vvar_scriptversion2() from patch 9.1.1540. It works without ":scriptversion 2". In general, if Vim's test works with ":scriptversion 1", just port it for additional coverage. --- vim-patch:8.1.1565: MS-Windows: no sound support Problem: MS-Windows: no sound support. Solution: Add sound support for MS-Windows. (Yasuhiro Matsumoto, Ken Takata, closes vim/vim#4522) https://github.com/vim/vim/commit/9b283523f2f75b45feef902b8713808e883d9c19 ---- "sound" feature is N/A now but this updates "v:versionlong" docs. Co-authored-by: Bram Moolenaar <Bram@vim.org>
2025-06-30fix(prompt): prompt mark not placed after text edits correctly #34671Shadman1
2025-06-26feat(ui): emit "msg_clear" event after clearing the screen (#34035)luukvbaal1
Problem: ext_messages cannot tell when the screen was cleared, which is needed to clear visible messages. An empty message is also never emitted, but clears messages from the message grid. Solution: Repurpose the "msg_clear" event to be emitted when the screen was cleared. Emit an empty message with the `empty` kind to hint to a UI to clear the cmdline area.
2025-06-24feat(prompt): prompt_getinput() gets current input #34491Shadman1
Problem: Not easy to get user-input in prompt-buffer before the user submits the input. Under the current system user/plugin needs to read the buffer contents, figure out where the prompt is, then extract the text. Solution: - Add prompt_getinput(). - Extract prompt text extraction logic to a separate function
2025-06-17feat(prompt): multiline prompt input #33371Shadman1
Problem: Cannot enter multiline prompts in a buftype=prompt buffer. Solution: - Support shift+enter (`<s-enter>`) to start a new line in the prompt. - Pasting multiline text via OS paste, clipboard, "xp, etc. - A/I in editable region works as usual. - i/a/A/I outside of editable region moves cursor to end of current prompt. - Support undo/redo in prompt buffer. - Support o/O in prompt buffer. - Expose prompt location as `':` mark.
2025-06-09fix(messages): single event for multi-expr :echo (#34393)luukvbaal1
Problem: Separate "msg_show" event for each expression in a multi-expr :echo(n) command. Solution: Only set the kind when `atstart == true`.
2025-05-24feat(ui): "append" parameter for "msg_show" UI eventsLuuk van Baal1
Problem: Consecutive "msg_show" events stemming from an `:echon` command are supposed to be appended without a newline, this information is not encoded in the "msg_show" event. Solution: Add an "append" parameter to the "msg_show" event that is set to true to indicate the message should not start on a new line. Considered alternative: Emit a newline for the common case instead at the start of a new message. That way UIs can more closely follow the logic as it is implemented for the message grid currently. This would be a breaking change. The "append" parameter seems OK.
2025-04-15vim-patch:9.1.1300: wrong detection of -inf (#33474)zeertzjq1
Problem: wrong detection of -inf Solution: correctly compare 4 characters and not 3 (John Marriott) closes: vim/vim#17109 https://github.com/vim/vim/commit/10f69298b4577b3712eedeb49b4d9ad1a69111f8 Co-authored-by: John Marriott <basilisk@internode.on.net>
2025-03-27fix(health): message should mention "vim.provider" #33095Eisuke Kawashima1
2025-02-28vim-patch:8.2.4594: need to write script to a file to be able to source themzeertzjq1
Problem: Need to write script to a file to be able to source them. Solution: Make ":source" use lines from the current buffer. (Yegappan Lakshmanan et al., closes vim/vim#9967) https://github.com/vim/vim/commit/36a5b6867bb6c0bd69c8da7d788000ab8a0b0ab0 Most code and test changes are reverted or modified again in patch 8.2.4603, so only port parts that are untouched in patch 8.2.4603. Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2025-02-26refactor: remove unnecessary allocation for "run Nvim with -V1" (#32633)zeertzjq1
2025-02-25fix(lua): don't override script ID from :source (#32626)zeertzjq1
Problem: When setting an option, mapping etc. from Lua without -V1, the script ID is set to SID_LUA even if there already is a script ID assigned by :source. Solution: Don't set script ID to SID_LUA if it is already a Lua script. Also add _editor.lua to ignorelist to make script context more useful when using vim.cmd().
2025-02-25fix(api): don't override Vimscript SID (#32610)zeertzjq1
Problem: When calling an API from Vimscript to set an option, mapping, etc., :verbose shows that it's set from an API client. Solution: Don't override current_sctx.sc_sid when calling an API from Vimscript. Also fix the inverse case where API channel id is not set when calling an API from RPC. Move channel id into sctx_T to make saving and restoring easier. Related #8329
2025-01-09feat(api): add err field to nvim_echo() optsLuuk van Baal1
Problem: We want to deprecate `nvim_err_write(ln)()` but there is no obvious replacement (from Lua). Meanwhile we already have `nvim_echo()` with an `opts` argument. Solution: Add `err` argument to `nvim_echo()` that directly maps to `:echoerr`.
2025-01-07vim-patch:9.1.0984: exception handling can be improvedzeertzjq1
Problem: exception handling can be improved Solution: add v:stacktrace and getstacktrace() closes: vim/vim#16360 https://github.com/vim/vim/commit/663d18d6102f40d14e36096ec590445e61026ed6 Co-authored-by: ichizok <gclient.gaap@gmail.com> Co-authored-by: Naruhiko Nishino <naru123456789@gmail.com>
2024-12-19feat(jobs): jobstart(…,{term=true}), deprecate termopen() #31343Justin M. Keyes1
Problem: `termopen` has long been a superficial wrapper around `jobstart`, and has no real purpose. Also, `vim.system` and `nvim_open_term` presumably will replace all features of `jobstart` and `termopen`, so centralizing the logic will help with that. Solution: - Introduce `eval/deprecated.c`, where all deprecated eval funcs will live. - Introduce "term" flag of `jobstart`. - Deprecate `termopen`.
2024-11-25refactor(options): fix confusing naming of `scope` and `req_scope` (#31317)Famiu Haque1
Problem: The name `scope` is often used to refer to option flags because `OPT_LOCAL` and `OPT_GLOBAL` are often used to determine the option scope. This leads to the name `req_scope` being used for actual option scopes instead. Solution: Since the end-goal is to remove `OPT_LOCAL` and `OPT_GLOBAL` entirely and replace them with `OptScope`, rename `OptScope` variables to `scope` and the old scope flag variables to `opt_flags`.