diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2023-07-05 00:30:05 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-05 00:30:05 -0700 |
| commit | 5936a88f181e52e17484d4ae6dfaea7d50d43935 (patch) | |
| tree | ef727393e94037e5a675f566b59b1014f8fe2a29 /runtime/doc | |
| parent | b2e8c0df2062f765a4cf7d96379c5f0f19393dfd (diff) | |
| parent | e644e7ce0b36dd5e75770f3faa0a84f15e2561e8 (diff) | |
| download | rneovim-5936a88f181e52e17484d4ae6dfaea7d50d43935.tar.gz rneovim-5936a88f181e52e17484d4ae6dfaea7d50d43935.tar.bz2 rneovim-5936a88f181e52e17484d4ae6dfaea7d50d43935.zip | |
Merge #23401 vim.ui.open: "gx" without netrw
Diffstat (limited to 'runtime/doc')
| -rw-r--r-- | runtime/doc/lua.txt | 24 | ||||
| -rw-r--r-- | runtime/doc/news.txt | 9 | ||||
| -rw-r--r-- | runtime/doc/various.txt | 9 |
3 files changed, 41 insertions, 1 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index fb6cbca6e3..77a89a123d 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2343,6 +2343,30 @@ input({opts}, {on_confirm}) *vim.ui.input()* typed (it might be an empty string if nothing was entered), or `nil` if the user aborted the dialog. +open({path}) *vim.ui.open()* + Opens `path` with the system default handler (macOS `open`, Windows + `explorer.exe`, Linux `xdg-open`, …), or returns (but does not show) an + error message on failure. + + Expands "~/" and environment variables in filesystem paths. + + Examples: >lua + + vim.ui.open("https://neovim.io/") + vim.ui.open("~/path/to/file") + vim.ui.open("$VIMRUNTIME") +< + + Parameters: ~ + • {path} (string) Path or URL to open + + Return: ~ + SystemCompleted|nil # Command result, or nil if not found. + (string|nil) # Error message on failure + + See also: ~ + • |vim.system()| + select({items}, {opts}, {on_choice}) *vim.ui.select()* Prompts the user to pick from a list of items, allowing arbitrary (potentially asynchronous) work until `on_choice`. diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 61ae92296f..24e9dc917b 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -105,7 +105,10 @@ The following new APIs and features were added. https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_inlayHint • Bundled treesitter parser and queries (highlight, folds) for Markdown, -Python, and Bash. + Python, and Bash. + +• |vim.ui.open()| opens URIs using the system default handler (macOS `open`, + Windows `explorer`, Linux `xdg-open`, etc.) ============================================================================== CHANGED FEATURES *news-changed* @@ -143,6 +146,10 @@ The following changes to existing APIs or features add new behavior. • |:Man| now respects 'wrapmargin' +• |gx| now uses |vim.ui.open()| and not netrw. To customize, you can redefine + `vim.ui.open` or remap `gx`. To continue using netrw (deprecated): >vim + :call netrw#BrowseX(expand(exists("g:netrw_gx")? g:netrw_gx : '<cfile>'), netrw#CheckIfRemote())<CR> + ============================================================================== REMOVED FEATURES *news-removed* diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index 1b1dca321b..956c37fc0f 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -97,6 +97,15 @@ g8 Print the hex values of the bytes used in the cursor is halfway through a multibyte character the command won't move the cursor. + *gx* +gx Opens the current filepath or URL (decided by + |<cfile>|, 'isfname') at cursor using the system + default handler, by calling |vim.ui.open()|. + + *v_gx* +{Visual}gx Opens the selected text using the system default + handler, by calling |vim.ui.open()|. + *:p* *:pr* *:print* *E749* :[range]p[rint] [flags] Print [range] lines (default current line). |