mirror of
https://github.com/Theaninova/TheaninovOS.git
synced 2025-12-12 19:46:20 +00:00
fix: nvim tree auto save
This commit is contained in:
@@ -23,20 +23,24 @@ in
|
||||
};
|
||||
|
||||
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 = [
|
||||
{
|
||||
event = cfg.event;
|
||||
pattern = [ "*" ];
|
||||
callback = {
|
||||
__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
|
||||
'';
|
||||
};
|
||||
command = "lua AutoSave()";
|
||||
}
|
||||
];
|
||||
|
||||
@@ -79,6 +83,12 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
neo-tree.eventHandlers.window_before_open = ''
|
||||
function()
|
||||
AutoSave()
|
||||
end
|
||||
'';
|
||||
|
||||
lualine.sections.lualine_x = lib.mkOrder 700 [
|
||||
"(vim.g.${cfg.varName} or vim.b.${cfg.varName}) and '' or nil"
|
||||
];
|
||||
|
||||
@@ -17,14 +17,17 @@ in
|
||||
plugins = {
|
||||
neo-tree = {
|
||||
enable = true;
|
||||
filesystem.filteredItems.visible = true;
|
||||
eventHandlers = {
|
||||
file_opened = ''
|
||||
function()
|
||||
require('neo-tree').close_all()
|
||||
end
|
||||
'';
|
||||
filesystem = {
|
||||
useLibuvFileWatcher = true;
|
||||
followCurrentFile.enabled = true;
|
||||
filteredItems.visible = true;
|
||||
};
|
||||
popupBorderStyle = "rounded";
|
||||
eventHandlers.file_opened = ''
|
||||
function()
|
||||
require('neo-tree').close_all()
|
||||
end
|
||||
'';
|
||||
};
|
||||
which-key.registrations."<leader>f".t = "Tree";
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user