addet correct edit function
This commit is contained in:
parent
0000f5203c
commit
4fac477dc6
1 changed files with 68 additions and 71 deletions
|
@ -13,6 +13,21 @@ local function setup_open_file_indicators()
|
|||
end
|
||||
end
|
||||
|
||||
-- Update open_buffers initially
|
||||
update_open_buffers()
|
||||
|
||||
-- Set up autocmds to update open_buffers and refresh Neo-tree
|
||||
local group = vim.api.nvim_create_augroup("NeoTreeOpenFileIndicator", { clear = true })
|
||||
vim.api.nvim_create_autocmd({"BufAdd", "BufDelete", "BufWipeout"}, {
|
||||
group = group,
|
||||
callback = function()
|
||||
update_open_buffers()
|
||||
if package.loaded["neo-tree.sources.manager"] then
|
||||
require("neo-tree.sources.manager").refresh("filesystem")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Custom component to display open file indicator
|
||||
local function open_file_indicator(config, node, state)
|
||||
local result = require("neo-tree.sources.common.components").icon(config, node, state)
|
||||
|
@ -22,16 +37,14 @@ local function setup_open_file_indicators()
|
|||
return result
|
||||
end
|
||||
|
||||
return {
|
||||
update_open_buffers = update_open_buffers,
|
||||
open_file_indicator = open_file_indicator
|
||||
}
|
||||
return open_file_indicator
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
opts = {
|
||||
opts = function()
|
||||
return {
|
||||
sources = { "filesystem", "buffers", "git_status" },
|
||||
open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" },
|
||||
close_if_last_window = false,
|
||||
|
@ -43,7 +56,7 @@ return {
|
|||
follow_current_file = { enabled = true },
|
||||
use_libuv_file_watcher = true,
|
||||
components = {
|
||||
icon = setup_open_file_indicators().open_file_indicator,
|
||||
icon = setup_open_file_indicators(),
|
||||
},
|
||||
},
|
||||
window = {
|
||||
|
@ -82,29 +95,13 @@ return {
|
|||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
end,
|
||||
branch = "v3.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"3rd/image.nvim",
|
||||
},
|
||||
config = function(_, opts)
|
||||
local indicators = setup_open_file_indicators()
|
||||
|
||||
-- Set up autocmds to update open_buffers and refresh Neo-tree
|
||||
local group = vim.api.nvim_create_augroup("NeoTreeOpenFileIndicator", { clear = true })
|
||||
vim.api.nvim_create_autocmd({"BufAdd", "BufDelete", "BufWipeout"}, {
|
||||
group = group,
|
||||
callback = function()
|
||||
indicators.update_open_buffers()
|
||||
if package.loaded["neo-tree.sources.manager"] then
|
||||
require("neo-tree.sources.manager").refresh("filesystem")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
require("neo-tree").setup(opts)
|
||||
end,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue