Skip to content

Commit

Permalink
If using wsl, use wsl-open (#187)
Browse files Browse the repository at this point in the history
Co-authored-by: Pete <[email protected]>
  • Loading branch information
mimikun and epwalsh authored Sep 8, 2023
1 parent 41bb0ca commit 3725b89
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- A bug when following links when headers have a space.
- Fixed `ObsidianFollowLink` when the note path contains a block link (e.g. `[[foo#^Bar]]`).
- Fixed `:ObsidianOpen` doesn't work in WSL2
- Use [wsl-open](https://gitlab.com/4U6U57/wsl-open)

## [v1.13.0](https://github.com/epwalsh/obsidian.nvim/releases/tag/v1.13.0) - 2023-08-24

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Built for people who love the concept of Obsidian -- a simple, markdown-based no
- NeoVim >= 0.8.0 (this plugin uses `vim.fs` which was only added in 0.8).
- If you want completion and search features (recommended) you'll also need [ripgrep](https://github.com/BurntSushi/ripgrep) to be installed and on your `$PATH`.
See [ripgrep#installation](https://github.com/BurntSushi/ripgrep) for install options.
- If you using WSL, you'll also need [wsl-open](https://gitlab.com/4U6U57/wsl-open)

Search functionality (e.g. via the `:ObsidianSearch` and `:ObsidianQuickSwitch` commands) also requires [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) or one of the `fzf` alternatives (see [plugin dependencies](#plugin-dependencies) below).

Expand Down
7 changes: 6 additions & 1 deletion lua/obsidian/command.lua
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,13 @@ command.open = function(client, data)
local cmd = nil
local args = {}
local sysname = vim.loop.os_uname().sysname
local release = vim.loop.os_uname().release
if sysname == "Linux" then
cmd = "xdg-open"
if string.find(release, "microsoft") then
cmd = "wsl-open"
else
cmd = "xdg-open"
end
args = { uri }
elseif sysname == "Darwin" then
cmd = "open"
Expand Down

0 comments on commit 3725b89

Please sign in to comment.