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.luawith 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 = falsein theoptstable, withoutnetrw-noloadinstructions removed. I get the absolute path of the directory behind..enabled = falsein theoptstable, withnetrw-noloadinstructions removed. I get..I guess
netrwis doing some magics with the argument. I started to readnetrwdocumentation. My first skim did not give me an answer, sadly. I will read into details.Plus, in the documentation of
nvim-treeI see that I can keepnetrw. So I removed the global options ofnetrw-noloadand I setdisable_netrwandhijack_netrwtofalseandtruerespectively: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-noloadinstructions result in an empty buffer.I think the default behaviour, namely with
netrw-noleadinstructions and default settings, is to have the correct absolute path of the argument. Or maybe, it would need to add one more option in theoptsof the plugin?Edit: I found out that
netrwmanage 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.setupofnvim-tree.luaand 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