replace nvim tree with neo tree

This commit is contained in:
Yan Lin 2026-01-25 15:04:39 +01:00
parent 168d4aa67e
commit 7ffdf5182e

View file

@ -48,14 +48,6 @@
settings = { settings = {
options = { options = {
separator_style = [ "" "" ]; # Remove gaps between tabs separator_style = [ "" "" ]; # Remove gaps between tabs
offsets = [
{
filetype = "NvimTree";
text = "File Explorer";
text_align = "left";
separator = true; # Remove separator line
}
];
}; };
}; };
}; };
@ -72,12 +64,6 @@
}; };
}; };
# File explorer
nvim-tree = {
enable = true;
# NixVim nvim-tree uses extraConfig for detailed settings
};
# Syntax highlighting # Syntax highlighting
treesitter = { treesitter = {
enable = true; enable = true;
@ -202,6 +188,30 @@
enabled = false; # Disabled by default enabled = false; # Disabled by default
}; };
}; };
neo-tree = {
enable = true;
settings = {
filesystem = {
follow_current_file = {
enabled = true;
leave_dirs_open = true;
};
filtered_items = {
hide_dotfiles = false;
hide_gitignored = false;
hide_hidden = false;
};
};
window = {
position = "float";
popup = {
size = { width = "50%"; height = "75%"; };
border = "rounded";
};
};
};
};
}; };
# Extra plugins that don't have dedicated modules # Extra plugins that don't have dedicated modules
@ -213,11 +223,11 @@
# Keymaps # Keymaps
keymaps = [ keymaps = [
# File explorer # File explorer (neo-tree)
{ {
mode = "n"; mode = "n";
key = "<leader>e"; key = "<leader>e";
action = ":NvimTreeToggle<CR>"; action = ":Neotree toggle reveal<CR>";
options = { desc = "Toggle file explorer"; }; options = { desc = "Toggle file explorer"; };
} }
@ -314,32 +324,6 @@
# Additional Lua configuration for plugins that need custom setup # Additional Lua configuration for plugins that need custom setup
extraConfigLua = '' extraConfigLua = ''
-- Nvim-tree setup with filters and auto-sync
require("nvim-tree").setup({
sync_root_with_cwd = true,
respect_buf_cwd = true,
update_focused_file = {
enable = true,
update_root = true,
ignore_list = {},
},
filters = {
dotfiles = true, -- Hide dotfiles by default (H to toggle)
git_ignored = true, -- Show gitignored files by default (I to toggle)
custom = { -- Hide macOS system files
".DS_Store",
},
},
view = {
width = 30,
side = "left",
},
renderer = {
highlight_opened_files = "all",
highlight_modified = "all",
},
})
-- Dictionary completion setup -- Dictionary completion setup
${lib.optionalString pkgs.stdenv.isDarwin '' ${lib.optionalString pkgs.stdenv.isDarwin ''
require("cmp_dictionary").setup({ require("cmp_dictionary").setup({
@ -369,7 +353,7 @@
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist, ["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
} }
} }
} },
} }
telescope.load_extension('aerial') telescope.load_extension('aerial')
@ -390,7 +374,7 @@
} }
''} ''}
-- Close all buffers except current (preserving NvimTree and other special buffers) -- Close all buffers except current (preserving special buffers)
function close_other_buffers() function close_other_buffers()
local current_buf = vim.api.nvim_get_current_buf() local current_buf = vim.api.nvim_get_current_buf()
local buffers = vim.api.nvim_list_bufs() local buffers = vim.api.nvim_list_bufs()
@ -398,11 +382,9 @@
for _, buf in ipairs(buffers) do for _, buf in ipairs(buffers) do
if buf ~= current_buf and vim.api.nvim_buf_is_valid(buf) then if buf ~= current_buf and vim.api.nvim_buf_is_valid(buf) then
local buftype = vim.api.nvim_buf_get_option(buf, 'buftype') local buftype = vim.api.nvim_buf_get_option(buf, 'buftype')
local filetype = vim.api.nvim_buf_get_option(buf, 'filetype')
-- Skip special buffers (NvimTree, terminals, quickfix, etc.) -- Skip special buffers (terminals, quickfix, etc.)
if buftype == "" and filetype ~= "NvimTree" then if buftype == "" then
-- Only delete if it's a normal file buffer
vim.api.nvim_buf_delete(buf, { force = false }) vim.api.nvim_buf_delete(buf, { force = false })
end end
end end