1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2025-07-02 01:39:26 +00:00

[neovim] replace neo-tree with snacks.nvim

Replace neo-tree.nvim with snacks.nvim for file explorer functionality and
remove several other plugins including:
- mini-animate
- mini-starter
- indent-blankline

The snacks.nvim plugin provides better file explorer, dashboard, indentation
guides, and other UI improvements in a more cohesive package.

Also removed the large file autocommand as snacks.nvim handles this with its
bigfile module.
This commit is contained in:
2025-03-29 18:26:13 +01:00
parent 8e93236e49
commit 7d01253a29
15 changed files with 71 additions and 249 deletions

View File

@ -17,7 +17,7 @@ bufferline.setup({
close_command = "Bdelete! %d",
right_mouse_command = "Bdelete! %d",
offsets = {
{ filetype = "neo-tree", text = "", padding = 1 },
{ filetype = "snacks_picker_list", text = "", padding = 1 },
{ filetype = "dapui_scopes", text = "", padding = 1 },
},
indicator = {
@ -30,10 +30,7 @@ bufferline.setup({
custom_areas = {
left = function()
local text = ""
if not is_buffer_loaded("neo-tree") then
text = "" .. string.gsub(vim.loop.cwd(), "^" .. os.getenv("HOME"), "~") .. ""
end
local text = "" .. string.gsub(vim.loop.cwd(), "^" .. os.getenv("HOME"), "~") .. ""
return { { text = text, fg = "#adbac7" } }
end,

View File

@ -6,7 +6,7 @@ require("illuminate").configure({
"avante",
"lspsagafinder",
"mason",
"neo-tree",
"snacks_picker_list",
"packer",
"starter",
},

View File

@ -1,23 +0,0 @@
require("ibl").setup({
indent = {
char = "",
tab_char = "",
},
scope = {
enabled = true,
show_start = false,
show_end = false,
},
exclude = {
filetypes = {
"help",
"mini.starter",
"neo-tree",
"Trouble",
"trouble",
"lazy",
"mason",
"notify",
},
},
})

View File

@ -1,17 +1,14 @@
require("plugins.snacks")
require("plugins.blink")
require("plugins.copilot")
require("plugins.avante")
require("plugins.telescope")
require("plugins.mini-animate")
require("plugins.mini-comment")
require("plugins.mini-pairs")
require("plugins.mini-starter")
require("plugins.mini-surround")
require("plugins.treesitter")
require("plugins.gitsigns")
require("plugins.neo-tree")
require("plugins.illuminate")
require("plugins.indentline")
require("plugins.lsp")
require("plugins.go")
require("plugins.typescript")

View File

@ -6,21 +6,15 @@ require("plugins.lsp.lsp-saga")
local win = require("lspconfig.ui.windows")
win.default_options.border = "rounded"
local signs = {
{ name = "DiagnosticSignError", text = "" },
{ name = "DiagnosticSignWarn", text = "" },
{ name = "DiagnosticSignHint", text = "" },
{ name = "DiagnosticSignInfo", text = "" },
}
for _, sign in ipairs(signs) do
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" })
end
local config = {
virtual_text = false,
signs = {
active = signs,
text = {
[vim.diagnostic.severity.ERROR] = "",
[vim.diagnostic.severity.WARN] = "",
[vim.diagnostic.severity.INFO] = "",
[vim.diagnostic.severity.HINT] = "",
},
},
update_in_insert = true,
underline = true,
@ -34,15 +28,4 @@ local config = {
prefix = "",
},
}
vim.diagnostic.config(config)
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
border = "rounded",
})
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
border = "rounded",
})
vim.diagnostic.config(config)

View File

@ -6,7 +6,7 @@ local diagnostics = {
"diagnostics",
sources = { "nvim_diagnostic" },
sections = { "error", "warn" },
symbols = { error = "", warn = "!" },
symbols = { error = "", warn = "" },
colored = false,
always_visible = true,
}
@ -84,7 +84,7 @@ require("lualine").setup({
path = 1,
cond = function()
if
vim.bo.filetype == "neo-tree"
vim.bo.filetype == "snacks_picker_list"
or vim.bo.filetype == "mason"
or vim.bo.filetype == "lazy"
or vim.bo.filetype == "help"

View File

@ -1,34 +0,0 @@
local mouse_scrolled = false
for _, scroll in ipairs({ "Up", "Down" }) do
local key = "<ScrollWheel" .. scroll .. ">"
vim.keymap.set({ "", "i" }, key, function()
mouse_scrolled = true
return key
end, { expr = true })
end
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = { "grug-far", "ministarter", "neo-tree" },
callback = function()
vim.b.minianimate_disable = true
end,
})
local animate = require("mini.animate")
animate.setup({
resize = {
timing = animate.gen_timing.linear({ duration = 50, unit = "total" }),
},
scroll = {
timing = animate.gen_timing.linear({ duration = 150, unit = "total" }),
subscroll = animate.gen_subscroll.equal({
predicate = function(total_scroll)
if mouse_scrolled then
mouse_scrolled = false
return false
end
return total_scroll > 1
end,
}),
},
})

View File

@ -1,37 +0,0 @@
local starter = require("mini.starter")
local pad = string.rep(" ", 4)
local new_section = function(name, action, section)
return { name = name, action = action, section = pad .. section }
end
local logo = table.concat({
"",
"",
"",
"",
"███╗ ██╗██╗ ██╗██╗███╗ ███╗",
"████╗ ██║██║ ██║██║████╗ ████║",
"██╔██╗██║╚██╗ ██╔╝██║██╔████╔██║",
"██║╚████║ ╚████╔╝ ██║██║╚██╔╝██║",
"██║ ╚███║ ╚██╔╝ ██║██║ ╚═╝ ██║",
"╚═╝ ╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝",
}, "\n")
starter.setup({
evaluate_single = true,
header = logo,
footer = "",
items = {
new_section("Projects", "Telescope neovim-project discover", "Telescope"),
new_section("Recent files", "Telescope oldfiles", "Telescope"),
new_section("New file", "ene | startinsert", "Built-in"),
new_section("Quit", "qa", "Built-in"),
new_section("Lazy", "Lazy", "Config"),
new_section("Mason", "Mason", "Config"),
new_section("Tree-sitter", "TSUpdate", "Config"),
},
content_hooks = {
starter.gen_hook.adding_bullet(pad .. " ", false),
starter.gen_hook.aligning("center", "top"),
},
})

View File

@ -1,69 +0,0 @@
vim.g.neo_tree_remove_legacy_commands = true
require("neo-tree").setup({
close_if_last_window = true,
auto_clean_after_session_restore = true,
open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "starter" },
popup_border_style = "rounded",
default_component_configs = {
indent = {
padding = 0,
with_expanders = false,
},
icon = {
folder_closed = "",
folder_open = "",
folder_empty = "",
default = "",
},
git_status = {
symbols = {
added = "",
deleted = "",
modified = "",
renamed = "",
untracked = "",
ignored = "",
unstaged = "",
staged = "",
conflict = "",
},
},
},
window = {
width = 40,
mappings = {
["o"] = "open",
["Z"] = "expand_all_nodes",
},
},
filesystem = {
filtered_items = {
visible = false,
hide_dotfiles = false,
hide_gitignored = false,
hide_by_name = {
"__pycache__",
".git",
},
},
follow_current_file = {
enabled = true,
},
hijack_netrw_behavior = "open_current",
use_libuv_file_watcher = true,
},
git_status = {
window = {
position = "float",
},
},
event_handlers = {
{
event = "neo_tree_buffer_enter",
handler = function(_)
vim.opt_local.signcolumn = "auto"
end,
},
},
})

View File

@ -14,7 +14,7 @@ require("neovim-project").setup({
filetype_autocmd_timeout = 0,
session_manager_opts = {
autosave_ignore_filetypes = {
"neo-tree",
"snacks_picker_list",
"trouble",
"grug-far",
"copilot-chat",

View File

@ -53,17 +53,5 @@ require("noice").setup({
},
opts = { skip = true },
},
{
view = "popup",
filter = {
find = "File larger than",
},
opts = {
size = {
width = 100,
height = 4,
},
},
},
},
})

View File

@ -0,0 +1,42 @@
require("snacks").setup({
animate = {},
bigfile = {},
explorer = {},
indent = {
indent = { char = "" },
scope = { char = "" },
},
scroll = {},
gitbrowse = {},
image = {},
dashboard = {
sections = {
{ section = "header" },
{ icon = "", desc = "Projects", action = ":Telescope neovim-project", key = "p", padding = 1 },
{ icon = "", key = "n", desc = "New File", action = ":ene | startinsert" },
{
icon = "",
desc = "Recent Files",
action = ":lua Snacks.dashboard.pick('oldfiles')",
key = "r",
},
{ icon = "", key = "q", desc = "Quit", action = ":qa", padding = 1 },
{ icon = "", title = "Config" },
{
icon = "󰒲",
desc = "Lazy",
action = ":Lazy",
enabled = package.loaded.lazy ~= nil,
key = "l",
indent = 2,
},
{ icon = "", desc = "Mason", action = ":Mason", key = "m", indent = 2 },
{ icon = "", desc = "Tree-sitter", action = ":TSUpdate", key = "t", indent = 2, padding = 2 },
{ section = "startup" },
},
},
})