feat(nvim): add avante and split up plugins

use-nixvim
Moritz Böhme 2024-09-14 11:05:12 +02:00
parent 44bcf963b2
commit 1aa1714237
Signed by: moritz
GPG Key ID: 970C6E89EB0547A9
12 changed files with 419 additions and 500 deletions

View File

@ -1,21 +1,5 @@
{
"nodes": {
"actions-preview-nvim": {
"flake": false,
"locked": {
"lastModified": 1718540350,
"narHash": "sha256-lYjsv8y1fMuTGpBF/iG7cm/a7tLdh748vJhVsSp/Iz8=",
"owner": "aznhe21",
"repo": "actions-preview.nvim",
"rev": "9f52a01c374318e91337697ebed51c6fae57f8a4",
"type": "github"
},
"original": {
"owner": "aznhe21",
"repo": "actions-preview.nvim",
"type": "github"
}
},
"agenix": {
"inputs": {
"darwin": "darwin",
@ -105,19 +89,19 @@
"type": "github"
}
},
"cmp-vimtex": {
"avante-nvim": {
"flake": false,
"locked": {
"lastModified": 1722941837,
"narHash": "sha256-pD2dPdpyn5A/uwonDdAxCX138yBeDqbXDdlG/IKjVTU=",
"owner": "micangl",
"repo": "cmp-vimtex",
"rev": "5283bf9108ef33d41e704027b9ef22437ce7a15b",
"lastModified": 1725237964,
"narHash": "sha256-3jwSkCHr5iaeEIjt2lz/SQl7gbrkFiJ0FjspX6Ufa88=",
"owner": "yetone",
"repo": "avante.nvim",
"rev": "d520f0933323ba982c9665d8e4fe91000ff14e99",
"type": "github"
},
"original": {
"owner": "micangl",
"repo": "cmp-vimtex",
"owner": "yetone",
"repo": "avante.nvim",
"type": "github"
}
},
@ -374,22 +358,6 @@
"type": "github"
}
},
"gen-nvim": {
"flake": false,
"locked": {
"lastModified": 1723301200,
"narHash": "sha256-Yp7HrDMOyR929AfM7IjEz4dP3RhIx9kXZ1Z3zRr5yJg=",
"owner": "David-Kunz",
"repo": "gen.nvim",
"rev": "c9a73d8c0d462333da6d2191806ff98f2884d706",
"type": "github"
},
"original": {
"owner": "David-Kunz",
"repo": "gen.nvim",
"type": "github"
}
},
"git-hooks": {
"inputs": {
"flake-compat": "flake-compat_2",
@ -543,22 +511,6 @@
"type": "github"
}
},
"hawtkeys-nvim": {
"flake": false,
"locked": {
"lastModified": 1715069568,
"narHash": "sha256-oVpWh5pVU/OMnQ8ZRgW3iNG8I0xsLJnRBvt67yPWLQ0=",
"owner": "tris203",
"repo": "hawtkeys.nvim",
"rev": "261cc311d4abdc88decceca6dc1013faa14c56ea",
"type": "github"
},
"original": {
"owner": "tris203",
"repo": "hawtkeys.nvim",
"type": "github"
}
},
"hercules-ci-effects": {
"inputs": {
"flake-parts": "flake-parts_3",
@ -871,23 +823,6 @@
"type": "github"
}
},
"neotest-python": {
"flake": false,
"locked": {
"lastModified": 1698425037,
"narHash": "sha256-C3Dw+fl1QNYU9tg0fE52EzOqeGXxu1vq5SPmDnv2LD8=",
"owner": "MoritzBoehme",
"repo": "neotest-python",
"rev": "3c09dbafb0a1e3ac8b19eabc7157ec312cc2f2ee",
"type": "github"
},
"original": {
"owner": "MoritzBoehme",
"ref": "fix-runtimepath-search",
"repo": "neotest-python",
"type": "github"
}
},
"neovim-nightly-overlay": {
"inputs": {
"flake-compat": "flake-compat",
@ -968,21 +903,6 @@
"type": "github"
}
},
"nix-lazy-nvim": {
"locked": {
"lastModified": 1698421129,
"narHash": "sha256-pwpLc6SS3c4s6i2+MZa8y+JigFwAbFw69bwN8S1CYwQ=",
"ref": "refs/heads/main",
"rev": "408ab5cad386453e3cce8233b377fc95320e4637",
"revCount": 5,
"type": "git",
"url": "https://git.moritzboeh.me/moritz/NixLazy.nvim"
},
"original": {
"type": "git",
"url": "https://git.moritzboeh.me/moritz/NixLazy.nvim"
}
},
"nix-monitored": {
"inputs": {
"nixpkgs": [
@ -1279,22 +1199,6 @@
"type": "github"
}
},
"none-ls-shellcheck-nvim": {
"flake": false,
"locked": {
"lastModified": 1710845791,
"narHash": "sha256-t06Nu7wVEGoJtaaZh/psvuC9kdYhwh6JeOd0cg3WVHY=",
"owner": "gbprod",
"repo": "none-ls-shellcheck.nvim",
"rev": "0f84461241e76e376a95fb7391deac82dc3efdbf",
"type": "github"
},
"original": {
"owner": "gbprod",
"repo": "none-ls-shellcheck.nvim",
"type": "github"
}
},
"nur": {
"locked": {
"lastModified": 1723976478,
@ -1332,22 +1236,6 @@
"type": "github"
}
},
"nvim-lspconfig": {
"flake": false,
"locked": {
"lastModified": 1723788573,
"narHash": "sha256-y64E6q6bB0kzJzxHnOYWjCZW5tpBTzhAVs/lvpmOpU0=",
"owner": "neovim",
"repo": "nvim-lspconfig",
"rev": "a89de2e049b5f89a0ee55029d5a31213bd4de6f8",
"type": "github"
},
"original": {
"owner": "neovim",
"repo": "nvim-lspconfig",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat_5",
@ -1389,57 +1277,32 @@
},
"root": {
"inputs": {
"actions-preview-nvim": "actions-preview-nvim",
"agenix": "agenix",
"arkenfox-userjs": "arkenfox-userjs",
"asus-touchpad-numpad-driver": "asus-touchpad-numpad-driver",
"cmp-vimtex": "cmp-vimtex",
"avante-nvim": "avante-nvim",
"devshell": "devshell",
"disko": "disko",
"flake-parts": "flake-parts",
"flake-utils": "flake-utils",
"gen-nvim": "gen-nvim",
"hawtkeys-nvim": "hawtkeys-nvim",
"home-manager": "home-manager_2",
"hypr-contrib": "hypr-contrib",
"hyprland": "hyprland",
"impermanence": "impermanence",
"master": "master",
"neotest-python": "neotest-python",
"neovim-nightly-overlay": "neovim-nightly-overlay",
"nix-index-database": "nix-index-database",
"nix-lazy-nvim": "nix-lazy-nvim",
"nix-monitored": "nix-monitored",
"nix-super": "nix-super",
"nixpkgs": "nixpkgs_7",
"nixvim": "nixvim",
"none-ls-shellcheck-nvim": "none-ls-shellcheck-nvim",
"nur": "nur",
"nvim-lspconfig": "nvim-lspconfig",
"pre-commit-hooks": "pre-commit-hooks",
"river": "river",
"smartcolumn-nvim": "smartcolumn-nvim",
"stable": "stable",
"telekasten-nvim": "telekasten-nvim",
"timers": "timers"
}
},
"smartcolumn-nvim": {
"flake": false,
"locked": {
"lastModified": 1710067624,
"narHash": "sha256-DHIeDNUF9n9s14GVeojIwc5QUPwJMYYl3gRvhvO/rdE=",
"owner": "m4xshen",
"repo": "smartcolumn.nvim",
"rev": "cefb17be095ad5526030a21bb2a80553cae09127",
"type": "github"
},
"original": {
"owner": "m4xshen",
"repo": "smartcolumn.nvim",
"type": "github"
}
},
"stable": {
"locked": {
"lastModified": 1723688146,
@ -1531,22 +1394,6 @@
"type": "github"
}
},
"telekasten-nvim": {
"flake": false,
"locked": {
"lastModified": 1713773667,
"narHash": "sha256-RsxzOa9bQMKB6LRyo4Vc9hxIJGJ35NSBrLdEi2BSaBU=",
"owner": "renerocksai",
"repo": "telekasten.nvim",
"rev": "319276a7853ff996b7bb1ed4250d8047c84ad29d",
"type": "github"
},
"original": {
"owner": "renerocksai",
"repo": "telekasten.nvim",
"type": "github"
}
},
"timers": {
"inputs": {
"naersk": "naersk",

View File

@ -27,26 +27,9 @@
timers.url = "git+https://gitea.moritzboeh.me/moritz/timers.git";
# Neovim
actions-preview-nvim.flake = false;
actions-preview-nvim.url = "github:aznhe21/actions-preview.nvim";
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
nix-lazy-nvim.url = "git+https://git.moritzboeh.me/moritz/NixLazy.nvim";
nvim-lspconfig.flake = false;
nvim-lspconfig.url = "github:neovim/nvim-lspconfig";
smartcolumn-nvim.flake = false;
smartcolumn-nvim.url = "github:m4xshen/smartcolumn.nvim";
telekasten-nvim.flake = false;
telekasten-nvim.url = "github:renerocksai/telekasten.nvim";
neotest-python.flake = false;
neotest-python.url = "github:MoritzBoehme/neotest-python/fix-runtimepath-search";
gen-nvim.flake = false;
gen-nvim.url = "github:David-Kunz/gen.nvim";
hawtkeys-nvim.flake = false;
hawtkeys-nvim.url = "github:tris203/hawtkeys.nvim";
none-ls-shellcheck-nvim.flake = false;
none-ls-shellcheck-nvim.url = "github:gbprod/none-ls-shellcheck.nvim";
cmp-vimtex.flake = false;
cmp-vimtex.url = "github:micangl/cmp-vimtex";
avante-nvim.flake = false;
avante-nvim.url = "github:yetone/avante.nvim";
nixvim.url = "github:nix-community/nixvim";
nixvim.inputs.devshell.follows = "devshell";
@ -160,7 +143,6 @@
useUserPackages = true;
extraSpecialArgs = { inherit inputs self; };
sharedModules = [
inputs.nix-lazy-nvim.homeManagerModules.default
inputs.nixvim.homeManagerModules.nixvim
];
};

View File

@ -6,7 +6,7 @@ let
cfg = config.my.programs.nvim;
in
{
imports = lib.my.listModulesRec ./plugins;
imports = lib.my.listModulesRec ./new_plugins;
options.my.programs.nvim.enable = mkEnableOption "nvim";
@ -45,325 +45,22 @@ in
# ];
# };
programs.nixvim = lib.mkMerge [
{
enable = true;
package = inputs.neovim-nightly-overlay.packages.${pkgs.system}.default;
vimAlias = true;
extraConfigLuaPre = readFile ./options.lua;
performance = {
byteCompileLua = {
enable = true;
configs = true;
initLua = true;
nvimRuntime = true;
plugins = true;
};
combinePlugins.enable = true;
};
}
{
colorschemes.catppuccin = {
programs.nixvim = {
enable = true;
package = inputs.neovim-nightly-overlay.packages.${pkgs.system}.default;
vimAlias = true;
extraConfigLuaPre = readFile ./options.lua;
performance = {
byteCompileLua = {
enable = true;
settings.flavour = "macchiato";
configs = true;
initLua = true;
nvimRuntime = true;
plugins = true;
};
}
{
plugins.lualine.enable = true;
}
{
plugins.cmp = {
autoEnableSources = true;
enable = true;
settings.sources = [
{ priority = 1; name = "async_path"; }
{ priority = 1; name = "buffer"; }
{ priority = 2; name = "nvim_lsp"; }
{ priority = 3; name = "nvim_lsp_signature_help"; }
{ priority = 4; name = "luasnip"; }
{ priority = 4; name = "vimtex"; }
];
settings.mapping = {
__raw = ''
cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
elseif require("luasnip").locally_jumpable(1) then
require("luasnip").jump(1)
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select })
elseif require("luasnip").locally_jumpable(-1) then
require("luasnip").jump(-1)
else
fallback()
end
end, { "i", "s" }),
["<C-n>"] = cmp.mapping(function(fallback)
if require("luasnip").choice_active() then
require("luasnip").change_choice(1)
elseif require("luasnip").locally_jumpable(1) then
require("luasnip").jump(1)
else
fallback()
end
end, { "i", "s" }),
["<C-p>"] = cmp.mapping(function(fallback)
if require("luasnip").choice_active() then
require("luasnip").change_choice(-1)
elseif require("luasnip").locally_jumpable(-1) then
require("luasnip").jump(-1)
else
fallback()
end
end, { "i", "s" }),
})
'';
};
};
}
{
plugins.luasnip = {
enable = true;
settings = {
history = true;
update_events = "TextChanged,TextChangedI";
delete_check_events = "TextChanged";
ext_opts.__raw = ''{
[require("luasnip.util.types").choiceNode] = {
active = {
virt_text = { { "<--", "Error" } },
},
},
}'';
ft_func.__raw = ''require("luasnip.extras.filetype_functions").from_pos_or_filetype'';
};
};
}
{
plugins.lsp = {
enable = true;
inlayHints = true;
servers.nil-ls.enable = true;
servers.nixd.enable = true;
servers.nixd.extraOptions.settings.nixd = {
nixpkgs = {
expr = "import <nixpkgs> { }";
};
options = {
nixos = {
expr = ''(builtins.getFlake ("git+file://" + toString ./.)).nixosConfigurations.nixos-desktop.options'';
};
"flake-parts" = {
expr = ''(builtins.getFlake ("git+file://" + toString ./.)).debug.options'';
};
"flake-parts2" = {
expr = ''(builtins.getFlake ("git+file://" + toString ./.)).currentSystem.options'';
};
};
};
};
}
{
plugins.lspsaga = {
enable = true;
codeAction.keys.quit = "<esc>";
lightbulb.virtualText = false;
};
keymapsOnEvents = {
LspAttach = [
{
key = "<leader>cc";
action = "<cmd>Lspsaga code_action<cr>";
options.desc = "Code Action";
options.buffer = true;
}
{
key = "gd";
action = "<cmd>Lspsaga goto_definition<cr>";
options.desc = "Goto Definition";
options.buffer = true;
}
{
key = "<leader>cr";
action = "<cmd>Lspsaga rename<cr>";
options.desc = "Rename";
options.buffer = true;
}
{
key = "K";
action = "<cmd>Lspsaga hover_doc<cr>";
options.desc = "Hover";
options.buffer = true;
}
];
};
}
{
plugins.nvim-ufo.enable = true;
}
{
plugins.treesitter = {
enable = true;
folding = true;
nixvimInjections = true;
settings.indent.enable = true;
settings.highlight.enable = true;
};
performance.combinePlugins.standalonePlugins = [
"nvim-treesitter"
];
}
{ 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>fc";
};
}
{
plugins.conform-nvim = {
enable = true;
settings.formatters_by_ft = {
"*" = [ "codespell" "trim_whitespace" ];
elixir = [ "mix" ];
gleam = [ "gleam" ];
go = [ "gofmt" ];
json = [ "jq" ];
lua = [ "stylua" ];
nix.__raw = ''{ "nixpkgs_fmt", "alejandra", stop_after_first=true }'';
python.__raw = ''
function(bufnr)
return { first("ruff_organize_imports", "isort"), first("ruff_format", "black")}
end
'';
rust = [ "rustfmt" ];
sh = [ "shfmt" ];
tex = [ "latexindent" ];
toml = [ "taplo" ];
yaml = [ "yamlfix" ];
};
};
opts.formatexpr = "v:lua.require'conform'.formatexpr()";
extraConfigLuaPre = ''
---@param bufnr integer
---@param ... string
---@return string
local function first(bufnr, ...)
local conform = require("conform")
for i = 1, select("#", ...) do
local formatter = select(i, ...)
if conform.get_formatter_info(formatter, bufnr).available then
return formatter
end
end
return select(1, ...)
end
vim.api.nvim_create_user_command("Format", function(opts)
require("conform").format({ formatters = opts.fargs })
end, {
nargs = "+",
complete = function()
local formatters_by_ft = require("conform").formatters_by_ft
local names = formatters_by_ft[vim.bo.filetype] or formatters_by_ft["_"] or {}
names = vim.list_extend(names, formatters_by_ft["*"] or {})
names = vim.tbl_flatten(names)
local formatters = vim.tbl_map(require("conform").get_formatter_info, names)
formatters = vim.tbl_filter(function(formatter)
return formatter.available
end, formatters)
return vim.tbl_map(function(formatter_info)
return formatter_info.name
end, formatters)
end,
})
'';
performance.combinePlugins.standalonePlugins = [
"conform.nvim"
];
keymaps = [
{ key = "<leader>cf"; action.__raw = ''function() require("conform").format() end''; options.desc = "Format current file"; }
];
}
{
keymaps = [
{ key = "<esc>"; action = "<cmd>noh<cr><esc>"; options.desc = "Escape and clear hlsearch"; mode = [ "i" "n" ]; }
];
}
{ plugins.oil.enable = true; }
{
plugins.telescope = {
enable = true;
extensions.fzf-native.enable = true;
keymaps = {
"<leader>ff" = {
action = "find_files";
options.desc = "Find files";
};
"<leader>fb" = {
action = "buffers";
options.desc = "Find buffers";
};
"<leader>fl" = {
action = "current_buffer_fuzzy_find";
options.desc = "Search lines";
};
"<leader>fg" = {
action = "live_grep";
options.desc = "Live grep";
};
"<leader>fh" = {
action = "help_tags";
options.desc = "Help tags";
};
"<leader>fr" = {
action = "oldfiles";
options.desc = "Recent files";
};
};
};
}
{ plugins.nvim-autopairs.enable = true; }
{ plugins.surround.enable = true; }
{
plugins.lint.enable = true;
# TODO: add linters
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; }
];
combinePlugins.enable = true;
};
};
};
};
}

