summaryrefslogtreecommitdiffstatshomepage
path: root/test/functional/core/startup_spec.lua
AgeCommit message (Collapse)AuthorFiles
2026-04-24fix(path): normalize path slashes on Windows #37729tao1
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-24fix(trust): always use "/" slashes in filepaths #39355Justin M. Keyes1
Problem: We should not use "\" (backslashes) except where absolutely required. See references in https://github.com/neovim/neovim/pull/37729 Solution: There is no reason to use "\" slashes in the trust db, so don't.
2026-04-17test: include test path in summary (#39141)zeertzjq1
Ref: https://github.com/neovim/neovim/pull/38486#discussion_r3088483987
2026-03-28fix(:restart): formalize restart event #35223Sathya Pramodh1
Problem: The "restart" event has some problems: - all UI clients must implement a somewhat complex set of setups - UI must be on the same machine as the server - only works for the "current" UI - race/edge case: If the user config has errors / waiting for input, are all UIs able to attach while Nvim is waiting for input? Solution: - Perform the restart on the server, not the client. - Pass listen address (instead of CLI args) in the UI event. - Simplifies UI logic: they only need to attach to new address. - Opens the door for more enhancements in the future, such as allowing all UIs to reattach instead of only the "current" UI. Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2026-03-10fix(lua): extra CR (\r) in `nvim -l` output #38048Commrade Goad1
Problem: `nvim -l` prints an extra `\r` to stdout: :=vim.system({'cmd', '/c', "echo print(1) | nvim -l -"}, {}):wait() { code = 0, signal = 0, stderr = "1\r\r\n", stdout = "" } Solution: Check `headless_mode` in `msg_use_crlf`. Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2026-03-10feat(terminal): surface exit code via virttext + nvim_get_chan_info #37987Ayaan1
Problem: When a terminal process exits, "[Process Exited]" text is added to the buffer contents. Solution: - Return `exitcode` field from `nvim_get_chan_info`. - Show it in the default 'statusline'. - Show exitcode as virtual text in the terminal buffer.
2026-02-26Merge pull request #37722 from bfredl/fastpackaddbfredl1
perf(runtime): hardware accelerated "packadd opt_package"
2026-02-25refactor(test): simplify v:argf tests #38055Justin M. Keyes1
2026-02-25perf(runtime): hardware accelerated "packadd opt_package"bfredl1
fixes #37586 when doing `packadd mypackage` up to two exact paths are added to &rtp. Instead of recalculating runtime_search_path from scratch, we can "just" splice these two paths in This is simple in theory, but get complicated in practice as "after" dirs do exist and need some wrangling. Echasnovski did some benchmarking, to show that this reduces overhead of a init.lua configuration style where separate `packadd!` calls are used spread out during the config. In addition, "batched" addition (either using "start" packages or packadd! a lot of opt packages at once) does not regress. A theoretical simplification could be to NEVER explicitly add "after" dirs to &rtp, but implicitly add all existing "after" dirs in reverse order when calculating the effective run time path. This might be tricky to do without breaking 12 tpope plugins again tho. We might also instead consider solutions where &rtp remains fully expanded but no longer is the main source of truth. But this is all post 0.12 work. This PR is an alright stopgap to make 0.12 fully support intended use cases of vim.pack.add() .
2026-02-25feat(startup): provide v:argf for file arguments #35889Sanzhar Kuandyk1
Problem: - `:args` and `argv()` can change after startup. - `v:arg` includes options/commands, not just files. - Plugins (e.g. Oil) may rewrite directory args. Solution: - New read-only var `v:argf`: snapshot of file/dir args at startup. - Unaffected by `:args` or plugins. - Unlike `v:argv`, excludes options/commands. - Paths are resolved to absolute paths when possible Example: nvim file1.txt dir1 file2.txt :echo v:argf " ['/home/user/project/file1.txt', '/home/user/project/dir1', '/home/user/project/file2.txt']
2026-02-20test: start test runners in Xtest_xdg dir (#37964)zeertzjq1
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-17fix(highlight): refresh highlight attrs before message output #25737glepnir1
Problem: When MsgArea highlight is changed, the next message may flash and disappear because msg_start() renders with stale highlight attributes. msg_puts_len() uses HL_ATTR(HLF_MSG) to render message text, which happens before update_screen() calls highlight_changed(). So the message is rendered with outdated attrs. Solution: Call highlight_changed() in msg_start().
2026-02-16fix(terminal): handle opening terminal on unloaded buffer (#37894)zeertzjq1
Problem: Strange behavior when opening terminal on unloaded buffer. Solution: For nvim_open_term() ensure the buffer is loaded as it needs to be read into the terminal. For jobstart() just open the memfile as the file content isn't needed. Not going to make nvim_open_term() pass stdin to the terminal when stdin isn't read into a buffer yet, as other APIs don't read stdin on unloaded buffer either. There are also other problems with loading buffer before reading stdin, so it's better to address those in another PR.
2026-02-06Merge #37424 $XDG_CONFIG_DIRS with init.lua, $NVIM_APPNAMEJustin M. Keyes1
2026-02-06fix(startup): respect $NVIM_APPNAME in $XDG_CONFIG_DIRS pathsJesse van der Pluijm1
Problem: $NVIM_APPNAME was not respected when searching $XDG_CONFIG_DIRS for config files. Nvim hardcoded "nvim" when constructing paths like `$XDG_CONFIG_DIRS/nvim/init.lua`, ignoring the $NVIM_APPNAME environment variable. This meant that config files like `$XDG_CONFIG_DIRS/myapp/init.lua` were not loaded, even though $NVIM_APPNAME was set to "myapp". Solution: Use `get_appname()` instead of hardcoded "nvim" for $XDG_CONFIG_DIRS paths in `do_system_initialization()` and `do_user_initialization()`. This makes $XDG_CONFIG_DIRS behave consistently with $XDG_CONFIG_HOME, which already respected $NVIM_APPNAME. As documented in `runtime/doc/starting.txt` (L1440-L1441): "In the help wherever `$XDG_CONFIG_…/nvim` is mentioned it is understood as `$XDG_CONFIG_…/$NVIM_APPNAME`." See: https://github.com/neovim/neovim/blob/43339dee40aa7731cc644315c15080e30aa1a67c/runtime/doc/starting.txt#L1440-L1441 Relates to #37405
2026-02-06fix(startup): source init.lua from XDG_CONFIG_DIRSJesse van der Pluijm1
Problem: `init.lua` files in `$XDG_CONFIG_DIRS` directories were not being sourced during startup, even though the documentation states they should be searched alongside `init.vim`. See: https://github.com/neovim/neovim/blob/e51f5e17e18429b847be4e0d99698727dec47ca9/runtime/doc/starting.txt#L495-L496 Solution: Modify `do_user_initialization()` to search for `init.lua` in each `$XDG_CONFIG_DIRS` directory before falling back to `init.vim`, matching the behavior for `$XDG_CONFIG_HOME`. Also show `E5422` error if both `init.lua` and `init.vim` exist in the same directory. Fixes #37405
2026-02-03ci(test): bump Windows runners to windows-2025 and unskip tests (#37666)zeertzjq1
Bumping to windows-2025 seems to fix at least one case of spaces having wrong attributes in TUI tests, which allow unskipping dozens of tests.
2025-12-30build: ship "_core/*" as bytecode (built-into Nvim binary)Justin M. Keyes1
Problem: We want to encourage implementing core features in Lua instead of C, but it's clumsy because: - Core Lua code (built into `nvim` so it is available even if VIMRUNTIME is missing/invalid) requires manually updating CMakeLists.txt, or stuffing it into `_editor.lua`. - Core Lua modules are not organized similar to C modules, `_editor.lua` is getting too big. Solution: - Introduce `_core/` where core Lua code can live. All Lua modules added there will automatically be included as bytecode in the `nvim` binary. - Move these core modules into `_core/*`: ``` _defaults.lua _editor.lua _options.lua _system.lua shared.lua ``` TODO: - Move `_extui/ => _core/ui2/`
2025-12-20test(messages): skip os_delay during testsJustin M. Keyes1
Problem: Tests that trigger `os_delay` messages may take 1-3 seconds, wasting build/CI time, since this serves no purpose in tests. Solution: - Introduce `msg_delay` for cases where `os_delay` is being used as a "UI feature". - Skip `msg_delay` in tests.
2025-12-18fix(lua): don't remove first char of non-file stacktrace source (#37008)zeertzjq1
2025-12-15fix(input): don't exit on EOF when peeking for input with -es (#36948)zeertzjq1
Only exit on EOF when doing a blocking wait for input.
2025-09-10fix(startup): crash in read_stdin #35699Cameron Ring1
Problem: Crash on startup in some situations due to call to `set_curbuf` with the current value of `cur_buf`. Solution: Switch buffers before doing the wipeout of the stdin buffer. Use cmdline cmds instead of raw buffer pointers to avoid lifetime issues.
2025-08-24fix(diff): set default diff flags properly (#35450)zeertzjq1
2025-08-20fix(startup): file buf is lost if stdin is empty and "-" is last #35402Cameron Ring1
Problem: Running `echo dummy | nvim file1 file2` closes the file1 buffer if file1 doesn't exist. Solution: Logic changed in 43e8ec9 such that stdin buffer may now be created *after* file args. Handle that case.
2025-07-28fix(messages): 'exrc' / secure messagesJustin M. Keyes1
2025-07-28feat(exrc): user must view and explicitly run ":trust" #35069nyngwang1
Problem: It's relatively easy to mispress key `a` to (a)llow arbitrary execution of 'exrc' files. #35050 Solution: - For exrc files (not directories), remove "allow" menu item. Require the user to "view" and then explicitly `:trust` the file.
2025-07-01test(exrc): lua exrc knows its location #34713Yochem van Rosmalen1
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2025-06-07fix(startup): make startup windows if there are only floating windows (#34349)luukvbaal1
Problem: If user init creates a floating window, startup windows (e.g. to accomodate arglist files) are no longer created. Solution: Check that firstwin->w_next is not floating when deciding whether to make startup windows.
2025-06-01fix(eval): winnr('$') counts non-current hidden/unfocusable windows #34207luukvbaal1
Problem: Non-visible/focusable windows are assigned a window number, whereas commands that use this window number skip over them. Solution: Skip over non-visible/focusable windows when computing the window number, unless it is made the current window through the API in which case an identifiable window number is still useful. This also ensures it matches the window number of the window entered by `<winnr>wincmd w` since 403fcacf.
2025-05-20feat(exrc): stop searching in parent directories by unsetting 'exrc'Yochem van Rosmalen1
Problem: No way for a user to limit 'exrc' search in parent directories (compare editorconfig.root). Solution: A configuration file can unset 'exrc', disabling the search for its parent directories.
2025-05-11feat(exrc): search in parent directories (#33889)Yochem van Rosmalen1
feat(exrc): search exrc in parent directories Problem: `.nvim.lua` is only loaded from current directory, which is not flexible when working from a subfolder of the project. Solution: Also search parent directories for configuration file.
2025-05-04feat(messages): cleanup Lua error messagesJustin M. Keyes1
"Error" in error messages is redundant. Just provide the context, don't say "Error ...".
2025-01-05"nvim -es": disable shada #21723Justin M. Keyes1
Problem: `nvim -es` (and `nvim -Es`) is the recommended way to non-interactively run commands/vimscript. But it enables shada by default, which is usually not wanted. Solution: - Disable shada by default for `nvim -es/-Es`. This can be overridden by `-i foo` if needed. - Do NOT change the 'loadplugins' default. - User config + packages _should_ be enabled by default, for both `nvim -es` and `nvim -l`. Else any Lua packages you have can't be accessed without `-u path/to/config`, which is clumsy. - Use-cases: ``` nvim --headless "+Lazy! sync" +qa would become: nvim -es "+Lazy! sync" nvim --headless +PlugInstall +qall would become: nvim -es +PlugInstall ``` - Opt-out (`--clean` or `-u NONE`) is much easier than opt-in (`-u path/to/config`). - User config/packages are analogous to pip packages, which are expected when doing `python -c ...`. related: 7c94bcd2d77e2e54b8836ab8325460a367b79eae related: ddd0eb6f5120a09b97867d2561ea61309038ccd2
2025-01-04test: use spawn_wait() instead of system() #31852Justin M. Keyes1
Problem: Tests that need to check `nvim` CLI behavior (no RPC session) create their own ad-hoc `system()` wrappers. Solution: - Use `n.spawn_wait` instead of `system()`. - Bonus: this also improves the tests by explicitly checking for `stdout` or `stderr`. And if a signal is raised, `ProcStream.status` will reflect it.
2025-01-03test: spawn_wait() starts a non-RPC Nvim processJustin M. Keyes1
Problem: Can't use `n.clear()` to test non-RPC `nvim` invocations. So tests end up creating ad-hoc wrappers around `system()` or `jobstart()`. Solution: - Introduce `n.spawn_wait()` - TODO (followup PR): Rename `n.spawn()` and `n.spawn_wait()`. It's misleading that `n.spawn()` returns a RPC session...
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-12-17feat(terminal)!: cursor shape and blink (#31562)Gregory Anders1
When a terminal application running inside the terminal emulator sets the cursor shape or blink status of the cursor, update the cursor in the parent terminal to match. This removes the "virtual cursor" that has been in use by the terminal emulator since the beginning. The original rationale for using the virtual cursor was to avoid having to support additional UI methods to change the cursor color for other (non-TUI) UIs, instead relying on the TermCursor and TermCursorNC highlight groups. The TermCursor highlight group is now used in the default 'guicursor' value, which has a new entry for Terminal mode. However, the TermCursorNC highlight group is no longer supported: since terminal windows now use the real cursor, when the window is not focused there is no cursor displayed in the window at all, so there is nothing to highlight. Users can still use the StatusLineTermNC highlight group to differentiate non-focused terminal windows. BREAKING CHANGE: The TermCursorNC highlight group is no longer supported.
2024-11-21docs: misc (#31138)dundargoc1
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2024-11-17fix(messages): proper multiline Lua print() messages #31205luukvbaal1
Problem: Separate message emitted for each newline present in Lua print() arguments. Solution: Make msg_multiline() handle NUL bytes. Refactor print() to use msg_multiline(). Refactor vim.print() to use print().
2024-11-14fix(tests): needing two calls to setup a screen is cringebfredl1
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-13fix(startup): report --startuptime error to stderr (#31131)zeertzjq1
Problem: Crash when initializing for --startuptime errors. Solution: Report the error to stderr, as neither logging nor messages have been initialized yet.
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-08-06fix(filetype): fix :filetype detect error with -u NONE (#29991)zeertzjq1
:filetype detect should enable filetype detection when it hasn't been enabled before.
2024-06-22fix(filetype): source ftdetect/* after creating scripts.vim autocmds (#29445)zeertzjq1
2024-05-31test: remove checks for failed tests on WindowsGregory Anders1
2024-04-23test: improve test conventionsdundargoc1
Specifically, functions that are run in the context of the test runner are put in module `test/testutil.lua` while the functions that are run in the context of the test session are put in `test/functional/testnvim.lua`. Closes https://github.com/neovim/neovim/issues/27004.
2024-04-10refactor(test): inject after_each differentlyLewis Russell1
2024-04-08test: improve test conventionsdundargoc1
Work on https://github.com/neovim/neovim/issues/27004.
2024-04-06fix: adjust error message for error in UI event callback (#28200)zeertzjq1
Also close Nvim instance before removing log file, otherwise the Nvim instance will still write to the log file. Also adjust log level in libuv_process_spawn(). Ref #27660
2024-04-05feat(defaults): add :Inspect to right-click menu (#28181)zeertzjq1
Ref #21393 - Move default user commands to _defaults.lua as that now contains all kinds of defaults rather than just default mappings and menus. - Remove the :aunmenu as there are no menus when _defaults.lua is run.