auto-dark-mode.nvim
auto-dark-mode.nvim copied to clipboard
Unreliable with non-standard shell
I like to use a non-standard shell for vim.opt.shell
(Nushell). It happens to work on Linux, but does not on Windows (Nushell is cross-platform).
I think the issue is that query_command
in init.lua
is a shell script, that assumes the default shells per platform.
I would like to refactor the code to:
- change
query_command
to a table, that always represents one command + arguments (no shell features allowed, e.g. pipes) - change
vim.fn.jobstart
tovim.system
, which is not dependent on the shell option in Neovim.
Thoughts?
Hi! The refactoring of query_command
indeed seems nice and makes sense, but
change
vim.fn.jobstart
tovim.system
I'm not sure about this one, since the plugin relies on vim.fn.jobstart
and I don't know how exactly vim.system
works, but this is also open to discussion :)
I'll try to check out the vim.system
API and come back with a reply on that ;)
My only concern is that vim.system
is very recent (0.10, nightly exclusive at the time of writing). An effort to make query_command
shell agnostic sounds like a good idea.
I noticed, that the help file for jobstart
states:
If {cmd} is a List it runs directly (no 'shell').
That means, changing query_command
to a table and adapting the parsing of the query result could be enough, right?
Yes. The only shell pipe we're using is in WSL https://github.com/f-person/auto-dark-mode.nvim/blob/76e8d40d1e1544bae430f739d827391cbcb42fcc/lua/auto-dark-mode/init.lua#L100
which I think should be able to be moved into lua native code in https://github.com/f-person/auto-dark-mode.nvim/blob/76e8d40d1e1544bae430f739d827391cbcb42fcc/lua/auto-dark-mode/init.lua#L24-L39
Sorry, I got held up on further reviewing the PR, I'll try to have another look on the weekend. 😅