summaryrefslogtreecommitdiffstatshomepage
path: root/runtime/lua/vim/ui.lua
AgeCommit message (Collapse)AuthorFiles
2026-04-18docs: misc #39045Justin M. Keyes1
2026-04-01docs: misc #38584Justin M. Keyes1
2026-03-28docs: news #38464Justin M. Keyes1
2026-03-26refactor(progress): simplify progress-status format #38491Shadman1
Problem: Currently we are using if 1 item then {title}: {percent}% else Progress: {AVG}%({N}) dropping {title} and Progress text saves up space in statusline plus makes the format consistent, less jumping around. Solution: Use `{AVG}%({N})` for all cases.
2026-03-24fix(progress): show progress-status only in curwin #38458Shadman1
Problem: Currently same progress stat get's displayed on statusline of all windows. This is repeatitive and noisy. Solultion: Only display progress-status on the focused window Problem: Currently, when multiple progress are on going we show it as Progress: {N} items {percent}% format. It can be simplified sinnce items doesn't really add enough value for the valuable space it takes in statusline Solution: Change format to Progress: {percent}%({N})
2026-03-20docs: miscJustin M. Keyes1
2026-03-20feat(progress): status api, 'statusline' integration #35428Shadman1
Problem: Default statusline doesn't show progress status. Solution: - Provide `vim.ui.progress_status()`. - Include it in the default 'statusline'. How it works: Status text summarizes "running" progress messages. - If none: returns empty string - If one running item: "title: percent%" - If multiple running items: "Progress: N items avg-percent%"
2026-02-19fix(defaults): silent `gx` if no `textDocument/documentLink` support #37969Evgeni Chasnovski1
Problem: If buffer has attached LSP servers and none of them supports `textDocument/documentLink` method, typing `gx` results in a warning about that. Solution: Explicitly check that at least one server supports the target method before making the LSP request.
2026-02-16feat(lsp): support `textDocument/documentLink` (#37644)Maria Solano1
2026-01-27feat(health): check `vim.ui.open()` tool #37569skewb1k1
Problem: `:checkhealth` does not report when no `vim.ui.open()` handler is available. Solution: Factor command resolution into `_get_open_cmd()` and reuse it from `:checkhealth` to detect missing handlers.
2025-11-30fix(ui.open): use "start" instead of deprecated "rundll32" #36731ymich99631
Problem: The rundll32 utility is a leftover from Windows 95, and it has been deprecated since at least Windows Vista. Solution: Use the start command through Command Prompt instead.
2025-06-18docs(ui): type annotations for options #33983Yi Ming1
2025-06-17fix(docs): callback annotation for `vim.ui.input` #34507Maria José Solano1
2025-02-28docs(Open): add reference in documentation (#32678)Luca Saccarola1
2024-10-31fix: another round of type annotation fixesLewis Russell1
2024-10-22fix(lsp): support multiple clients in typehierarchyLewis Russell1
2024-10-21feat(vim.validate): improve fast form and deprecate spec formLewis Russell1
Problem: `vim.validate()` takes two forms when it only needs one. Solution: - Teach the fast form all the features of the spec form. - Deprecate the spec form. - General optimizations for both forms. - Add a `message` argument which can be used alongside or in place of the `optional` argument.
2024-10-18feat(vim.ui.open): support lemonade #30845Uthman Mohamed1
2024-10-17perf(validate): use lighter versionLewis Russell1
- Also fix `vim.validate()` for PUC Lua when showing errors for values that aren't string or number.
2024-09-16feat(vim.ui): configurable "gx" / vim.ui.open() toolMatěj Cepl1
Problem: User cannot configure the tool used by `vim.ui.open` (or `gx`). With netrw this was supported by `g:netrw_browsex_viewer`. Solution: Introduce `opts.cmd`. Users that want to set this globally can monkey-patch `vim.ui.open` in the same way described at `:help vim.paste()`. Fixes https://github.com/neovim/neovim/issues/29488 Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2024-09-07fix(vim.ui.open): prefer xdg-open on WSL #30302Yi Ming1
xdg-open is usually not installed in WSL. But if the user deliberately installs it, presumably they want to prioritize it.
2024-09-01feat(treesitter)!: default to correct behavior for quantified captures (#30193)Gregory Anders1
For context, see https://github.com/neovim/neovim/pull/24738. Before that PR, Nvim did not correctly handle captures with quantifiers. That PR made the correct behavior opt-in to minimize breaking changes, with the intention that the correct behavior would eventually become the default. Users can still opt-in to the old (incorrect) behavior for now, but this option will eventually be removed completely. BREAKING CHANGE: Any plugin which uses `Query:iter_matches()` must update their call sites to expect an array of nodes in the `match` table, rather than a single node.
2024-09-01fix(ui): correctly pass metadata to get_node_text #30222Gregory Anders1
Fixes: #30220
2024-08-31feat(ui): gx: use url extmark attribute and tree-sitter directive (#30192)Gregory Anders1
Use the "url" extmark attribute as well as the "url" tree-sitter metadata key to determine if the cursor is over something Nvim considers a URL.
2024-08-12fix(lua): ignore stdout and stderr for xdg-openAaron1
Ref #19724 Fix #29932
2024-07-09fix(lua): change some vim.fn.expand() to vim.fs.normalize() (#29583)zeertzjq1
Unlike vim.fn.expand(), vim.fs.normalize() doesn't expand wildcards.
2024-06-28refactor: use `vim._with` where possibledundargoc1
This mostly means replacing `nvim_buf_call` and `nvim_win_call` with `vim._with`.
2024-06-03fix(gx): allow `@` in urldundargoc1
This will make `gx` work for links for the form https://hachyderm.io/@neovim.
2024-05-24feat: allow gx to function for markdown linksdundargoc1
In other words, `gx` works regardless of where it was used in `[...](https://...)`. This only works on markdown buffers. Co-authored-by: ribru17 <ribru17@gmail.com>
2024-05-03fix(vim.ui)!: change open() to return `result|nil, errmsg|nil` #28612Justin M. Keyes1
reverts e0d92b9cc20b58179599f53dfa74ca821935a539 #28502 Problem: `vim.ui.open()` has a `pcall()` like signature, under the assumption that this is the Lua idiom for returning result-or-error. However, the `result|nil, errmsg|nil` pattern: - has precedent in: - `io.open` - `vim.uv` (`:help luv-error-handling`) - has these advantages: - Can be used with `assert()`: ``` local result, err = assert(foobar()) ``` - Allows LuaLS to infer the type of `result`: ``` local result, err = foobar() if err then ... elseif result then ... end ``` Solution: - Revert to the `result|nil, errmsg|nil` pattern. - Document the pattern in our guidelines.
2024-04-25fix(vim.ui)!: change open() to return pcall-like values #28502Justin M. Keyes1
Problem: `vim.ui.open` unnecessarily invents a different success/failure convention. Its return type was changed in 57adf8c6e01d, so we might as well change it to have a more conventional form. Solution: Change the signature to use the `pcall` convention of `status, result`.
2024-04-20fix(vim.ui.open): try wslview before explorer.exe #28424Justin M. Keyes1
Problem: explorer.exe is unreliable on WSL. Solution: Try wslview before explorer.exe. fix #28410
2024-04-15fix(vim.ui): open() may wait indefinitely #28325Justin M. Keyes1
Problem: vim.ui.open "locks up" Nvim if the spawned process does not terminate. #27986 Solution: - Change `vim.ui.open()`: - Do not call `wait()`. - Return a `SystemObj`. The caller can decide if it wants to `wait()`. - Change `gx` to `wait()` only a short time. - Allows `gx` to show a message if the command fails, without the risk of waiting forever.
2024-02-25refactor(types): fix miscellaneous type warningsMaria José Solano1
2024-02-20fix(vim.ui.open): use explorer.exe instead of wslview #26947Vu Nhat Chuong1
Problem: `vim.ui.open` uses `wslview`, which is slow and require a package from external PPA: https://wslutiliti.es/wslu/install.html#ubuntu Solution: Use `explorer.exe` instead. WSL supports it by default: https://learn.microsoft.com/en-us/windows/wsl/filesystems#view-your-current-directory-in-windows-file-explorer
2023-12-30refactor: fix luals warningsdundargoc1
2023-09-14docs: replace <pre> with ``` (#25136)Gregory Anders1
2023-09-05refactor(vim.system): factor out on_exit handlingLewis Russell1
2023-07-21fix(ui.open): some URLs fail on Windowsmarshmallow1
Problem: On Windows, `explorer.exe` fails to open some URLs, for example: :lua vim.ui.open('https://devdocs.io/#q=lua%20lua_call') https://github.com/neovim/neovim/pull/23401#issuecomment-1641015704 Solution: Use rundll32 instead.
2023-07-05fix(vim.ui.open): return (don't show) error messageJustin M. Keyes1
Problem: Showing an error via vim.notify() makes it awkward for callers such as lsp/handlers.lua to avoid showing redundant errors. Solution: Return the message instead of showing it. Let the caller decide whether and when to show the message.
2023-07-04fix(gx): visual selection, expand env varsJustin M. Keyes1
--- Rejected experiment: move vim.ui.open() to vim.env.open() Problem: `vim.ui` is where user-interface "providers" live, which can be overridden. It would also be useful to have a "providers" namespace for platform-specific features such as "open", clipboard, python, and the other providers listed in `:help providers`. We could overload `vim.ui` to serve that purpose as the single "providers" namespace, but `vim.ui.nodejs()` for example seems awkward. Solution: `vim.env` currently has too narrow of a purpose. Overload it to also be a namespace for `vim.env.open`. diff --git a/runtime/lua/vim/_meta.lua b/runtime/lua/vim/_meta.lua index 913f1fe20348..17d05ff37595 100644 --- a/runtime/lua/vim/_meta.lua +++ b/runtime/lua/vim/_meta.lua @@ -37,8 +37,28 @@ local options_info = setmetatable({}, { end, }) -vim.env = setmetatable({}, { - __index = function(_, k) +vim.env = setmetatable({ + open = setmetatable({}, { + __call = function(_, uri) + print('xxxxx'..uri) + return true + end, + __tostring = function() + local v = vim.fn.getenv('open') + if v == vim.NIL then + return nil + end + return v + end, + }) + }, + { + __index = function(t, k, ...) + if k == 'open' then + error() + -- vim.print({...}) + -- return rawget(t, k) + end local v = vim.fn.getenv(k) if v == vim.NIL then return nil
2023-07-04feat(vim.ui): vim.ui.open, "gx" without netrwmarshmallow1
Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com> Co-authored-by: Justin M. Keyes <justinkz@gmail.com> Co-authored-by: ii14 <59243201+ii14@users.noreply.github.com>
2023-02-22docs: naming conventions, guidelinesJustin M. Keyes1
close #21063
2022-12-02docs(gen): support language annotation in docstringsChristian Clason1
2022-11-12fix: vim.ui.input always calls callback #21006Steven Arcangeli1
Followup to #20883 Related: #18144 This patch changes the behavior of the default `vim.ui.input` when the user aborts with `<C-c>`. Currently, it produces an error message + stack and causes `on_confirm` to not be called. With this patch, `<C-c>` will cause `on_confirm` to be called with `nil`, the same behavior as when the user aborts with `<Esc>`. I can think of three good reasons why the behavior should be this way: 1. Easier for the user to understand** It's not intuitive for there to be two ways to abort an input dialog that have _different_ outcomes. As a user, I would expect any action that cancels the input to leave me in the same state. As a plugin author, I see no value in having two possible outcomes for aborting the input. I have to handle both cases, but I can't think of a situation where I would want to treat one differently than the other. 2. Provides an API that can be overridden by other implementations** The current contract of "throw an error upon `<C-c>`" cannot be replicated by async implementations of `vim.ui.input`. If the callsite wants to handle the case of the user hitting `<C-c>` they need to use `pcall(vim.ui.input, ...)`, however an async implementation will instantly return and so there will be no way for it to produce the same error-throwing behavior when the user inputs `<C-c>`. This makes it impossible to be fully API-compatible with the built-in `vim.ui.input`. 3. Provides a useful guarantee to the callsite** As a plugin author, I want the guarantee that `on_confirm` will _always_ be called (only catastrophic errors should prevent this). If I am in the middle of some async thread of logic, I need some way to resume that logic after handing off control to `vim.ui.input`. The only way to handle the `<C-c>` case is with `pcall`, which as already mentioned, breaks down if you're using an alternative implementation.
2022-11-08fix(vim.ui.input): return empty string when inputs nothing (#20883)Jongwook Choi1
fix(vim.ui.input): return empty string when inputs nothing The previous behavior of `vim.ui.input()` when typing <CR> with no text input (with an intention of having the empty string as input) was to execute `on_confirm(nil)`, conflicting with its documentation. Inputting an empty string should now correctly execute `on_confirm('')`. This should be clearly distinguished from cancelling or aborting the input UI, in which case `on_confirm(nil)` is executed as before.
2022-06-28fix(vim.ui.input): accept nil or empty "opts" #191090x74696d6d791
Fix #18143
2022-05-09chore: format runtime with styluaChristian Clason1
2022-04-15docs: typo fixes (#17859)dundargoc1
Co-authored-by: Elias Alves Moura <eliamoura.alves@gmail.com> Co-authored-by: venkatesh <shariharanvenkatesh@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Vikas Raj <24727447+numToStr@users.noreply.github.com> Co-authored-by: Steve Vermeulen <sfvermeulen@gmail.com> Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com> Co-authored-by: rwxd <rwxd@pm.me> Co-authored-by: casswedson <58050969+casswedson@users.noreply.github.com>
2022-02-08chore: fix typos (#17250)dundargoc1
Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Dani Dickstein <daniel.dickstein@gmail.com> Co-authored-by: Axel Dahlberg <git@valleymnt.com>