nixos-configs/homeManagerModules/neovim/default.nix

113 lines
2.6 KiB
Nix
Raw Normal View History

self: {
config,
lib,
pkgs,
...
}: let
inherit (lib) mkOption types;
in {
imports = [
./git
(import ./langs self)
(import ./theme self)
];
options.programs.neovim = {
user = mkOption {
type = types.str;
};
enableIde = mkOption {
type = types.bool;
default = false;
};
};
config.programs.neovim = {
extraLuaConfig =
# lua
''
-- by default, the indent is 2 spaces.
vim.opt.smartindent = true;
vim.opt.expandtab = true;
vim.opt.shiftwidth = 2;
vim.opt.softtabstop = 2;
vim.opt.tabstop = 2;
vim.opt.number = true;
vim.opt.relativenumber = true;
vim.opt.undofile = true;
vim.opt.undodir = '${config.xdg.cacheHome}/nvim/';
-- Always show the signcolumn, otherwise it would shift
-- the text each time diagnostics appear/become resolved
vim.opt.signcolumn = 'yes';
-- remove highlight on words
vim.keymap.set('n', '<esc>', ':noh<cr><esc>', {
2024-12-16 17:44:17 -05:00
noremap = true,
silent = true,
});
2024-12-18 16:44:21 -05:00
-- https://github.com/seblj/roslyn.nvim/issues/121#issuecomment-2544076963
vim.opt.cmdheight = 2;
'';
plugins = [
pkgs.vimPlugins.fzfWrapper
pkgs.vimPlugins.fzf-vim
{
plugin = pkgs.vimPlugins.todo-comments-nvim;
type = "lua";
config =
# lua
''
require('todo-comments').setup();
'';
}
{
plugin = pkgs.vimPlugins.mini-nvim;
type = "lua";
config =
# lua
''
-- TODO: see how this works
local ts_input = require('mini.surround').gen_spec.input.treesitter;
require('mini.surround').setup({
custom_surroundings = {
-- Use tree-sitter to search for function call
f = {
input = ts_input({
outer = '@call.outer',
inner = '@call.inner',
});
},
},
});
'';
}
{
plugin = pkgs.vimPlugins.nvim-config-local;
type = "lua";
config =
# lua
''
require('config-local').setup({
config_files = { '.nvim.lua', '.nvimrc', '.exrc' },
-- Where the plugin keeps files data
hashfile = '${config.xdg.cacheHome}/nvim/config-local',
});
'';
}
];
};
# For accurate stack trace
_file = ./default.nix;
}