File tree 1 file changed +6
-21
lines changed
1 file changed +6
-21
lines changed Original file line number Diff line number Diff line change @@ -25,30 +25,15 @@ function M.open(uri, opts)
25
25
if not opts .system and M .file_exists (uri ) then
26
26
return M .float ({ style = " " , file = uri })
27
27
end
28
- local Config = require (" lazy.core.config" )
29
- local cmd
30
- if not opts .system and Config .options .ui .browser then
31
- cmd = { Config .options .ui .browser , uri }
32
- elseif vim .fn .has (" win32" ) == 1 then
33
- cmd = { " explorer" , uri }
34
- elseif vim .fn .has (" macunix" ) == 1 then
35
- cmd = { " open" , uri }
36
- else
37
- if vim .fn .executable (" xdg-open" ) == 1 then
38
- cmd = { " xdg-open" , uri }
39
- elseif vim .fn .executable (" wslview" ) == 1 then
40
- cmd = { " wslview" , uri }
41
- else
42
- cmd = { " open" , uri }
43
- end
28
+ local cmd , err = vim .ui .open (uri )
29
+ if cmd then
30
+ cmd :wait ()
44
31
end
45
-
46
- local ret = vim .fn .jobstart (cmd , { detach = true })
47
- if ret <= 0 then
32
+ if err then
48
33
local msg = {
49
34
" Failed to open uri" ,
50
- ret ,
51
- vim .inspect (cmd ),
35
+ err ,
36
+ vim .inspect (uri ),
52
37
}
53
38
vim .notify (table.concat (msg , " \n " ), vim .log .levels .ERROR )
54
39
end
You can’t perform that action at this time.
0 commit comments