summaryrefslogtreecommitdiffstatshomepage
path: root/test/functional/vimscript
AgeCommit message (Collapse)AuthorFiles
2026-04-24fix(path): normalize path slashes on Windows #37729tao4
Problem: On Windows, path separators may become inconsistent for various reasons, which makes normalization quite painful. Solution: Normalize paths to `/` at the entry boundaries and always use it internally, converting back only in rare cases where `\` is really needed (e.g. cmd.exe/bat scripts?). This is the first commit in a series of incremental steps. Note: * some funcs won't respect shellslash. e.g. `expand/fnamemodify` * some funcs still respect shellslash, but will be updated in a follow PR. e.g. `ex_pwd/f_chdir/f_getcwd` * uv's built-in funcs always return `\`. e.g. `uv.cwd/uv.exepath` Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2026-04-22feat(eval): treat Lua string as "blob" in writefile() #39098Barrett Ruth1
Problem: vim.fn.writefile() treats Lua strings as Vimscript strings instead of a "binary clean" string. Solution: Treat Lua-originated strings as blob data.
2026-04-20refactor(test): drop deprecated exc_exec #39242Justin M. Keyes24
2026-04-18refactor(vimfn): full-Lua impl of vim.fn.environ()Justin M. Keyes1
2026-04-17perf(vim.fn): call Lua-implemented vim.fn.xx() directly #39166Justin M. Keyes1
Problem: - Builtin "Vimscript" functions (f_xx) are mostly implemented in C. Partly that's because there is some boilerplate required to call out to Lua. - Calls to `vim.fn.foo()` always marshall over the Lua <=> Vimscript ("typval") bridge, even if `fn.foo()` is implemented entirely in Lua: ``` Lua => typval => Object => Lua => Object => typval => Lua. ``` Solution: Functions declared in eval.lua with `func_lua` are implemented in entirely in Lua (`_core/vimfn.lua`). - `gen_eval.lua` wires `func_lua` entries to `lua_wrapper`, which handles the typval conversion for Vimscript callers (slow path). - `nlua_call()` detects `func_lua` functions and calls the Lua implementation directly. This eliminates all conversion overhead for Lua callers (fast path). - Validate at build-time that `func`, `func_float`, and `func_lua` are mutually exclusive. - Migrate `hostname()` as a toy example, to show the idea.
2026-04-05fix(windows): force console codepage to UTF-8 for shell/system() #38742Elijah Koulaxis1
Problem: On Windows, `:!echo тест` shows `????` because the console code page defaults to a legacy ANSI encoding (e.g. CP1252) instead of `UTF-8` Solution: Call `SetConsoleOutputCP(CP_UTF8)` and `SetConsoleCP(CP_UTF8)` in `do_os_system()` before spawning child processes, and restore the original values after. It covers both `:!` and `system()` since they both go through `do_os_system()`
2026-03-18fix(fs): expand drive-relative paths on Windows #37084tao1
Problem: On windows, if a drive-relative path doesn't contain a slash, `path_to_absolute` can't split out the relative component, causing expansion to fails. e.g., `c:` `c:.` `c:..` `c:foo.md` Solution: For these cases, we can pass letter and colon to `path_full_dir_name`. Notably, `..` is included as well. if that relative path exists, it can be expanded correctly.
2026-02-25refactor(test): simplify v:argf tests #38055Justin M. Keyes2
2026-02-20test: start test runners in Xtest_xdg dir (#37964)zeertzjq3
This is a better way to prevent parallel tests from interfering with each other, as there are many ways files can be created and deleted in tests, so enforcing different file names is hard. Using $TMPDIR can also work in most cases, but 'backipskip' etc. have special defaults for $TMPDIR. Symlink runtime/, src/, test/ and README.md to Xtest_xdg dir to make tests more convenient (and symlinking test/ is required for busted). Also, use README.md instead of test/README.md in the Ex mode inccommand test, as test/README.md no longer contains 'N' char.
2026-02-18test: support running functionaltests in parallel by directory (#37918)zeertzjq1
Define a CMake target for every subdirectory of test/functional that contains functional tests, and a functionaltest_parallel target that depends on all those targets, allowing multiple test runners to run in parallel. On CI, use at most 2 parallel test runners, as using more may increase system load and make tests unstable.
2026-02-14fix(terminal): resuming doesn't work with command in fish (#37857)zeertzjq1
Problem: Resuming terminal process doesn't work with command in fish. Solution: Send SIGCONT to the entire process group. Use killpg() like what bash and zsh do on `fg`: https://cgit.git.savannah.gnu.org/cgit/bash.git/tree/jobs.c?id=637f5c8696a6adc9b4519f1cd74aa78492266b7f#n3928 https://sourceforge.net/p/zsh/code/ci/77045ef899e53b9598bebc5a41db93a548a40ca6/tree/Src/jobs.c#l2674 https://sourceforge.net/p/zsh/code/ci/77045ef899e53b9598bebc5a41db93a548a40ca6/tree/Src/signals.c#l538 Install fish on CI to test this.
2026-02-13fix: wait() checks condition twice on each interval (#37837)zeertzjq1
Problem: wait() checks condition twice on each interval. Solution: Don't schedule the due callback. Also fix memory leak when Nvim exits while waiting. No test that the condition isn't checked twice, as testing for that can be flaky when there are libuv events from other sources.
2026-02-12test(testterm): remove useless TermCursor highlight definition (#37827)zeertzjq1
TermCursor already has cterm=reverse. Additionally, now that terminal buffers have a real cursor, the cterm=reverse in TermCursor no longer shows up in the screen state.
2026-02-09test: add failing case for screenrow/screencol #37761Nanashi.1
2026-02-05refactor: rename _extui => _core.ui2 #37692luukvbaal1
Problem: _extui module name is confusing and should eventually end up in _core/. Solution: Move it there and name it ui2.
2026-02-03test: unskip msgpackparse() test on Windows (#37683)zeertzjq1
Not sure when it was fixed, but it passes now.
2026-01-21test: fix has() test failure (#37480)Kevin Goodsell1
Problem: has("terminfo") test fails on local runs because it expects "HAVE_UNIBILIUM " in the :version info to mean that nvim was built without unibilium. Solution: Assume nvim is built with unibilium if HAVE_UNIBILIUM is present in the version string and is NOT followed by 0, false, or off. This isn't affecting CI runs because when the test detects that it is running in CI it doesn't use the :version string at all. Resolves https://github.com/neovim/neovim/issues/37456
2026-01-13fix(shell): ceci n'est pas une pipebfredl1
On linux /dev/stdin is defined as a symlink to /proc/self/fd/0 This in turn is defined as a "magic" symlink which is allowed to point to internal kernel objects which really does not have a file name. As a glaring inconsistency, fopen("/proc/self/fd/0", "r") works if fd was originally opened using pipe() but not using socketpair(). As it happens UV_CREATE_PIPE does not create pipes but creates socket pairs. These two unfortunate conditions means that using /dev/stdin and similar does not work in shell commands in nvim on linux. as a work around, override libuv's descicion and create an actual pipe pair. This change is not needed on BSD:s but done unconditionally for simplicity, except for on windows where it is not done for stdout because of windows fixes #35984
2026-01-07fix(mappings): always include replace_keycodes in mapping dicts (#37272)zeertzjq1
Omitting replace_keycodes when it is false causes some confusion as its default value is unclear. In nvim_set_keymap() it defaults to false, but in vim.keymap.set() it defaults to true when it matters.
2025-12-06vim-patch:partial:9.1.1955: sort() does not handle large numbers correctly ↵zeertzjq1
(#36840) Problem: sort() does not handle large numbers correctly (Igbanam Ogbuluijah) Solution: Don't truncate the return value of tv_get_number_chk() (Yegappan Lakshmanan) closes: vim/vim#18868 https://github.com/vim/vim/commit/04794efe12863eb96a489531c299879e6c8d15d4 Use a Lua test for now, as the Vimscript test uses tuples. Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2025-12-04vim-patch:9.1.1948: Windows: Vim adds current directory to search pathzeertzjq1
Problem: Windows: Vim always adds the current directory to search path. This should only happen when using cmd.exe as 'shell'. For example, powershell won't run binaries from the current directory. Solution: Only add current directory to system path, when using cmd.exe as 'shell'. related: vim/vim#10341 related: 083ec6d9a3b7 https://github.com/vim/vim/commit/4d87c9742a544a58c05cb34d4fbaac47e410b369 Co-authored-by: Christian Brabandt <cb@256bit.org>
2025-12-01feat(version): support multiple Vim versionsJan Edmund Lazo1
Group up to 15 vimpatch numbers in 1 line to guard against 'make formatc'. 1-liner for vim_versions, num_patches. Automate '*Version' to remove version.h macros. '-V1 -v' lists merged Vim versions.
2025-11-22feat: has('terminfo')Justin M. Keyes1
Problem: No way to detect at runtime if the build includes unibilium (or whatever terminfo layer we swap it with later). Solution: Support `has('terminfo')`.
2025-09-24test: remove a few more redundant clear() calls (#35903)zeertzjq1
2025-09-22test: reduce some clear() callszeertzjq9
Use only a single clear() call in some test/functional/vimscript/ test files whose test cases have very little side effect. A downside of using a single clear() is that if a crash happens in one test case, all following test cases in the same file will also fail, but these functionalities and tests don't change very often.
2025-09-02fix: screenchar()/screenstring() with hidden floating windows #35560Evgeni Chasnovski1
2025-07-10docs: api, pack, events, developJustin M. Keyes2
2025-07-11vim-patch:6ac2e4a: runtime(vim): Update base syntax, improve function call ↵zeertzjq1
highlighting (#34874) - Match more function calls. - Contain function call syntax groups. - Improve differentiation between Ex commands and builtin functions with the same name. Remove special cases. Command modifiers are not currently well differentiated from functions. closes: vim/vim#17712 https://github.com/vim/vim/commit/6ac2e4aa0a565dc8cac73b33c9c099cea77212a8 Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2025-05-25fix(system): don't treat NUL at start as no input (#34167)zeertzjq1
2025-05-04feat(messages): cleanup Lua error messagesJustin M. Keyes2
"Error" in error messages is redundant. Just provide the context, don't say "Error ...".
2025-05-02feat(build): build.zig MVP: build and run functionaltests on linuxbfredl1
NEW BUILD SYSTEM! This is a MVP implementation which supports building the "nvim" binary, including cross-compilation for some targets. As an example, you can build a aarch64-macos binary from an x86-64-linux-gnu host, or vice versa Add CI target for build.zig currently for functionaltests on linux x86_64 only Follow up items: - praxis for version and dependency bumping - windows 💀 - full integration of libintl and gettext (or a desicion not to) - update help and API metadata files - installation into a $PREFIX - more tests and linters
2025-04-26fix: screenchar()/screenstring() with multigrid #32494fredizzimo1
Problem: - When multigrid is enabled, screenchar()/screenstring() functions return wrong results. See https://github.com/neovide/neovide/issues/2569 - `screenstring()` executed via RPC in child Nvim process, doesn't recognize floating windows. Solution: In ui_comp_get_grid_at_coord(), also iterate window grids.
2025-04-12feat(defaults): shelltemp=false #33012Alexej Kowalew1
Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-02-11refactor(tests): drop os_kill #32401Justin M. Keyes1
Also change job tests to use `nvim` instead of random programs like `ping`.
2025-02-05fix(messages): add a trailing space to inputlist() etc. prompts (#32328)zeertzjq1
Before #31525 the prompts had a trailing space. Also add a test for #7857.
2025-02-04test(getchar_spec): fix flakiness (#32320)zeertzjq1
Problem: getchar_spec may fail when screen:expect_unchanged() doesn't wait long enough. Solution: Add poke_eventloop() before screen:expect_unchanged().
2025-02-03vim-patch:9.1.1070: Cannot control cursor positioning of getchar() (#32303)zeertzjq1
Problem: Cannot control cursor positioning of getchar(). Solution: Add "cursor" flag to {opts}, with possible values "hide", "keep" and "msg". related: vim/vim#10603 closes: vim/vim#16569 https://github.com/vim/vim/commit/edf0f7db28f87611368e158210e58ed30f673098
2025-01-16vim-patch:9.1.1013: Vim9: Regression caused by patch v9.1.0646zeertzjq1
Problem: Vim9: Regression caused by patch v9.1.0646 Solution: Translate the function name before invoking it in call() (Yegappan Lakshmanan) fixes: vim/vim#16430 closes: vim/vim#16445 https://github.com/vim/vim/commit/6289f9159102e0855bedc566636b5e7ca6ced72c N/A patch: vim-patch:8.2.4176: Vim9: cannot use imported function with call() Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2025-01-02feat(ui)!: emit prompt "messages" as cmdline events #31525luukvbaal1
Problem: Prompts are emitted as messages events, where cmdline events are more appropriate. The user input is also emitted as message events in fast context, so cannot be displayed with vim.ui_attach(). Solution: Prompt for user input through cmdline prompts.
2024-11-14fix(messages)!: vim.ui_attach message callbacks are unsafeLuuk van Baal1
Problem: Lua callbacks for "msg_show" events with vim.ui_attach() are executed when it is not safe. Solution: Disallow non-fast API calls for "msg_show" event callbacks. Automatically detach callback after excessive errors. Make sure fast APIs do not modify Nvim state.
2024-11-14fix(tests): needing two calls to setup a screen is cringebfredl8
Before calling "attach" a screen object is just a dummy container for (row, col) values whose purpose is to be sent as part of the "attach" function call anyway. Just create the screen in an attached state directly. Keep the complete (row, col, options) config together. It is still completely valid to later detach and re-attach as needed, including to another session.
2024-11-08refactor(tests): continue the global highlight definition workbfredl3
2024-09-23refactor(api)!: rename Dictionary => DictJustin M. Keyes7
In the api_info() output: :new|put =map(filter(api_info().functions, '!has_key(v:val,''deprecated_since'')'), 'v:val') ... {'return_type': 'ArrayOf(Integer, 2)', 'name': 'nvim_win_get_position', 'method': v:true, 'parameters': [['Window', 'window']], 'since': 1} The `ArrayOf(Integer, 2)` return type didn't break clients when we added it, which is evidence that clients don't use the `return_type` field, thus renaming Dictionary => Dict in api_info() is not (in practice) a breaking change.
2024-09-09refactor(test): rename alter_slashes, invert its behaviorJustin M. Keyes1
- `alter_slashes` belongs in `testutil.lua`, not `testnvim.lua`. - `alter_slashes` is an unusual name. Rename it to `fix_slashes`. - invert its behavior, to emphasize that `/` slashes are the preferred, pervasive convention, not `\` slashes.
2024-09-08fix(startup): server fails if $NVIM_APPNAME is relative dir #30310Justin M. Keyes1
Problem: If $NVIM_APPNAME is a relative dir path, Nvim fails to start its primary/default server, and `v:servername` is empty. Root cause is d34c64e342dfba9248d1055e702d02620a1b31a8, but this wasn't noticed until 96128a5076b7 started reporting the error more loudly. Solution: - `server_address_new`: replace slashes "/" in the appname before using it as a servername. - `vim_mktempdir`: always prefer the system-wide top-level "nvim.user/" directory. That isn't intended to be specific to NVIM_APPNAME; rather, each *subdirectory* ("nvim.user/xxx") is owned by each Nvim instance. Nvim "apps" can be identified by the server socket(s) stored in those per-Nvim subdirs. fix #30256
2024-09-08fix(startup): ignore broken $XDG_RUNTIME_DIR #30285Justin M. Keyes1
Problem: $XDG_RUNTIME_DIR may be broken on WSL, which prevents starting (and even building) Nvim. #30282 Solution: - When startup fails, mention the servername in the error message. - If an autogenerated server address fails, log an error and continue with an empty `v:servername`. It's only fatal if a user provides a bad `--listen` or `$NVIM_LISTEN_ADDRESS` address. Before: $ nvim --headless --listen ./hello.sock nvim: Failed to --listen: "address already in use" $ NVIM_LISTEN_ADDRESS='./hello.sock' ./build/bin/nvim --headless nvim: Failed to --listen: "address already in use" After: $ nvim --headless --listen ./hello.sock nvim: Failed to --listen: address already in use: "./hello.sock" $ NVIM_LISTEN_ADDRESS='./hello.sock' ./build/bin/nvim --headless nvim: Failed $NVIM_LISTEN_ADDRESS: address already in use: "./hello.sock"
2024-09-05feat(defaults): popupmenu "Open in browser", "Go to definition" #30261Justin M. Keyes1
- Use the popup to expose more features such as LSP and gx. - Move the copy/paste items lower in the menu, they are lower priority.
2024-09-05test: avoid noise in CI logs #30264Justin M. Keyes1
Problem: Since 96128a5076b7 the test logs have noise from tests that *expect* failures: $NVIM_LOG_FILE: /tmp/cirrus-ci-build/build/.nvimlog (last 100 lines) ERR 2024-09-04T13:38:45.181 T949.28335.0/c terminfo_start:486: uv_pipe_open failed: no such device or address ERR 2024-09-04T13:38:45.181 T949.28335.0/c flush_buf:2527: uv_write failed: bad file descriptor ERR 2024-09-04T13:38:45.181 T949.28335.0/c flush_buf:2527: uv_write failed: bad file descriptor WRN 2024-09-04T13:43:43.294 ?.35904 server_start:173: Failed to start server: address already in use: /…/Xtest_tmpdir/…/T7159.35895.0 WRN 2024-09-04T13:43:43.314 ?.35907 server_start:173: Failed to start server: illegal operation on a directory: / ERR 2024-09-04T13:43:43.332 ?.35909 socket_watcher_init:60: Host lookup failed: https://example.com Solution: Rewrite the test to use `vim.system()`. Set NVIM_LOG_FILE in the child process to a "throwaway" logfile.
2024-09-03test: tmpname(create:boolean) #30242Justin M. Keyes1
Problem: 137f98cf6428 added the `create` parameter to `tmpname()` but didn't fully implement it. Solution: - Update impl for the `os.tmpname()` codepath. - Inspect all usages of `tmpname()`, update various tests.
2024-09-02feat(startup): validate --listen addressJustin M. Keyes1
Problem: `nvim --listen` does not error on EADDRINUSE. #30123 Solution: Now that `$NVIM_LISTEN_ADDRESS` is deprecated and input *only* (instead of the old, ambiguous situation where it was both an input *and* an output), we can be fail fast instead of trying to "recover". This reverts the "recovery" behavior of 704ba4151e7f67999510ee0ac19fdabb595d530c, but that was basically a workaround for the fragility of `$NVIM_LISTEN_ADDRESS`.