how to write auto close autocmd in lua nvim_create_autocmd api? #1130
-
how to write the command ? vim.api.nvim_create_autocmd(
"BufEnter",
{ command = "++nested if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif" }
) |
Beta Was this translation helpful? Give feedback.
Answered by
kyazdani42
Apr 3, 2022
Replies: 2 comments 4 replies
-
I have tried a lot. Is this correct? vim.api.nvim_create_autocmd("BufEnter", {
callback = function()
if vim.fn.winnr("$") == 1 and vim.fn.bufname() == ("NvimTree_" .. vim.fn.tabpagenr()) then
vim.cmd("quit")
end
end,
}) |
Beta Was this translation helpful? Give feedback.
3 replies
-
check the existing discussions please... #1115 |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
alex-courtis
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
check the existing discussions please... #1115