Compare commits

..

No commits in common. "29cfce111171c7b0dda6557f5f2238a9ac1879db" and "21bba2e8fd8012061f43a629a2b2585cc6a8944a" have entirely different histories.

6 changed files with 94 additions and 65 deletions

View File

@ -26,8 +26,6 @@ in
config.nix = { config.nix = {
package = pkgs.nix-super; package = pkgs.nix-super;
extraOptions = "experimental-features = nix-command flakes";
gc = { gc = {
automatic = cfg.gc.enable; automatic = cfg.gc.enable;
options = "--max-freed ${cfg.gc.minimumFreedGB} --delete-older-than 14d"; options = "--max-freed ${cfg.gc.minimumFreedGB} --delete-older-than 14d";

View File

@ -9,10 +9,7 @@ let
cfg = config.my.programs.nvim; cfg = config.my.programs.nvim;
boolToString = bool: if bool then "true" else "false"; boolToString = bool: if bool then "true" else "false";
quote = str: ''"${toString str}"''; quote = str: ''"${toString str}"'';
id = x: x; listToString = list: ''{ ${concatStringsSep ", " (map quote list)} }'';
listToString = sep: f: list: ''{ ${concatStringsSep sep (map f list)} }'';
listToStringOneLine = listToString ", ";
listToStringMultiLine = listToString ",\n";
keybinding = keybinding =
{ key { key
, cmd , cmd
@ -45,23 +42,31 @@ let
, priority , priority
, keys , keys
}: }:
listToStringMultiLine id ''
([ {
"dir = ${quote plugin}" dir = "${plugin}",
"name = ${quote plugin.name}" name = "${plugin.name}",
"lazy = ${boolToString lazy}" lazy = ${boolToString lazy},
] enabled = ${boolToString enabled},
++ (optional (!enabled) "enabled = ${boolToString enabled}") dependencies = { ${concatStringsSep ", " (map lazySpecFromPlugin dependencies)} },
++ (optional (dependencies != [ ]) "dependencies = ${listToStringMultiLine id (map lazySpecFromPlugin dependencies)}") ${optionalString (init != null)
++ (optional (init != null) "init = function(plugin)\n${toString init}\nend") "init = function(plugin)
++ (optional (conf != null) "config = function(plugin, opts)\n${toString conf}\nend") ${toString init}
++ (optional (keys != [ ]) "keys = ${listToStringMultiLine id (map keybinding keys)}") end,"
++ (optional (event != [ ]) "event = ${listToStringOneLine quote event}") }
++ (optional (cmd != [ ]) "cmd = ${listToStringOneLine quote cmd}") ${optionalString (conf != null)
++ (optional (ft != [ ]) "ft = ${listToStringOneLine quote ft}") "config = function(plugin, opts)
++ (optional (priority != 50) "priority = ${toString priority}") ${toString conf}
); end,"
lazySpecs = listToStringMultiLine id (map lazySpecFromPlugin cfg.plugins); }
keys = { ${concatStringsSep ",\n" (map keybinding keys)} },
event = ${listToString event},
cmd = ${listToString cmd},
ft = ${listToString ft},
priority = ${toString priority},
}
'';
lazySpecs = concatStringsSep ", " (map lazySpecFromPlugin cfg.plugins);
lazy = '' lazy = ''
require("lazy").setup({ require("lazy").setup({
${lazySpecs} ${lazySpecs}
@ -112,7 +117,7 @@ in
}; };
lazy = mkOption { lazy = mkOption {
type = bool; type = bool;
default = true; default = false;
description = '' description = ''
Whether to load the plugin lazily. Whether to load the plugin lazily.
''; '';

View File

@ -5,46 +5,42 @@ with builtins;
config.my.programs.nvim.plugins = with pkgs.vimPlugins; [ config.my.programs.nvim.plugins = with pkgs.vimPlugins; [
{ {
plugin = which-key-nvim; plugin = which-key-nvim;
lazy = false;
conf = readFile ./which-key-nvim.lua; conf = readFile ./which-key-nvim.lua;
} }
{ {
plugin = catppuccin-nvim; plugin = catppuccin-nvim;
conf = readFile ./catppuccin-nvim.lua; conf = readFile ./catppuccin-nvim.lua;
lazy = false;
priority = 99; priority = 99;
} }
{ {
plugin = formatter-nvim; plugin = formatter-nvim;
lazy = true;
keys = [ keys = [
{ key = "="; cmd = "<cmd>Format<cr>"; desc = "format (formatter)"; } { key = "="; cmd = "<cmd>Format<cr>"; desc = "format (formatter)"; }
]; ];
conf = readFile ./formatter-nvim.lua; conf = readFile ./formatter-nvim.lua;
dependencies = [{ plugin = which-key-nvim; }]; dependencies = [{ plugin = which-key-nvim; lazy = true; }];
} }
{ {
plugin = oil-nvim; plugin = oil-nvim;
lazy = false;
conf = readFile ./oil-nvim.lua; conf = readFile ./oil-nvim.lua;
dependencies = [ dependencies = [
{ plugin = which-key-nvim; } { plugin = which-key-nvim; lazy = true; }
{ plugin = nvim-web-devicons; } { plugin = nvim-web-devicons; lazy = true; }
]; ];
} }
{ plugin = nvim-ts-context-commentstring; }
{ {
plugin = mini-nvim; plugin = mini-nvim;
lazy = false;
conf = readFile ./mini-nvim.lua; conf = readFile ./mini-nvim.lua;
} }
{ {
plugin = noice-nvim; plugin = noice-nvim;
lazy = false;
conf = readFile ./noice-nvim.lua; conf = readFile ./noice-nvim.lua;
dependencies = [{ plugin = nui-nvim; }]; dependencies = [{ plugin = nui-nvim; lazy = true; }];
} }
{ {
plugin = trouble-nvim; plugin = trouble-nvim;
lazy = true;
keys = [ keys = [
{ key = "<leader>xx"; cmd = "<cmd>TroubleToggle document_diagnostics<cr>"; desc = "Document Diagnostics (Trouble)"; } { key = "<leader>xx"; cmd = "<cmd>TroubleToggle document_diagnostics<cr>"; desc = "Document Diagnostics (Trouble)"; }
{ key = "<leader>xX"; cmd = "<cmd>TroubleToggle workspace_diagnostics<cr>"; desc = "Workspace Diagnostics (Troule)"; } { key = "<leader>xX"; cmd = "<cmd>TroubleToggle workspace_diagnostics<cr>"; desc = "Workspace Diagnostics (Troule)"; }
@ -79,12 +75,13 @@ with builtins;
conf = readFile ./trouble-nvim.lua; conf = readFile ./trouble-nvim.lua;
dependencies = [ dependencies = [
{ plugin = which-key-nvim; } { plugin = which-key-nvim; }
{ plugin = nvim-web-devicons; } { plugin = nvim-web-devicons; lazy = true; }
]; ];
} }
{ {
plugin = nvim-cmp; plugin = nvim-cmp;
conf = readFile ./nvim-cmp.lua; conf = readFile ./nvim-cmp.lua;
lazy = true;
event = [ "InsertEnter" ]; event = [ "InsertEnter" ];
dependencies = [ dependencies = [
{ plugin = cmp-async-path; } { plugin = cmp-async-path; }
@ -101,94 +98,131 @@ with builtins;
]; ];
} }
{ plugin = friendly-snippets; } { plugin = friendly-snippets; }
{ plugin = luasnip; } { plugin = luasnip; lazy = true; }
]; ];
} }
{ {
plugin = todo-comments-nvim; plugin = todo-comments-nvim;
lazy = true;
event = [ "BufReadPost" "BufNewFile" ]; event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./todo-comments-nvim.lua; conf = readFile ./todo-comments-nvim.lua;
dependencies = [{ plugin = plenary-nvim; }]; dependencies = [{ plugin = plenary-nvim; lazy = true; }];
} }
{ {
plugin = direnv-vim; plugin = direnv-vim;
lazy = false;
} }
{ {
plugin = nvim-treesitter.withAllGrammars; plugin = nvim-treesitter.withAllGrammars;
lazy = true;
event = [ "BufReadPost" "BufNewFile" ]; event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./nvim-treesitter.lua; conf = readFile ./nvim-treesitter.lua;
dependencies = [ dependencies = [
{ plugin = nvim-ts-context-commentstring; }
{ {
plugin = orgmode; plugin = orgmode;
lazy = true;
conf = readFile ./orgmode.lua; conf = readFile ./orgmode.lua;
} }
]; ];
} }
{ {
plugin = nvim-lspconfig; plugin = nvim-lspconfig;
lazy = true;
event = [ "BufReadPre" "BufNewFile" ]; event = [ "BufReadPre" "BufNewFile" ];
conf = readFile ./nvim-lspconfig.lua; conf = readFile ./nvim-lspconfig.lua;
dependencies = [ dependencies = [
{ {
plugin = null-ls-nvim; plugin = null-ls-nvim;
lazy = true;
conf = readFile ./null-ls-nvim.lua; conf = readFile ./null-ls-nvim.lua;
dependencies = [ dependencies = [
{ plugin = which-key-nvim; } { plugin = which-key-nvim; lazy = true; }
{ plugin = plenary-nvim; } { plugin = plenary-nvim; lazy = true; }
]; ];
} }
{ plugin = which-key-nvim; } {
{ plugin = lspkind-nvim; } plugin = which-key-nvim;
{ plugin = lsp_lines-nvim; } lazy = true;
}
{
plugin = lspkind-nvim;
lazy = true;
}
{
plugin = lsp_lines-nvim;
lazy = true;
}
{ {
plugin = lspsaga-nvim-original; plugin = lspsaga-nvim-original;
lazy = true;
dependencies = [ dependencies = [
{ plugin = nvim-web-devicons; } { plugin = nvim-web-devicons; lazy = true; }
{ plugin = nvim-treesitter.withAllGrammars; } { plugin = nvim-treesitter.withAllGrammars; lazy = true; }
]; ];
} }
{ {
plugin = nvim-ufo; plugin = nvim-ufo;
lazy = true;
dependencies = [ dependencies = [
{ plugin = promise-async; } { plugin = promise-async; lazy = true; }
]; ];
} }
]; ];
} }
{ {
event = [ "VeryLazy" ]; event = [ "VeryLazy" ];
lazy = true;
plugin = vim-fugitive; plugin = vim-fugitive;
} }
{ {
plugin = vim-tmux-navigator; plugin = vim-tmux-navigator;
lazy = false;
} }
{ {
plugin = gitsigns-nvim; plugin = gitsigns-nvim;
lazy = true;
event = [ "BufReadPost" "BufNewFile" ]; event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./gitsigns-nvim.lua; conf = readFile ./gitsigns-nvim.lua;
dependencies = [{ plugin = which-key-nvim; }]; dependencies = [{ plugin = which-key-nvim; }];
} }
{ {
plugin = nvim-lastplace; plugin = nvim-lastplace;
lazy = true;
event = [ "BufReadPost" "BufNewFile" ]; event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./nvim-lastplace.lua; conf = readFile ./nvim-lastplace.lua;
} }
{ {
plugin = nvim-treesitter-textsubjects; plugin = nvim-treesitter-textsubjects;
lazy = true;
event = [ "BufReadPost" "BufNewFile" ]; event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./nvim-treesitter-textsubjects.lua; conf = readFile ./nvim-treesitter-textsubjects.lua;
dependencies = [
{
plugin = nvim-treesitter.withAllGrammars;
lazy = true;
}
];
}
{
plugin = nvim-ts-context-commentstring;
lazy = true;
event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./nvim-ts-context-commentstring.lua;
dependencies = [
{
plugin = nvim-treesitter.withAllGrammars;
lazy = true;
}
];
} }
{ {
plugin = smartcolumn-nvim; plugin = smartcolumn-nvim;
lazy = true;
event = [ "BufReadPost" "BufNewFile" ]; event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./smartcolumn-nvim.lua; conf = readFile ./smartcolumn-nvim.lua;
} }
{ {
plugin = telescope-fzf-native-nvim; plugin = telescope-fzf-native-nvim;
conf = readFile ./telescope-fzf-native-nvim.lua; conf = readFile ./telescope-fzf-native-nvim.lua;
lazy = true;
keys = [ keys = [
{ key = "<leader>ff"; cmd = "<cmd>Telescope find_files<cr>"; desc = "Find files"; } { key = "<leader>ff"; cmd = "<cmd>Telescope find_files<cr>"; desc = "Find files"; }
{ key = "<leader>fb"; cmd = "<cmd>Telescope buffers<cr>"; desc = "Find buffers"; } { key = "<leader>fb"; cmd = "<cmd>Telescope buffers<cr>"; desc = "Find buffers"; }
@ -208,17 +242,13 @@ with builtins;
dependencies = [ dependencies = [
{ {
plugin = telescope-nvim; plugin = telescope-nvim;
lazy = true;
dependencies = [ dependencies = [
{ plugin = plenary-nvim; } { plugin = plenary-nvim; lazy = true; }
{ plugin = which-key-nvim; } { plugin = which-key-nvim; lazy = true; }
]; ];
} }
]; ];
} }
{
plugin = vim-startuptime;
cmd = [ "StartupTime" ];
conf = readFile ./vim-startuptime.lua;
}
]; ];
} }

View File

@ -1,11 +1,5 @@
require("mini.align").setup() require("mini.align").setup()
require("mini.comment").setup({ require("mini.comment").setup()
options = {
custom_commentstring = function()
return require("ts_context_commentstring.internal").calculate_commentstring() or vim.bo.commentstring
end,
},
})
require("mini.surround").setup() require("mini.surround").setup()
require("mini.move").setup() require("mini.move").setup()
require("mini.pairs").setup() require("mini.pairs").setup()

View File

@ -9,7 +9,4 @@ require("nvim-treesitter.configs").setup({
-- code block highlights that do not have ts grammar -- code block highlights that do not have ts grammar
additional_vim_regex_highlighting = { "org" }, additional_vim_regex_highlighting = { "org" },
}, },
context_commentstring = {
enable = true,
},
}) })

View File

@ -0,0 +1,5 @@
require("nvim-treesitter.configs").setup({
context_commentstring = {
enable = true,
},
})