2024-04-14 05:40:02 -07:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
options.neovim = {
|
|
|
|
|
enable = lib.mkEnableOption "Enables neovim";
|
2024-04-16 04:36:26 -07:00
|
|
|
languages = {
|
2024-04-17 20:59:21 -07:00
|
|
|
c.enable = lib.mkEnableOption "Enables c support";
|
2025-01-09 09:35:51 -08:00
|
|
|
go.enable = lib.mkEnableOption "Enables go support";
|
2024-04-23 23:17:10 -07:00
|
|
|
nix.enable = lib.mkEnableOption "Enables nix support";
|
|
|
|
|
rust.enable = lib.mkEnableOption "Enables rust support";
|
2025-07-01 10:44:39 -07:00
|
|
|
typescript.enable = lib.mkEnableOption "Enables typescript support";
|
2024-04-16 04:36:26 -07:00
|
|
|
};
|
2025-01-09 10:04:32 -08:00
|
|
|
themes = {
|
|
|
|
|
catppuccin.enable = lib.mkEnableOption "Enables catppuccin theme";
|
|
|
|
|
};
|
2024-04-16 04:36:26 -07:00
|
|
|
plugins = {
|
|
|
|
|
comments.enable = lib.mkEnableOption "Enables nvim-comment";
|
|
|
|
|
fugitive.enable = lib.mkEnableOption "Enables git-fugitive";
|
|
|
|
|
lualine.enable = lib.mkEnableOption "Enables lualine";
|
|
|
|
|
luasnip.enable = lib.mkEnableOption "Enables luasnip snippets";
|
|
|
|
|
nvimcmp.enable = lib.mkEnableOption "Enables nvim completion";
|
|
|
|
|
telescope = {
|
|
|
|
|
enable = lib.mkEnableOption "Enables telescope";
|
|
|
|
|
fzf.enable = lib.mkEnableOption "Enables telescope-fzf";
|
|
|
|
|
};
|
|
|
|
|
treesitter.enable = lib.mkEnableOption "Enables treesitter";
|
2024-04-18 00:57:36 -07:00
|
|
|
wiki.enable = lib.mkEnableOption "Enables a wiki";
|
2024-04-16 04:36:26 -07:00
|
|
|
};
|
2024-04-14 05:40:02 -07:00
|
|
|
};
|
|
|
|
|
|
2026-02-18 11:48:11 -08:00
|
|
|
# ./plugin/treesitter.nix
|
2024-04-16 04:36:26 -07:00
|
|
|
|
2024-04-14 05:40:02 -07:00
|
|
|
config = lib.mkIf config.neovim.enable {
|
|
|
|
|
home.sessionVariables = {
|
|
|
|
|
EDITOR = "nvim";
|
|
|
|
|
VISUAL = "nvim";
|
|
|
|
|
};
|
2024-04-16 04:36:26 -07:00
|
|
|
|
2026-02-18 11:48:11 -08:00
|
|
|
programs.nixvim = {
|
2024-04-14 05:40:02 -07:00
|
|
|
enable = true;
|
2024-04-16 04:36:26 -07:00
|
|
|
viAlias = true;
|
|
|
|
|
vimAlias = true;
|
|
|
|
|
vimdiffAlias = true;
|
2026-02-18 11:48:11 -08:00
|
|
|
};
|
|
|
|
|
# extraLuaConfig = ''
|
|
|
|
|
# ${builtins.readFile ./options.lua}
|
|
|
|
|
# '';
|
2026-02-18 12:36:16 -08:00
|
|
|
# vim.g.rust_recommended_style = 0
|
2026-02-18 11:48:11 -08:00
|
|
|
|
|
|
|
|
programs.nixvim.colorschemes = with config.neovim.themes; {
|
|
|
|
|
catppuccin = lib.mkIf catppuccin.enable {
|
|
|
|
|
enable = true;
|
|
|
|
|
flavour = "mocha";
|
|
|
|
|
integrations.vimwiki = lib.mkIf wiki.enable true;
|
|
|
|
|
}
|
|
|
|
|
};
|
2024-04-14 05:40:02 -07:00
|
|
|
|
2026-02-18 11:48:11 -08:00
|
|
|
programs.nixvim.plugins = with config.neovim.plugins; {
|
|
|
|
|
comment.enable = comments.enable;
|
2026-02-18 12:36:16 -08:00
|
|
|
|
2026-02-18 11:48:11 -08:00
|
|
|
fugitive.enable = fugitive.enable;
|
2026-02-18 12:36:16 -08:00
|
|
|
|
2026-02-18 11:48:11 -08:00
|
|
|
lualine = lib.mkIf lualine.enable {
|
|
|
|
|
enable = true;
|
|
|
|
|
icons_enabled = true;
|
|
|
|
|
};
|
|
|
|
|
web-devicons.enable = lualine.enable;
|
2025-07-01 10:44:39 -07:00
|
|
|
|
2026-02-18 11:48:11 -08:00
|
|
|
luasnip.enable = luasnip.enable;
|
|
|
|
|
friendly-snippets.enable = luasnip.enable;
|
2025-01-09 10:04:32 -08:00
|
|
|
|
2026-02-18 11:48:11 -08:00
|
|
|
cmp = {
|
|
|
|
|
enable = nvimcmp.enable;
|
|
|
|
|
autoEnableSources = true;
|
2026-02-18 12:36:16 -08:00
|
|
|
settings.sources = [
|
|
|
|
|
{ name = "nvim_lsp"; }
|
|
|
|
|
{ name = "path"; }
|
|
|
|
|
{ name = "buffer"; }
|
|
|
|
|
] + lib.options luasnip.enable { name = "cmp-luasnip" };
|
2026-02-18 13:12:02 -08:00
|
|
|
|
|
|
|
|
mapping = {
|
|
|
|
|
"<C-Space>" = "cmp.mapping.complete {}";
|
|
|
|
|
"<CR>" = "cmp.mapping.confirm {
|
|
|
|
|
behavior = cmp.ConfirmBehavior.Replace,
|
|
|
|
|
select = true,
|
|
|
|
|
}";
|
|
|
|
|
"<Tab>" = {
|
|
|
|
|
actions = ''
|
|
|
|
|
function(fallback)
|
|
|
|
|
if cmp.visible() then
|
|
|
|
|
cmp.select_next_item()
|
|
|
|
|
'' + lib.optionalString luasnip.enable ''
|
|
|
|
|
elseif luasnip.expand_or_locally_jumpable() then
|
|
|
|
|
luasnip.expand_or_jump()
|
|
|
|
|
'' + ''
|
|
|
|
|
else
|
|
|
|
|
fallback()
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
'';
|
|
|
|
|
modes = [ "i" "s" ];
|
|
|
|
|
};
|
|
|
|
|
"<S-Tab>" = {
|
|
|
|
|
actions = ''
|
|
|
|
|
function(fallback)
|
|
|
|
|
if cmp.visible() then
|
|
|
|
|
cmp.select_prev_item()
|
|
|
|
|
'' + lib.optionalString luasnip.enable ''
|
|
|
|
|
elseif luasnip.locally_jumpable(-1) then
|
|
|
|
|
luasnip.jump(-1)
|
|
|
|
|
'' + ''
|
|
|
|
|
else
|
|
|
|
|
fallback()
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
'';
|
|
|
|
|
modes = [ "i" "s" ];
|
|
|
|
|
};
|
|
|
|
|
};
|
2026-02-18 11:48:11 -08:00
|
|
|
};
|
|
|
|
|
|
2026-02-18 13:50:18 -08:00
|
|
|
telescope = {
|
|
|
|
|
enable = telescope.enable;
|
|
|
|
|
keymaps = [
|
|
|
|
|
{ key = "<leader>ff"; action = "find_files"; }
|
|
|
|
|
{ key = "<leader>fg"; action = "git_files"; }
|
|
|
|
|
];
|
|
|
|
|
extensions = {
|
|
|
|
|
fzf = lib.mkIf telescope.fzf.enable {
|
|
|
|
|
enable = true;
|
|
|
|
|
fuzzy = true;
|
|
|
|
|
override_generic_sorter = true;
|
|
|
|
|
override_file_sorter = true;
|
|
|
|
|
case_mode = "smart_case";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
2026-02-18 11:48:11 -08:00
|
|
|
|
2026-02-18 12:36:16 -08:00
|
|
|
treesitter.enable = treesiter.enable;
|
2026-02-18 11:48:11 -08:00
|
|
|
|
2026-02-18 12:36:16 -08:00
|
|
|
vimwiki = {
|
|
|
|
|
enable = wiki.enable;
|
|
|
|
|
list = [
|
|
|
|
|
{
|
|
|
|
|
path = "${config.xdg.userDirs.documents}/wiki";
|
|
|
|
|
links_space_char = "_";
|
|
|
|
|
ext = ".md";
|
|
|
|
|
syntax = "markdown";
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
};
|
2026-02-18 11:48:11 -08:00
|
|
|
|
2026-02-18 12:52:16 -08:00
|
|
|
programs.nixvim.plugins.nvim-lspconfig.enable = true;
|
2026-02-18 12:36:16 -08:00
|
|
|
programs.nixvim.plugins = with config.neovim.languages; {
|
|
|
|
|
nix.enable = nix.enable;
|
|
|
|
|
rustaceanvim.enable = rust.enable;
|
|
|
|
|
typsecript-tools.enable = typescript.enable;
|
|
|
|
|
};
|
|
|
|
|
programs.nixvim.lsp = {
|
|
|
|
|
enable = true;
|
|
|
|
|
servers = with config.neovim.languages; {
|
|
|
|
|
clangd.enable = c.enable;
|
|
|
|
|
gopls.enable = go.enable;
|
|
|
|
|
nil_ls.enable = nix.enable;
|
|
|
|
|
rust_analyzer.enable = rust.enable;
|
|
|
|
|
tsserver.enable = typescript.enable;
|
|
|
|
|
};
|
2026-02-18 12:52:16 -08:00
|
|
|
keymaps = [
|
|
|
|
|
{ key = "gd"; lspBufAction = "definition"; }
|
|
|
|
|
{ key = "gD"; lspBufAction = "declaration"; }
|
|
|
|
|
{ key = "gi"; lspBufAction = "implementation"; }
|
|
|
|
|
{ key = "gt"; lspBufAction = "type_definition"; }
|
|
|
|
|
{ key = "K"; lspBufAction = "hover"; }
|
|
|
|
|
] + lib.options config.neovim.plugins.telescope.enable {
|
|
|
|
|
key = "gr";
|
|
|
|
|
action = lib.nixvim.mkRaw
|
|
|
|
|
"require('telescope.builtin').lsp_references";
|
|
|
|
|
};
|
2026-02-18 12:36:16 -08:00
|
|
|
};
|
2024-04-14 05:40:02 -07:00
|
|
|
};
|
|
|
|
|
}
|