infrastructure/common/hm-modules/nvim/default.nix
2025-05-05 15:04:48 +02:00

211 lines
5.3 KiB
Nix

{
config,
pkgs,
lib,
...
}:
let
cfg = config.programs.v.nvim;
in
with lib;
{
options.programs.v.nvim = {
enable = mkEnableOption "nvim";
};
config = mkIf cfg.enable {
home.packages = with pkgs; [ fd ];
home.file.".config/nvim/lua".source = ./lua;
programs.nixvim =
{ helpers, ... }:
{
enable = true;
imports = [
./keybinds.nix
./lsp.nix
];
package = pkgs.neovim-unwrapped;
vimAlias = true;
luaLoader.enable = true;
performance = {
byteCompileLua.enable = true;
combinePlugins.enable = true;
};
globals.mapleader = " ";
opts = {
number = true;
conceallevel = 2;
expandtab = true;
tabstop = 2;
shiftwidth = 2;
smartindent = true;
title = true;
spell = true;
spelllang = "en_gb";
};
clipboard.providers.wl-copy.enable = true;
extraPlugins = with pkgs.vimPlugins; [
FixCursorHold-nvim
];
extraConfigLua = "";
colorschemes.catppuccin = {
enable = true;
settings.flavour = "frappe";
};
plugins = {
nvim-surround.enable = true;
vimwiki = {
enable = true;
settings = {
list = [
{
ext = ".md";
path = "~/cloud/Notes/";
syntax = "markdown";
}
];
};
};
image = {
enable = false;
settings.backend = "kitty";
};
web-devicons.enable = true;
bufferline.enable = true;
nix.enable = true;
luasnip.enable = true;
startup = {
enable = true;
theme = "my_theme";
};
obsidian = {
enable = false;
settings = {
new_notes_location = "notes_subdir";
notes_subdir = "Unsorted";
daily_notes = {
folder = "Diary/Daily";
};
workspaces = [
{
name = "notes";
path = "~/cloud/Notes";
}
];
completion = {
min_chars = 2;
nvim_cmp = true;
};
picker.name = "telescope.nvim";
};
};
fidget = {
enable = true;
settings = {
progress = {
ignore = [ "ltex" ];
display.done_ttl = 5;
};
notification = {
override_vim_notify = true;
};
};
};
neotest = {
enable = true;
adapters = {
plenary.enable = true;
python.enable = true;
rust = {
enable = true;
settings.args = [ "--no-capture" ];
};
};
};
treesitter = {
enable = true;
nixGrammars = true;
settings = {
highlight.enable = true;
incremental_selection.enable = true;
indent.enable = true;
};
};
# Git
fugitive.enable = true;
committia.enable = true;
gitsigns.enable = true;
lualine = {
enable = true;
settings.options.theme = "catppuccin";
};
oil = {
enable = true;
};
telescope = {
enable = true;
settings.defaults.preview.ls_short = true;
extensions.file-browser = {
enable = true;
settings = {
hijack_netrw = true;
dir_icon = "";
};
};
extensions.fzf-native.enable = true;
extensions.fzf-native.settings.fuzzy = true;
extensions.frecency.enable = true;
extensions.ui-select.enable = true;
};
comment.enable = true;
vimtex.enable = false;
typst-preview.enable = true;
floaterm.enable = true;
cmp = {
enable = true;
autoEnableSources = true;
settings = {
cmdline.":".sources = [ { name = "path"; } ];
snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
mapping = {
"<S-Tab>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
"<CR>" = "cmp.mapping.confirm({ select = true })";
"<C-Space>" = "cmp.mapping.complete()";
"<C-e>" = "cmp.mapping.close()";
};
sources = [
{ name = "nvim_lsp_signature_help"; }
{ name = "path"; }
{ name = "nvim_lsp"; }
{ name = "luasnip"; }
{
name = "buffer";
# Words from other open buffers can also be suggested.
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
}
];
};
};
};
};
};
}