autoclose NvimTree if it is the last open buffer
This commit is contained in:
parent
ae88f67228
commit
c47546d65a
@ -1,7 +1,6 @@
|
|||||||
local key = vim.api.nvim_set_keymap
|
local key = vim.api.nvim_set_keymap
|
||||||
local u = require('utils')
|
local u = require('utils')
|
||||||
|
|
||||||
vim.cmd([[autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif]])
|
|
||||||
vim.cmd([[autocmd CursorHold * lua vim.diagnostic.open_float({focusable = false})]])
|
vim.cmd([[autocmd CursorHold * lua vim.diagnostic.open_float({focusable = false})]])
|
||||||
|
|
||||||
key('n', ';', ':Telescope find_files<CR>', {})
|
key('n', ';', ':Telescope find_files<CR>', {})
|
||||||
@ -24,3 +23,11 @@ vim.api.nvim_exec(
|
|||||||
false
|
false
|
||||||
)
|
)
|
||||||
|
|
||||||
|
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
|
||||||
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user