From f1e8caeca29850e7bef76a3e7cc8d0d9ef8481ec Mon Sep 17 00:00:00 2001
From: PeteChu <phuengton.ch@gmail.com>
Date: Mon, 20 Mar 2023 14:40:42 +0700
Subject: [PATCH] * feat(nvim-tree.lua): add autocmd to close NvimTree on
 QuitPre event and open NvimTree on VimEnter event * feat(bufferline.lua): add
 configuration for bufferline plugin with options for indicator, diagnostics,
 offsets, separator_style, and always_show_bufferline

---
 after/plugin/nvim-tree.lua        | 12 ++++++++++++
 lua/custom/plugins/bufferline.lua | 17 +++++++++++++++++
 2 files changed, 29 insertions(+)
 create mode 100644 after/plugin/nvim-tree.lua
 create mode 100644 lua/custom/plugins/bufferline.lua

diff --git a/after/plugin/nvim-tree.lua b/after/plugin/nvim-tree.lua
new file mode 100644
index 00000000..84a0625f
--- /dev/null
+++ b/after/plugin/nvim-tree.lua
@@ -0,0 +1,12 @@
+vim.api.nvim_create_autocmd({"QuitPre"}, {
+    callback = function() vim.cmd("NvimTreeClose") end,
+})
+
+
+local function open_nvim_tree()
+
+  -- open the tree
+  require("nvim-tree.api").tree.open()
+end
+
+vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
diff --git a/lua/custom/plugins/bufferline.lua b/lua/custom/plugins/bufferline.lua
new file mode 100644
index 00000000..f13a9e0e
--- /dev/null
+++ b/lua/custom/plugins/bufferline.lua
@@ -0,0 +1,17 @@
+return {
+    {
+        'akinsho/bufferline.nvim',
+        config = function ()
+            require("bufferline").setup {
+                options = {
+                    indicator = { style = "icon", icon = "▎"},
+                    diagnostics = 'nvim_lsp', -- | "nvim_lsp" | "coc",
+                    diagnostics_update_in_insert = false,
+                    offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
+                    separator_style = "thin", -- | "thick" | "thin" | { 'any', 'any' },
+                    always_show_bufferline = true,
+                }
+            }
+        end
+    }
+}