Skip to content

Commit

Permalink
fix: open external docs broken in neovim 0.9 (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb authored Nov 11, 2023
1 parent 64edff2 commit bbcee20
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.4.2] - 2023-11-11

## Fixed

- Open external docs broken in Neovim 0.9 [[#50](https://github.com/mrcjkb/rustaceanvim/issues/50)].

## [3.4.1] - 2023-11-10

## Fixed
Expand Down
7 changes: 4 additions & 3 deletions lua/rustaceanvim/commands/external_docs.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local M = {}

local rl = require('rustaceanvim.rust_analyzer')
local compat = require('rustaceanvim.compat')

---@param url string
local function open_url(url)
Expand All @@ -14,15 +15,15 @@ local function open_url(url)
end

if vim.fn.has('mac') == 1 then
vim.system({ 'open', url }, nil, on_exit)
compat.system({ 'open', url }, nil, on_exit)
return
end
if vim.fn.executable('sensible-browser') == 1 then
vim.system({ 'sensible-browser', url }, nil, on_exit)
compat.system({ 'sensible-browser', url }, nil, on_exit)
return
end
if vim.fn.executable('xdg-open') == 1 then
vim.system({ 'xdg-open', url }, nil, on_exit)
compat.system({ 'xdg-open', url }, nil, on_exit)
return
end
local ok, err = pcall(vim.fn['netrw#BrowseX'], url, 0)
Expand Down

0 comments on commit bbcee20

Please sign in to comment.