neovim(utils): fix yank open_in_browser utils

This commit is contained in:
2022-10-14 21:20:55 +03:00
parent 8a4d059c7a
commit d007e659d2

View File

@@ -1,12 +1,7 @@
local M = {} local M = {}
M.yank = function(message) M.yank = function(message)
if vim.fn.has("win32") == 1 then vim.cmd(":!echo -n '" .. message .. "' | wl-copy")
os.execute("echo '" .. message .. "' | win32yank -i")
else
-- i use wayland, so there is no xclip for X11
os.execute("echo -n '" .. message .. "' | wl-copy")
end
end end
--- @param diagnostics list --- @param diagnostics list
@@ -60,15 +55,9 @@ M.lsp_organize_imports = function(bufnr, timeout)
end end
M.open_url_in_browser = function(url) M.open_url_in_browser = function(url)
local f local _url = string.format('"%s"', url)
if vim.fn.has("win32") == 1 then vim.cmd(":!exec xdg-open " .. _url)
f = io.popen("explorer " .. url, "r")
else
f = io.popen("xdg-open " .. url, "r")
end
f:close()
end end
function M.lsp_format(bufnr) function M.lsp_format(bufnr)