fixed deps and added autocmds for empty buffers
This commit is contained in:
parent
f65e929e9e
commit
b8cd8910f3
@ -16,10 +16,6 @@ end
|
||||
|
||||
vim.keymap.set("n", "<leader>b", ":lua ToggleTransparent()<CR>")
|
||||
|
||||
-- nvim-tree bindings
|
||||
|
||||
vim.keymap.set("n", "<leader>t", ":NvimTreeToggle<CR>")
|
||||
|
||||
-- simple spell check toggle
|
||||
local function SpellToggle()
|
||||
if vim.o.spell == nil or vim.o.spell then
|
||||
|
||||
@ -2,22 +2,72 @@ return {
|
||||
{
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = "v3.x",
|
||||
depends = {
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"MunifTanjim/nui.nvim",
|
||||
"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
|
||||
},
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
branch = "0.1.x",
|
||||
event = "VimEnter",
|
||||
depends = { "nvim-lua/plenary.nvim"},
|
||||
dependencies = { "nvim-lua/plenary.nvim"},
|
||||
opts = {
|
||||
defaults = {
|
||||
layout_config = {
|
||||
horizontal = { width = 0.8 }
|
||||
horizontal = { width = 0.9 }
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
37
lua/plugins/treesitter.lua
Normal file
37
lua/plugins/treesitter.lua
Normal 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,
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user