mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
Make "O" undefined mapping if vim.ui.open isn't available
This commit is contained in:
parent
184807bef2
commit
e91fa6eaf5
1 changed files with 8 additions and 9 deletions
|
|
@ -69,17 +69,16 @@ return {
|
|||
end,
|
||||
desc = "copy path to clipboard",
|
||||
},
|
||||
["O"] = {
|
||||
command = function(state)
|
||||
if vim.ui.open then
|
||||
local filepath = state.tree:get_node().path
|
||||
vim.ui.open(filepath)
|
||||
else
|
||||
require("lazyvim.util").error("vim.ui.open is not available")
|
||||
["O"] = vim.ui.open and {
|
||||
function(state)
|
||||
local path = state.tree:get_node().path
|
||||
local ret = vim.ui.open(path)
|
||||
if ret and ret.code ~= 0 then
|
||||
require("lazyvim.util").error("Failed to open file: " .. ret.stderr .. "\n .. " .. ret.stdout)
|
||||
end
|
||||
end,
|
||||
desc = "open_with_system_default",
|
||||
},
|
||||
desc = "open with system default application",
|
||||
} or nil,
|
||||
},
|
||||
},
|
||||
default_component_configs = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue