mirror of
https://github.com/Theaninova/TheaninovOS.git
synced 2025-12-11 02:56:27 +00:00
Compare commits
2 Commits
2f5f6de2cd
...
3d91c3221e
| Author | SHA1 | Date | |
|---|---|---|---|
|
3d91c3221e
|
|||
|
de983e8f6d
|
@@ -5,14 +5,7 @@ in
|
||||
{
|
||||
options.presets.auto-save = {
|
||||
enable = lib.mkEnableOption "auto save";
|
||||
varName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "disable_autosave";
|
||||
};
|
||||
commandName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "AutoSaveToggle";
|
||||
};
|
||||
disableOnStart = lib.mkEnableOption "disable auto save on start";
|
||||
event = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [
|
||||
@@ -25,15 +18,18 @@ in
|
||||
config = lib.mkIf cfg.enable {
|
||||
extraConfigLua = # lua
|
||||
''
|
||||
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
|
||||
function PerformAutoSave(buf)
|
||||
buf = buf or vim.api.nvim_get_current_buf()
|
||||
|
||||
if vim.b.disable_autosave or vim.g.disable_autosave then return end
|
||||
if vim.fn.getbufvar(buf, "&modifiable") ~= 1 then return end
|
||||
if not vim.api.nvim_buf_get_option(buf, 'modified') then return end
|
||||
if vim.api.nvim_buf_get_option(buf, 'buftype') ~= "" then return end
|
||||
|
||||
vim.api.nvim_buf_call(buf, function()
|
||||
vim.cmd('silent! w')
|
||||
print("Auto save at " .. os.date("%H:%M:%S"))
|
||||
end)
|
||||
end
|
||||
'';
|
||||
|
||||
@@ -41,19 +37,22 @@ in
|
||||
{
|
||||
event = cfg.event;
|
||||
pattern = [ "*" ];
|
||||
command = "lua AutoSave()";
|
||||
callback.__raw = # lua
|
||||
"function(args) PerformAutoSave(args.buf) end";
|
||||
}
|
||||
];
|
||||
|
||||
userCommands.${cfg.commandName} = {
|
||||
globals.disable_autosave = cfg.disableOnStart;
|
||||
|
||||
userCommands.ToggleAutoSave = {
|
||||
bang = true;
|
||||
command.__raw = # lua
|
||||
''
|
||||
function(args)
|
||||
if args.bang then
|
||||
vim.b.${cfg.varName} = not vim.b.${cfg.varName}
|
||||
vim.b.disable_autosave = not vim.b.disable_autosave
|
||||
else
|
||||
vim.g.${cfg.varName} = not vim.g.${cfg.varName}
|
||||
vim.g.disable_autosave = not vim.g.disable_autosave
|
||||
end
|
||||
local lualine, lib = pcall(require, 'lualine')
|
||||
if lualine then
|
||||
@@ -68,13 +67,13 @@ in
|
||||
key = "<leader>as";
|
||||
mode = "n";
|
||||
options.silent = true;
|
||||
action = "<cmd>:${cfg.commandName}<CR>";
|
||||
action = "<cmd>:ToggleAutoSave<CR>";
|
||||
}
|
||||
{
|
||||
key = "<leader>aS";
|
||||
mode = "n";
|
||||
options.silent = true;
|
||||
action = "<cmd>:${cfg.commandName}!<CR>";
|
||||
action = "<cmd>:ToggleAutoSave!<CR>";
|
||||
}
|
||||
];
|
||||
|
||||
@@ -87,15 +86,12 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
neo-tree.eventHandlers.window_before_open = # lua
|
||||
''
|
||||
function()
|
||||
AutoSave()
|
||||
end
|
||||
'';
|
||||
/*neo-tree.eventHandlers.window_before_open = # lua
|
||||
"function() PerformAutoSave() end";*/
|
||||
|
||||
lualine.sections.lualine_x = lib.mkOrder 700 [
|
||||
"(vim.g.${cfg.varName} or vim.b.${cfg.varName}) and '' or nil"
|
||||
# lua
|
||||
"(vim.g.disable_autosave or vim.b.disable_autosave) and '' or nil"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
@@ -58,6 +58,11 @@ in
|
||||
options.silent = true;
|
||||
action = "<cmd>:LspRestart<CR>";
|
||||
}
|
||||
{
|
||||
key = "<leader>sc";
|
||||
mode = "n";
|
||||
action = ":IncRename ";
|
||||
}
|
||||
{
|
||||
key = "<leader>sn";
|
||||
mode = "n";
|
||||
@@ -74,20 +79,20 @@ in
|
||||
"<leader>sr" = "lsp_references";
|
||||
"<leader>sd" = "lsp_definitions";
|
||||
"<leader>si" = "lsp_implementations";
|
||||
"<leader>ss" = "lsp_document_symbols";
|
||||
"<leader>sw" = "lsp_workspace_symbols";
|
||||
"<leader>st" = "lsp_type_definitions";
|
||||
"<leader>sh" = "diagnostics";
|
||||
};
|
||||
};
|
||||
inc-rename.enable = true;
|
||||
which-key.registrations."<leader>s" = {
|
||||
name = "LSP";
|
||||
n = "Hover";
|
||||
r = "References";
|
||||
c = "Incremental Rename";
|
||||
R = "Restart LSP";
|
||||
d = "Definitions";
|
||||
i = "Implementations";
|
||||
s = "Document Symbols";
|
||||
w = "Workspace Symbols";
|
||||
t = "Type Definitions";
|
||||
h = "Diagnostics";
|
||||
|
||||
@@ -13,6 +13,10 @@ in
|
||||
key = "<leader>ft";
|
||||
action = "<cmd>:Neotree toggle<CR>";
|
||||
}
|
||||
{
|
||||
key = "<leader>ss";
|
||||
action = "<cmd>:Neotree document_symbols right toggle<CR>";
|
||||
}
|
||||
];
|
||||
plugins = {
|
||||
neo-tree = {
|
||||
@@ -22,15 +26,19 @@ in
|
||||
followCurrentFile.enabled = true;
|
||||
filteredItems.visible = true;
|
||||
};
|
||||
extraSources = [ "document_symbols" ];
|
||||
popupBorderStyle = "rounded";
|
||||
eventHandlers.file_opened = # lua
|
||||
eventHandlers.neo_tree_buffer_leave = # lua
|
||||
''
|
||||
function()
|
||||
require('neo-tree').close_all()
|
||||
end
|
||||
'';
|
||||
};
|
||||
which-key.registrations."<leader>f".t = "Tree";
|
||||
which-key.registrations = {
|
||||
"<leader>f".t = "Tree";
|
||||
"<leader>s".s = "Document Symbols";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -44,6 +44,9 @@ end
|
||||
|
||||
hi! Pmenu ctermbg=none guibg=none guifg={{colors.on_surface.default.hex}}
|
||||
hi! PmenuSel guibg={{colors.primary.default.hex}} guifg={{colors.on_primary.default.hex}}
|
||||
hi! PmenuThumb guifg=none guifg={{colors.primary.default.hex}}
|
||||
hi! link NormalFloat Normal
|
||||
hi! FloatBorder guifg={{colors.primary.default.hex}}
|
||||
hi! CursorColumn guibg={{colors.primary.default.hex}} guifg={{colors.on_primary.default.hex}}
|
||||
hi! CursorLine guibg={{colors.primary.default.hex}} guifg={{colors.on_primary.default.hex}}
|
||||
hi! WildMenu guibg={{colors.primary.default.hex}} guifg={{colors.on_primary.default.hex}}
|
||||
@@ -109,9 +112,9 @@ hi! NeoTreeGitConflict guifg={{colors.danger.default.hex}}
|
||||
hi! NeoTreeGitUntracked guifg={{colors.blue.default.hex}}
|
||||
|
||||
hi! NonText guifg={{colors.outline_variant.default.hex}}
|
||||
hi! LineNr guifg={{colors.outline_variant.default.hex}}
|
||||
hi! CursorLineNr guifg={{colors.on_surface.default.hex}}
|
||||
hi! SignColumn guibg=none guifg={{colors.on_surface.default.hex}}
|
||||
hi! LineNr guifg={{colors.secondary.default.hex}}
|
||||
|
||||
hi! IblScope guifg={{colors.on_surface.default.hex}}
|
||||
hi! @ibl.scope.char.1 guifg={{colors.on_surface.default.hex}}
|
||||
@@ -129,7 +132,9 @@ hi! @variable guifg={{colors.on_surface.default.hex}}
|
||||
hi! Operator guifg={{colors.on_surface.default.hex}}
|
||||
hi! Delimiter guifg={{colors.on_surface.default.hex}}
|
||||
hi! Statement gui=bold guifg={{colors.on_surface.default.hex}}
|
||||
|
||||
hi! link Operator Normal
|
||||
hi! link @punctuation.special @punctuation
|
||||
hi! @conditional.ternary guifg={{colors.on_surface.default.hex}}
|
||||
hi! link @keyword.conditional.ternary Operator
|
||||
hi! link Delimiter Normal
|
||||
@@ -140,6 +145,11 @@ hi! @lsp.mod.defaultLibrary gui=bold
|
||||
hi! @lsp.mod.readonly gui=italic
|
||||
|
||||
hi! Constant guifg={{colors.constants.default.hex}}
|
||||
hi! link @variable Constant
|
||||
hi! link @variable.parameter Identifier
|
||||
hi! link @lsp.typemod.variable.local Identifier
|
||||
hi! link @variable.python Identifier
|
||||
hi! link @variable.lua Identifier
|
||||
|
||||
hi! @property guifg={{colors.properties.default.hex}}
|
||||
hi! link @field @property
|
||||
@@ -151,9 +161,6 @@ hi! link @lsp.type.property @property
|
||||
hi! link @attribute @property
|
||||
hi! link @tag.attribute @property
|
||||
|
||||
hi! link @lsp.type.variable Constant
|
||||
hi! link @lsp.typemod.variable.local Identifier
|
||||
|
||||
hi! Keyword guifg={{colors.keywords.default.hex}}
|
||||
hi! Special guifg={{colors.keywords.default.hex}}
|
||||
hi! link Character Keyword
|
||||
@@ -165,6 +172,17 @@ hi! link Include Keyword
|
||||
hi! link Conditional Keyword
|
||||
hi! link @type.builtin Keyword
|
||||
|
||||
hi! link NotifyERRORIcon NotifyERRORBorder
|
||||
hi! link NotifyWARNIcon NotifyWARNBorder
|
||||
hi! link NotifyINFOIcon NotifyINFOBorder
|
||||
hi! link NotifyTRACEIcon NotifyTRACEBorder
|
||||
hi! link NotifyDEBUGIcon NotifyDEBUGBorder
|
||||
hi! link NotifyERRORTitle NotifyERRORBorder
|
||||
hi! link NotifyWARNTitle NotifyWARNBorder
|
||||
hi! link NotifyINFOTitle NotifyINFOBorder
|
||||
hi! link NotifyTRACETitle NotifyTRACEBorder
|
||||
hi! link NotifyDEBUGTitle NotifyDEBUGBorder
|
||||
|
||||
hi! Number guifg={{colors.numbers.default.hex}}
|
||||
hi! Function guifg={{colors.functions.default.hex}}
|
||||
|
||||
@@ -172,6 +190,11 @@ hi! Structure guifg={{colors.structures.default.hex}}
|
||||
hi! link PreProc Structure
|
||||
hi! link Tag Structure
|
||||
hi! link @attribute.typescript Structure
|
||||
hi! link @lsp.type.decorator Structure
|
||||
hi! link @lsp.type.attributeBracket Structure
|
||||
hi! link @keyword.directive.cpp PreProc
|
||||
hi! link @keyword.directive.define.cpp PreProc
|
||||
hi! link @keyword.import.cpp PreProc
|
||||
|
||||
hi! Type gui=none guifg={{colors.types.default.hex}}
|
||||
hi! link @lsp.type.interface Type
|
||||
|
||||
Reference in New Issue
Block a user