mirror of
https://github.com/Theaninova/TheaninovOS.git
synced 2025-12-12 11:36:20 +00:00
fix: nvim tree auto save
This commit is contained in:
@@ -39,7 +39,6 @@
|
|||||||
trouble.enable = true;
|
trouble.enable = true;
|
||||||
base = {
|
base = {
|
||||||
completion.enable = true;
|
completion.enable = true;
|
||||||
|
|
||||||
diagnostics.enable = true;
|
diagnostics.enable = true;
|
||||||
find.enable = true;
|
find.enable = true;
|
||||||
formatting = {
|
formatting = {
|
||||||
|
|||||||
@@ -23,20 +23,24 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
extraConfigLua = ''
|
||||||
|
function AutoSave()
|
||||||
|
if not vim.b.${cfg.varName} and not vim.g.${cfg.varName} then
|
||||||
|
local bufnr = vim.api.nvim_get_current_buf()
|
||||||
|
local modified = vim.api.nvim_buf_get_option(bufnr, 'modified')
|
||||||
|
if modified then
|
||||||
|
vim.cmd('silent! w')
|
||||||
|
print("Auto save at " .. os.date("%H:%M:%S"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
|
||||||
autoCmd = [
|
autoCmd = [
|
||||||
{
|
{
|
||||||
event = cfg.event;
|
event = cfg.event;
|
||||||
pattern = [ "*" ];
|
pattern = [ "*" ];
|
||||||
callback = {
|
command = "lua AutoSave()";
|
||||||
__raw = ''
|
|
||||||
function()
|
|
||||||
if not vim.b.${cfg.varName} and not vim.g.${cfg.varName} then
|
|
||||||
vim.cmd('silent! w')
|
|
||||||
print("Auto save at " .. os.date("%H:%M:%S"))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -79,6 +83,12 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
neo-tree.eventHandlers.window_before_open = ''
|
||||||
|
function()
|
||||||
|
AutoSave()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
|
||||||
lualine.sections.lualine_x = lib.mkOrder 700 [
|
lualine.sections.lualine_x = lib.mkOrder 700 [
|
||||||
"(vim.g.${cfg.varName} or vim.b.${cfg.varName}) and '' or nil"
|
"(vim.g.${cfg.varName} or vim.b.${cfg.varName}) and '' or nil"
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -17,14 +17,17 @@ in
|
|||||||
plugins = {
|
plugins = {
|
||||||
neo-tree = {
|
neo-tree = {
|
||||||
enable = true;
|
enable = true;
|
||||||
filesystem.filteredItems.visible = true;
|
filesystem = {
|
||||||
eventHandlers = {
|
useLibuvFileWatcher = true;
|
||||||
file_opened = ''
|
followCurrentFile.enabled = true;
|
||||||
function()
|
filteredItems.visible = true;
|
||||||
require('neo-tree').close_all()
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
popupBorderStyle = "rounded";
|
||||||
|
eventHandlers.file_opened = ''
|
||||||
|
function()
|
||||||
|
require('neo-tree').close_all()
|
||||||
|
end
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
which-key.registrations."<leader>f".t = "Tree";
|
which-key.registrations."<leader>f".t = "Tree";
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user