View File

@ -0,0 +1,15 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
colorschemes.catppuccin = {
enable = true;
settings.flavour = "macchiato";
};
};
}

View File

@ -0,0 +1,68 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.cmp = {
autoEnableSources = true;
enable = true;
settings.sources = [
{ priority = 1; name = "async_path"; }
{ priority = 1; name = "buffer"; }
{ priority = 2; name = "nvim_lsp"; }
{ priority = 3; name = "nvim_lsp_signature_help"; }
{ priority = 4; name = "luasnip"; }
{ priority = 4; name = "vimtex"; }
];
settings.mapping = {
__raw = ''
cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
elseif require("luasnip").locally_jumpable(1) then
require("luasnip").jump(1)
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select })
elseif require("luasnip").locally_jumpable(-1) then
require("luasnip").jump(-1)
else
fallback()
end
end, { "i", "s" }),
["<C-n>"] = cmp.mapping(function(fallback)
if require("luasnip").choice_active() then
require("luasnip").change_choice(1)
elseif require("luasnip").locally_jumpable(1) then
require("luasnip").jump(1)
else
fallback()
end
end, { "i", "s" }),
["<C-p>"] = cmp.mapping(function(fallback)
if require("luasnip").choice_active() then
require("luasnip").change_choice(-1)
elseif require("luasnip").locally_jumpable(-1) then
require("luasnip").jump(-1)
else
fallback()
end
end, { "i", "s" }),
})
'';
};
};
};
}

