fixed deps and added autocmds for empty buffers

This commit is contained in:
spinach 2025-11-23 22:18:52 -05:00
parent f65e929e9e
commit b8cd8910f3
3 changed files with 90 additions and 7 deletions

View File

@ -16,10 +16,6 @@ end
vim.keymap.set("n", "<leader>b", ":lua ToggleTransparent()<CR>") vim.keymap.set("n", "<leader>b", ":lua ToggleTransparent()<CR>")
-- nvim-tree bindings
vim.keymap.set("n", "<leader>t", ":NvimTreeToggle<CR>")
-- simple spell check toggle -- simple spell check toggle
local function SpellToggle() local function SpellToggle()
if vim.o.spell == nil or vim.o.spell then if vim.o.spell == nil or vim.o.spell then

View File

@ -2,22 +2,72 @@ return {
{ {
"nvim-neo-tree/neo-tree.nvim", "nvim-neo-tree/neo-tree.nvim",
branch = "v3.x", branch = "v3.x",
depends = { dependencies = {
"nvim-lua/plenary.nvim", "nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim", "MunifTanjim/nui.nvim",
"nvim-tree/nvim-web-devicons", "nvim-tree/nvim-web-devicons",
}, },
keys = {
{
"<leader>t",
function()
require("neo-tree.command").execute({
toggle = true,
source = "filesystem",
position = "left",
})
end,
desc = "Buffers (root dir)",
},
},
config = function()
-- automatically close file tree if file is selected
require("neo-tree").setup({
close_if_last_window = true,
event_handlers = {
{
event = "file_open_requested",
handler = function()
require("neo-tree.command").execute({ action = "close" })
end,
},
-- makes it so quitting inside buffer quits all buffers
{
event = "neo_tree_buffer_enter",
handler = function()
vim.cmd("cabbrev <buffer> q qall")
end,
},
},
})
-- auto open file tree on empty buffer or directory
vim.api.nvim_create_autocmd("VimEnter", {
callback = function(data)
local is_directory = vim.fn.isdirectory(data.file) == 1
local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
if is_directory or no_name then
require("neo-tree.command").execute({
action = "focus",
source = "filesystem",
position = "left",
})
end
end,
})
end,
lazy = false, -- neo-tree lazy loads itself lazy = false, -- neo-tree lazy loads itself
}, },
{ {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
branch = "0.1.x", branch = "0.1.x",
event = "VimEnter", event = "VimEnter",
depends = { "nvim-lua/plenary.nvim"}, dependencies = { "nvim-lua/plenary.nvim"},
opts = { opts = {
defaults = { defaults = {
layout_config = { layout_config = {
horizontal = { width = 0.8 } horizontal = { width = 0.9 }
}, },
}, },
}, },

View File

@ -0,0 +1,37 @@
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
event = { "BufReadPost", "BufNewFile" },
dependencies = {
"nvim-treesitter/nvim-treesitter-textobjects",
},
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = {
"lua",
"vim",
"vimdoc",
"javascript",
"typescript",
"python",
"go",
-- add other languages you need
},
highlight = {
enable = true,
},
indent = {
enable = true,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<CR>",
node_incremental = "<CR>",
scope_incremental = "<S-CR>",
node_decremental = "<BS>",
},
},
})
end,
}