argv is "NvimTree_1" #2843
Unanswered
mufasachan
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
Why
vim.fn.argv()
output is{ "NvimTree_1" }
when I use a single directory as an argument? I raise this question because it messes up a session plugin that I use. But, the question is not about the behaviour of this plugin.Here a
repro.lua
with lazy.nvim:Then if I type
nvim -u repro.lua .
and I use the command= vim.fn.argv
, then I get{ "NvimTree_1" }
. I do not think it's an OK behaviour but I know little about the role of netrw and the bulit-in vim argv.I tried the following :
enabled = false
in theopts
table, withoutnetrw-noload
instructions removed. I get the absolute path of the directory behind.
.enabled = false
in theopts
table, withnetrw-noload
instructions removed. I get.
.I guess
netrw
is doing some magics with the argument. I started to readnetrw
documentation. My first skim did not give me an answer, sadly. I will read into details.Plus, in the documentation of
nvim-tree
I see that I can keepnetrw
. So I removed the global options ofnetrw-noload
and I setdisable_netrw
andhijack_netrw
tofalse
andtrue
respectively:I still have the same output:
{ "NvimTree_1" }
.Also I tried with
version="*"
and with other directory name, not just.
. The behaviour is reproduced.Eventually,
opts = { disable_netrw = false, hijack_netrw = false }
without thenetrw-noload
instructions result in an empty buffer.I think the default behaviour, namely with
netrw-nolead
instructions and default settings, is to have the correct absolute path of the argument. Or maybe, it would need to add one more option in theopts
of the plugin?Edit: I found out that
netrw
manage the argument and expand it. I am not familiar with vim script so my understanding is not accurate. I tested to perform avim.cmd("args test.lua")
at the beginning of theM.setup
ofnvim-tree.lua
and it seems to work. Although, my question still holds: there is any particular reason that the argv is modified? I guess at the Init of NvimTree, the buffer is namedNvimTree_<tab>
and, vim/nvim, takes the buffer name as argv.Beta Was this translation helpful? Give feedback.
All reactions