infrastructure/common/hm-modules/nvim/default.nix
Vivian 359c8534f9
Some checks are pending
Lint / lint (push) Waiting to run
update aoife
2024-11-29 20:52:57 +01:00

196 lines
5.7 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;
};
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;
dap.enable = true;
image.enable = true;
web-devicons.enable = true;
bufferline.enable = true;
nix.enable = true;
luasnip.enable = true;
typst-vim.enable = true;
startup = {
enable = true;
theme = "my_theme";
};
obsidian = {
enable = true;
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";
# note_id_func = ''
# function(title)
# -- Create note IDs in a Zettelkasten format with a timestamp and a suffix.
# -- In this case a note with the title 'My new note' will be given an ID that looks
# -- like '1657296016-my-new-note', and therefore the file name '1657296016-my-new-note.md'
# local suffix = ""
# if title ~= nil then
# -- If title is given, transform it into valid file name.
# suffix = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower()
# else
# -- If title is nil, just add 4 random uppercase letters to the suffix.
# for _ = 1, 4 do
# suffix = suffix .. string.char(math.random(65, 90))
# end
# end
# return tostring(os.time()) .. "-" .. suffix
# end
# '';
};
};
fidget = {
enable = true;
progress = {
ignoreDoneAlready = true;
ignore = [ "ltex" ];
display.doneTtl = 5;
};
notification = {
overrideVimNotify = 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;
};
fugitive.enable = true;
committia.enable = true;
lualine = {
enable = true;
settings.options.theme = "catppuccin";
};
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;
};
comment.enable = true;
vimtex.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";
}
];
};
};
};
};
};
}