View File

@ -0,0 +1,31 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.lsp = {
enable = true;
inlayHints = true;
servers.nil-ls.enable = true;
servers.nixd.enable = true;
servers.nixd.extraOptions.settings.nixd = {
nixpkgs = {
expr = "import <nixpkgs> { }";
};
options = {
nixos = {
expr = ''(builtins.getFlake ("git+file://" + toString ./.)).nixosConfigurations.nixos-desktop.options'';
};
"flake-parts" = {
expr = ''(builtins.getFlake ("git+file://" + toString ./.)).debug.options'';
};
"flake-parts2" = {
expr = ''(builtins.getFlake ("git+file://" + toString ./.)).currentSystem.options'';
};
};
};
};
};
}

View File

@ -0,0 +1,42 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.lspsaga = {
enable = true;
codeAction.keys.quit = "<esc>";
lightbulb.virtualText = false;
};
keymapsOnEvents = {
LspAttach = [
{
key = "<leader>cc";
action = "<cmd>Lspsaga code_action<cr>";
options.desc = "Code Action";
options.buffer = true;
}
{
key = "gd";
action = "<cmd>Lspsaga goto_definition<cr>";
options.desc = "Goto Definition";
options.buffer = true;
}
{
key = "<leader>cr";
action = "<cmd>Lspsaga rename<cr>";
options.desc = "Rename";
options.buffer = true;
}
{
key = "K";
action = "<cmd>Lspsaga hover_doc<cr>";
options.desc = "Hover";
options.buffer = 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.lualine.enable = true;
};
}

View File

@ -0,0 +1,27 @@
{ config, lib, pkgs, inputs, ... }:
let
inherit (lib) mkEnableOption mkIf readFile;
in
{
home-manager.users.moritz.programs.nixvim = {
plugins.luasnip = {
enable = true;
settings = {
history = true;
update_events = "TextChanged,TextChangedI";
delete_check_events = "TextChanged";
ext_opts.__raw = ''
{
[require("luasnip.util.types").choiceNode] = {
active = {
virt_text = { { "<--", "Error" } },
},
},
}
'';
ft_func.__raw = ''require("luasnip.extras.filetype_functions").from_pos_or_filetype'';
};
};
};
}

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-ufo.enable = true;
};
}

