Closed dnebauer closed 8 months ago
Hi, thank you so much for raising this issue. This has now been resolved in #61!
I suggest this has not been satisfactorily resolved. The new test for browser failure is:
if vim.v.shell_error ~= 0 or err ~= "" then
This is still mistakenly taking any form of console output as a sign the browser failed. This is not (always) true. In the case of qutebrowser, which I use, for example, it dumps a bunch of warning messages to console, and thus err
is non-empty, but it runs successfully and displays the link. So, what happens is that the browser runs successfully and then the plugin tells you, nonsensically, that it failed to navigate the link.
In my view the check of err
needs to be removed entirely and used only for feedback in the event v:shell_error
signals that the browser call failed.
In creating a custom action I found 2 errors in the
shell_check
function inlua/urlview/actions.lua
.The first is in treating the return value from vim function
executable
as a lua boolean:This function returns either 1 (executable found), 0 (executable not found), or -1 (not implemented). All of these values are true in lua so, as implemented here, the test will always be true. The script line should be:
The second error is deciding whether the browser successfully opened by inspecting the return value of vim function
system
:Some browsers issue warnings to console even though they run successfully. The correct test relies on
v:shell_error
being set to the shell return value of the command:Then you need to handle providing
err
when non-empty.Here is my custom action configuration which shows everything I've discussed: