Add bufferline options to always show the bufferline, use ordinal numbers, and sort by insert position in the current setup

This commit is contained in:
PeteChu 2023-04-06 01:29:34 +07:00
parent e7b27047e2
commit 606b0572d2
6 changed files with 28 additions and 36 deletions

View file

@ -1,5 +1,4 @@
local function open_nvim_tree(data)
-- buffer is a real file on the disk
local real_file = vim.fn.filereadable(data.file) == 1
@ -18,8 +17,8 @@ end
-- vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
-- Auto close
vim.api.nvim_create_autocmd({"QuitPre"}, {
callback = function() vim.cmd("NvimTreeClose") end,
vim.api.nvim_create_autocmd({ "QuitPre" }, {
callback = function() vim.cmd("NvimTreeClose") end,
})
-- Go to last used hidden buffer when deleting a buffer
@ -32,9 +31,9 @@ vim.api.nvim_create_autocmd("BufEnter", {
-- Required to let the close event complete. An error is thrown without this.
vim.defer_fn(function()
-- close nvim-tree: will go to the last hidden buffer used before closing
api.tree.toggle({find_file = true, focus = true})
api.tree.toggle({ find_file = true, focus = true })
-- re-open nivm-tree
api.tree.toggle({find_file = true, focus = true})
api.tree.toggle({ find_file = true, focus = true })
-- nvim-tree is still the active window. Go to the previous window.
vim.cmd("wincmd p")
end, 0)