Load plugin if open nvim with directory #877
Unanswered
primeapple
asked this question in
Q&A
Replies: 1 comment
-
|
Reference: #534 (reply in thread) Use user autocmd vim.api.nvim_create_autocmd("VimEnter", {
callback = function()
if vim.fn.argc() == 1 and vim.fn.isdirectory(vim.fn.argv()[1]) ~= 0 then
vim.api.nvim_exec_autocmds("User", {
pattern = "IsEnterDir"
})
return true
end
end
})
vim.api.nvim_create_autocmd("BufAdd", {
callback = function()
if vim.fn.isdirectory(vim.fn.expand("%")) ~= 0 then
vim.api.nvim_exec_autocmds("User", {
pattern = "IsEditDir"
})
return true
end
end
})Add user autocmd in use({
"kyazdani42/nvim-tree.lua",
cmd = "NvimTreeToggle",
event = {"User IsEnterDir", "User IsEditDir"},
config = function() require("plugins.nvimtree") end
}) |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
I'm pretty unsure on how to do this. But I would like to load nvim-tree asynchronous, however if I open nvim with a directory I want it to be loaded immediately.
So
nvim test.shshould not load plugin. Howevernvim .should load plugin.Could someone give me at least an idea how it should look like?
Beta Was this translation helpful? Give feedback.
All reactions