Skip to content

Write autoclose command in lua #1115

Answered by kyazdani42
zakissimo asked this question in Q&A
Discussion options

You must be logged in to vote

with 0.7:

vim.api.nvim_create_autocmd("BufEnter", {
  nested = true,
  callback = function()
    if #vim.api.nvim_list_wins() == 1 and vim.api.nvim_buf_get_name(0):match("NvimTree_") ~= nil then
      vim.cmd "quit"
    end
  end
})

Replies: 3 comments 10 replies

Comment options

You must be logged in to vote
5 replies
@nshen
Comment options

@nshen
Comment options

@zakissimo
Comment options

@alex-courtis
Comment options

@mamaraddio
Comment options

Answer selected by zakissimo
Comment options

You must be logged in to vote
2 replies
@kyazdani42
Comment options

@msva
Comment options

Comment options

You must be logged in to vote
3 replies
@alex-courtis
Comment options

@dmitry-semenov
Comment options

@alex-courtis
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
7 participants