feat(plugins/neo-tree): refresh sources on focus
This commit is contained in:
parent
2f7dbf629f
commit
43e19eb6ad
1 changed files with 21 additions and 13 deletions
|
|
@ -202,7 +202,20 @@
|
||||||
autoGroups.neotree = { };
|
autoGroups.neotree = { };
|
||||||
|
|
||||||
# Custom autocommands (taken from AstroNvim)
|
# Custom autocommands (taken from AstroNvim)
|
||||||
autoCmd = [
|
autoCmd =
|
||||||
|
let
|
||||||
|
refresh = ''
|
||||||
|
function()
|
||||||
|
local manager_avail, manager = pcall(require, "neo-tree.sources.manager")
|
||||||
|
if manager_avail then
|
||||||
|
for _, source in ipairs { "filesystem", "git_status", "document_symbols" } do
|
||||||
|
local module = "neo-tree.sources." .. source
|
||||||
|
if package.loaded[module] then manager.refresh(require(module).name) end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
in[
|
||||||
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/neo-tree.lua#L21-L37
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/neo-tree.lua#L21-L37
|
||||||
{
|
{
|
||||||
desc = "Open explorer on startup with directory";
|
desc = "Open explorer on startup with directory";
|
||||||
|
|
@ -228,18 +241,13 @@
|
||||||
event = "TermClose";
|
event = "TermClose";
|
||||||
group = "neotree";
|
group = "neotree";
|
||||||
pattern = "*lazygit*";
|
pattern = "*lazygit*";
|
||||||
|
callback.__raw = refresh;
|
||||||
callback.__raw = ''
|
}
|
||||||
function()
|
{
|
||||||
local manager_avail, manager = pcall(require, "neo-tree.sources.manager")
|
desc = "Refresh explorer sources on focus";
|
||||||
if manager_avail then
|
event = "FocusGained";
|
||||||
for _, source in ipairs { "filesystem", "git_status", "document_symbols" } do
|
group = "neotree";
|
||||||
local module = "neo-tree.sources." .. source
|
callback.__raw = refresh;
|
||||||
if package.loaded[module] then manager.refresh(require(module).name) end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue