diff --git a/README.md b/README.md index 7edaa8f..4681d7b 100644 --- a/README.md +++ b/README.md @@ -237,6 +237,11 @@ local opts = { -- automatically call RustReloadWorkspace when writing to a Cargo.toml file. reload_workspace_from_cargo_toml = true, + -- function for opening external URLs + open_url = function(url) + vim.fn["netrw#BrowseX"](url, 0) + end, + -- These apply to the default RustSetInlayHints command inlay_hints = { -- automatically set inlay hints (type hints) diff --git a/lua/rust-tools/config.lua b/lua/rust-tools/config.lua index 2854138..d64b16c 100644 --- a/lua/rust-tools/config.lua +++ b/lua/rust-tools/config.lua @@ -21,6 +21,11 @@ local defaults = { -- automatically call RustReloadWorkspace when writing to a Cargo.toml file. reload_workspace_from_cargo_toml = true, + -- function for opening external URLs + open_url = function(url) + vim.fn["netrw#BrowseX"](url, 0) + end, + -- These apply to the default RustSetInlayHints command inlay_hints = { -- automatically set inlay hints (type hints) diff --git a/lua/rust-tools/external_docs.lua b/lua/rust-tools/external_docs.lua index 20f1dcd..47da51d 100644 --- a/lua/rust-tools/external_docs.lua +++ b/lua/rust-tools/external_docs.lua @@ -9,7 +9,7 @@ function M.open_external_docs() vim.lsp.util.make_position_params(), function(_, url) if url then - vim.fn["netrw#BrowseX"](url, 0) + rt.config.options.tools.open_url(url) end end )