refactor: Split plugin configurations from other.nix into separate files

This commit is contained in:
Moritz Böhme 2024-11-22 14:43:50 +01:00 committed by Moritz Böhme
parent 8cde6f4ea7
commit d3ce1b22c4
Signed by: moritz
GPG key ID: 970C6E89EB0547A9
23 changed files with 264 additions and 99 deletions

View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.comment.enable = true;
};
}

View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.crates-nvim.enable = true;
};
}

View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.direnv.enable = true;
};
}

View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.friendly-snippets.enable = true;
};
}

View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.fugitive.enable = true;
};
}

View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.gitsigns.enable = true;
};
}

View file

@ -0,0 +1,11 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.helpview.enable = true;
performance.combinePlugins.standalonePlugins = [ "helpview.nvim" ];
};
}

View file

@ -0,0 +1,11 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.hmts.enable = true;
performance.combinePlugins.standalonePlugins = [ "hmts.nvim" ];
};
}

View file

@ -0,0 +1,15 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
keymaps = [
{ key = "<esc>"; action = "<cmd>noh<cr><esc>"; options.desc = "Escape and clear hlsearch"; mode = [ "i" "n" ]; }
{ key = "<"; action = "<gv"; options.desc = "Shift left"; mode = [ "v" ]; }
{ key = ">"; action = ">gv"; options.desc = "Shift right"; mode = [ "v" ]; }
{ key = "y"; action = "ygv<esc>"; options.desc = "Yank"; mode = [ "v" ]; }
];
};
}

View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.lastplace.enable = true;
};
}

View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.markdown-preview.enable = true;
};
}

View file

@ -0,0 +1,13 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.marks = {
enable = true;
defaultMappings = false;
};
};
}

View file

@ -0,0 +1,16 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.mini = {
enable = true;
modules = {
align = { };
};
};
performance.combinePlugins.standalonePlugins = [ "mini.nvim" ];
};
}

View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.nvim-autopairs.enable = true;
};
}

View file

@ -0,0 +1,29 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.obsidian = {
enable = true;
settings = {
ui.enable = false;
dir = "~/Documents/Nextcloud/Notes/zettelkasten/";
note_id_func.__raw = ''
function(title)
if title ~= nil then
return title
else
suffix = ""
for _ = 1, 4 do
suffix = suffix .. string.char(math.random(65, 90))
end
return tostring(os.date("%Y-%m-%d")) .. "-" .. suffix
end
end
'';
};
};
};
}

View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.oil.enable = true;
};
}

View file

@ -1,99 +0,0 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz = {
programs.nixvim = lib.mkMerge [
{ plugins.which-key.enable = true; }
{ plugins.lastplace.enable = true; }
{ plugins.comment.enable = true; }
{ plugins.ts-context-commentstring.enable = true; }
{
plugins.vimtex = {
enable = true;
settings.view_method = "zathura";
};
}
{
plugins.todo-comments = {
enable = true;
keymaps.todoTelescope.key = "<leader>ft";
};
}
{
keymaps = [
{ key = "<esc>"; action = "<cmd>noh<cr><esc>"; options.desc = "Escape and clear hlsearch"; mode = [ "i" "n" ]; }
{ key = "<"; action = "<gv"; options.desc = "Shift left"; mode = [ "v" ]; }
{ key = ">"; action = ">gv"; options.desc = "Shift right"; mode = [ "v" ]; }
{ key = "y"; action = "ygv<esc>"; options.desc = "Yank"; mode = [ "v" ]; }
];
}
{ plugins.oil.enable = true; }
{ plugins.nvim-autopairs.enable = true; }
{ plugins.vim-surround.enable = true; }
# TODO: add linters
# {
# plugins.lint.enable = true;
# plugins.lint.lintersByFt = { };
# }
{
plugins.marks.enable = true;
plugins.marks.defaultMappings = false;
}
{
plugins.hmts.enable = true;
performance.combinePlugins.standalonePlugins = [ "hmts.nvim" ];
}
{ plugins.gitsigns.enable = true; }
{ plugins.fugitive.enable = true; }
{ plugins.friendly-snippets.enable = true; }
{ plugins.direnv.enable = true; }
{ plugins.crates-nvim.enable = true; }
{
plugins.helpview.enable = true;
performance.combinePlugins.standalonePlugins = [ "helpview.nvim" ];
}
{
plugins.obsidian.enable = true;
plugins.obsidian.settings = {
ui.enable = false;
dir = "~/Documents/Nextcloud/Notes/zettelkasten/";
note_id_func.__raw = ''
function(title)
if title ~= nil then
return title
else
suffix = ""
for _ = 1, 4 do
suffix = suffix .. string.char(math.random(65, 90))
end
return tostring(os.date("%Y-%m-%d")) .. "-" .. suffix
end
end
'';
};
}
{
plugins.mini = {
enable = true;
modules = {
align = { };
};
};
performance.combinePlugins.standalonePlugins = [ "mini.nvim" ];
}
{ plugins.markdown-preview.enable = true; }
{
plugins.render-markdown = {
enable = true;
settings.latex.enable = false;
};
}
];
};
}

View file

@ -0,0 +1,13 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.render-markdown = {
enable = true;
settings.latex.enable = false;
};
};
}

View file

@ -0,0 +1,13 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.todo-comments = {
enable = true;
keymaps.todoTelescope.key = "<leader>ft";
};
};
}

View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.ts-context-commentstring.enable = true;
};
}

View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.vim-surround.enable = true;
};
}

View file

@ -0,0 +1,13 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.vimtex = {
enable = true;
settings.view_method = "zathura";
};
};
}

View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.which-key.enable = true;
};
}