View File

@ -0,0 +1,171 @@
{ 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>fc";
};
}
{
plugins.conform-nvim = {
enable = true;
settings.formatters_by_ft = {
"*" = [ "codespell" "trim_whitespace" ];
elixir = [ "mix" ];
gleam = [ "gleam" ];
go = [ "gofmt" ];
json = [ "jq" ];
lua = [ "stylua" ];
nix.__raw = ''{ "nixpkgs_fmt", "alejandra", stop_after_first=true }'';
python.__raw = ''
function(bufnr)
return { first("ruff_organize_imports", "isort"), first("ruff_format", "black")}
end
'';
rust = [ "rustfmt" ];
sh = [ "shfmt" ];
tex = [ "latexindent" ];
toml = [ "taplo" ];
yaml = [ "yamlfix" ];
};
};
opts.formatexpr = "v:lua.require'conform'.formatexpr()";
extraConfigLuaPre = ''
---@param bufnr integer
---@param ... string
---@return string
local function first(bufnr, ...)
local conform = require("conform")
for i = 1, select("#", ...) do
local formatter = select(i, ...)
if conform.get_formatter_info(formatter, bufnr).available then
return formatter
end
end
return select(1, ...)
end
vim.api.nvim_create_user_command("Format", function(opts)
require("conform").format({ formatters = opts.fargs })
end, {
nargs = "+",
complete = function()
local formatters_by_ft = require("conform").formatters_by_ft
local names = formatters_by_ft[vim.bo.filetype] or formatters_by_ft["_"] or {}
names = vim.list_extend(names, formatters_by_ft["*"] or {})
names = vim.tbl_flatten(names)
local formatters = vim.tbl_map(require("conform").get_formatter_info, names)
formatters = vim.tbl_filter(function(formatter)
return formatter.available
end, formatters)
return vim.tbl_map(function(formatter_info)
return formatter_info.name
end, formatters)
end,
})
'';
performance.combinePlugins.standalonePlugins = [
"conform.nvim"
];
keymaps = [
{ key = "<leader>cf"; action.__raw = ''function() require("conform").format() end''; options.desc = "Format current file"; }
];
}
{
keymaps = [
{ key = "<esc>"; action = "<cmd>noh<cr><esc>"; options.desc = "Escape and clear hlsearch"; mode = [ "i" "n" ]; }
];
}
{ plugins.oil.enable = true; }
{
plugins.telescope = {
enable = true;
extensions.fzf-native.enable = true;
keymaps = {
"<leader>ff" = {
action = "find_files";
options.desc = "Find files";
};
"<leader>fb" = {
action = "buffers";
options.desc = "Find buffers";
};
"<leader>fl" = {
action = "current_buffer_fuzzy_find";
options.desc = "Search lines";
};
"<leader>fg" = {
action = "live_grep";
options.desc = "Live grep";
};
"<leader>fh" = {
action = "help_tags";
options.desc = "Help tags";
};
"<leader>fr" = {
action = "oldfiles";
options.desc = "Recent files";
};
};
};
}
{ plugins.nvim-autopairs.enable = true; }
{ plugins.surround.enable = true; }
{
plugins.lint.enable = true;
# TODO: add linters
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; }
{
extraPlugins = [
(pkgs.vimUtils.buildVimPlugin {
pname = "avante.nvim";
src = inputs.avante-nvim;
version = lib.my.mkVersionInput inputs.avante-nvim;
})
pkgs.vimPlugins.nui-nvim
];
extraConfigLuaPost = ''
require("avante").setup({
provider = "copilot",
auto_suggestions_provider = "copilot",
})
'';
plugins.copilot-lua.enable = true;
plugins.copilot-lua.suggestion.enabled = false;
plugins.copilot-lua.panel.enabled = false;
plugins.dressing.enable = true;
performance.combinePlugins.standalonePlugins = [ "copilot.lua" ];
}
];
};
}

View File

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