aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc
diff options
context:
space:
mode:
authormarshmallow <marshycity@gmail.com>2023-04-30 15:53:02 +1000
committerJustin M. Keyes <justinkz@gmail.com>2023-07-04 23:45:00 +0200
commitaf6e6ccf3dee815850639ec5613dda3442caa7d6 (patch)
tree8425b2b0dcf6592dd5f8a25d63187f337a047a2e /runtime/doc
parent3ecd45ded044c47efa76b74e9e3b720fbe27adc7 (diff)
downloadrneovim-af6e6ccf3dee815850639ec5613dda3442caa7d6.tar.gz
rneovim-af6e6ccf3dee815850639ec5613dda3442caa7d6.tar.bz2
rneovim-af6e6ccf3dee815850639ec5613dda3442caa7d6.zip
feat(vim.ui): vim.ui.open, "gx" without netrw
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>
Diffstat (limited to 'runtime/doc')
-rw-r--r--runtime/doc/lua.txt24
-rw-r--r--runtime/doc/news.txt6
-rw-r--r--runtime/doc/various.txt8
3 files changed, 38 insertions, 0 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index fb6cbca6e3..f180471bde 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 a path in the system's default handler. This function utilizes
+ `xdg-open`, `wslview`, `explorer`, or `open` commands depending on the
+ system to open the provided path.
+
+ Notifies the user if unsuccessful
+
+ Example: >lua
+
+ vim.ui.open("https://neovim.io/")
+
+ vim.ui.open("/path/to/file")
+<
+
+ Parameters: ~
+ • {path} (string) Path to be opened
+
+ Return: ~
+ SystemCompleted|nil result Result of command, if an appropriate one
+ could be found.
+
+ 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..ed797f94ba 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -107,6 +107,9 @@ The following new APIs and features were added.
• Bundled treesitter parser and queries (highlight, folds) for Markdown,
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,9 @@ The following changes to existing APIs or features add new behavior.
• |:Man| now respects 'wrapmargin'
+• The |gx| command now uses |vim.ui.open()| and not netrw. Continue using
+netrw with `vim.g.use_lua_gx = false`.
+
==============================================================================
REMOVED FEATURES *news-removed*
diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt
index 1b1dca321b..de1c21b310 100644
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -97,6 +97,14 @@ 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 Open the current path or URL under the cursor in the
+ system's default handler with |vim.ui.open|.
+
+ To use the netrw keymap, set `use_lua_gx` to false:
+>lua
+ vim.g.use_lua_gx = false
+<
*:p* *:pr* *:print* *E749*
:[range]p[rint] [flags]
Print [range] lines (default current line).