2025-04-12 23:49:02 +01:00
|
|
|
-- Neo-tree is a Neovim plugin to browse the file system
|
|
|
|
|
-- https://github.com/nvim-neo-tree/neo-tree.nvim
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
'nvim-neo-tree/neo-tree.nvim',
|
|
|
|
|
version = '*',
|
|
|
|
|
dependencies = {
|
|
|
|
|
'nvim-lua/plenary.nvim',
|
|
|
|
|
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
|
|
|
|
|
'MunifTanjim/nui.nvim',
|
|
|
|
|
},
|
|
|
|
|
cmd = 'Neotree',
|
|
|
|
|
keys = {
|
|
|
|
|
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
|
|
|
|
|
},
|
2025-04-14 11:38:42 +01:00
|
|
|
|
2025-07-25 12:32:22 +01:00
|
|
|
build = function()
|
|
|
|
|
if vim.fn.executable 'fd' == 0 then
|
|
|
|
|
local install_cmd
|
|
|
|
|
if vim.fn.has 'mac' == 1 then
|
|
|
|
|
install_cmd = 'brew install fd'
|
|
|
|
|
elseif vim.fn.has 'unix' == 1 then
|
|
|
|
|
if vim.fn.filereadable '/etc/arch-release' == 1 then
|
|
|
|
|
install_cmd = 'sudo pacman -S --noconfirm fd'
|
|
|
|
|
else
|
|
|
|
|
install_cmd = 'sudo apt-get install -y fd-find'
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
vim.notify("Please install 'fd' manually for neo-tree.", vim.log.levels.WARN)
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
vim.fn.system(install_cmd)
|
|
|
|
|
end
|
|
|
|
|
end,
|
|
|
|
|
|
2025-04-14 11:38:42 +01:00
|
|
|
opts = function(_, opts)
|
|
|
|
|
local function on_move(data)
|
|
|
|
|
Snacks.rename.on_rename_file(data.source, data.destination)
|
|
|
|
|
end
|
2025-07-25 12:32:22 +01:00
|
|
|
local events = require 'neo-tree.events'
|
2025-04-14 11:38:42 +01:00
|
|
|
opts.event_handlers = opts.event_handlers or {}
|
|
|
|
|
vim.list_extend(opts.event_handlers, {
|
|
|
|
|
{ event = events.FILE_MOVED, handler = on_move },
|
|
|
|
|
{ event = events.FILE_RENAMED, handler = on_move },
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
opts.filesystem = {
|
2025-04-12 23:49:02 +01:00
|
|
|
window = {
|
|
|
|
|
mappings = {
|
|
|
|
|
['\\'] = 'close_window',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
filtered_items = {
|
|
|
|
|
hide_dotfiles = false,
|
|
|
|
|
},
|
2025-04-14 11:38:42 +01:00
|
|
|
}
|
|
|
|
|
end,
|
2025-04-12 23:49:02 +01:00
|
|
|
}
|