diff --git a/dotfiles/nvim/init.lua b/dotfiles/nvim/init.lua index a02cf30..d26b886 100644 --- a/dotfiles/nvim/init.lua +++ b/dotfiles/nvim/init.lua @@ -79,6 +79,10 @@ require("nvim-tree").setup { quit_on_open = true, }, }, + filters = { + custom = { ".git" }, + exclude = { ".gitignore" }, + }, } local autocmd = vim.api.nvim_create_autocmd @@ -101,6 +105,37 @@ local function open_nvim_tree(data) -- open the tree require("nvim-tree.api").tree.open() + + -- Get a list of all buffers + local buffers = vim.api.nvim_list_bufs() + + -- Iterate over each buffer + for _, bufnr in ipairs(buffers) do + -- Check if the buffer is empty and doesn't have a name + if + vim.api.nvim_buf_is_loaded(bufnr) + and vim.api.nvim_buf_get_name(bufnr) == "" + and vim.api.nvim_buf_get_option(bufnr, "buftype") == "" + then + -- Get all lines in the buffer + local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false) + + -- Initialize a variable to store the total number of characters + local total_characters = 0 + + -- Iterate over each line and calculate the number of characters + for _, line in ipairs(lines) do + total_characters = total_characters + #line + end + + -- Close the buffer if it's empty: + if total_characters == 0 then + vim.api.nvim_buf_delete(bufnr, { + force = true, + }) + end + end + end end autocmd({ "VimEnter" }, { callback = open_nvim_tree }) diff --git a/dotfiles/nvim/lua/chadrc.lua b/dotfiles/nvim/lua/chadrc.lua index 93d9627..959cec6 100644 --- a/dotfiles/nvim/lua/chadrc.lua +++ b/dotfiles/nvim/lua/chadrc.lua @@ -1,6 +1,6 @@ --- This file needs to have same structure as nvconfig.lua +-- This file needs to have same structure as nvconfig.lua -- https://github.com/NvChad/ui/blob/v3.0/lua/nvconfig.lua --- Please read that file to know all available options :( +-- Please read that file to know all available options :( ---@type ChadrcConfig local M = {} @@ -16,6 +16,6 @@ M.ui = { } M.nvdash = { - load_on_startup = true, + load_on_startup = false, } return M diff --git a/dotfiles/nvim/lua/configs/lspconfig.lua b/dotfiles/nvim/lua/configs/lspconfig.lua index 9cddd88..a87a3fd 100644 --- a/dotfiles/nvim/lua/configs/lspconfig.lua +++ b/dotfiles/nvim/lua/configs/lspconfig.lua @@ -15,7 +15,7 @@ local servers = { "pylsp", "tailwindcss", "templ", - "vuels", + -- "volar", } local nvlsp = require "nvchad.configs.lspconfig"