fix nvim open in file browser

This commit is contained in:
Yan Lin 2025-10-24 14:46:28 +02:00
parent 9b12307e94
commit 48ca6b1861

View file

@ -375,12 +375,12 @@ in
end end
end end
-- Unicode-safe file operations -- Unicode-safe file operations (async to prevent blocking)
function open_file_with_system_app() function open_file_with_system_app()
local filepath = vim.fn.expand('%:p') local filepath = vim.fn.expand('%:p')
if filepath ~= "" then if filepath ~= "" then
local escaped_path = vim.fn.shellescape(filepath) -- Use jobstart for async execution (detach = true prevents blocking)
vim.fn.system('xdg-open ' .. escaped_path) vim.fn.jobstart({'xdg-open', filepath}, {detach = true})
else else
print("No file to open") print("No file to open")
end end
@ -389,8 +389,8 @@ in
function show_file_in_file_manager() function show_file_in_file_manager()
local filepath = vim.fn.expand('%:p') local filepath = vim.fn.expand('%:p')
if filepath ~= "" then if filepath ~= "" then
local escaped_path = vim.fn.shellescape(filepath) -- Use jobstart for async execution (detach = true prevents blocking)
vim.fn.system('nautilus --select ' .. escaped_path) vim.fn.jobstart({'nautilus', '--select', filepath}, {detach = true})
else else
print("No file to show") print("No file to show")
end end