2024-11-22 02:48:41 -05:00
|
|
|
self: {
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: let
|
2024-12-21 23:34:10 -05:00
|
|
|
inherit (lib) mkIf mkOption types;
|
|
|
|
|
|
|
|
cfg = config.programs.neovim;
|
2024-11-22 02:48:41 -05:00
|
|
|
in {
|
|
|
|
imports = [
|
2024-12-21 21:49:59 -05:00
|
|
|
./git
|
|
|
|
|
2024-11-22 02:48:41 -05:00
|
|
|
(import ./langs self)
|
2024-12-21 21:49:59 -05:00
|
|
|
(import ./theme self)
|
2024-11-22 02:48:41 -05:00
|
|
|
];
|
|
|
|
|
|
|
|
options.programs.neovim = {
|
|
|
|
user = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-12-21 23:34:10 -05:00
|
|
|
config = mkIf cfg.enable {
|
|
|
|
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;
|
2024-11-22 02:48:41 -05:00
|
|
|
|
2024-12-21 23:34:10 -05:00
|
|
|
vim.opt.number = true;
|
|
|
|
vim.opt.relativenumber = true;
|
2024-11-22 02:48:41 -05:00
|
|
|
|
2024-12-21 23:34:10 -05:00
|
|
|
vim.opt.undofile = true;
|
|
|
|
vim.opt.undodir = '${config.xdg.cacheHome}/nvim/';
|
2024-11-22 02:48:41 -05:00
|
|
|
|
2024-12-21 23:34:10 -05:00
|
|
|
-- Always show the signcolumn, otherwise it would shift
|
|
|
|
-- the text each time diagnostics appear/become resolved
|
|
|
|
vim.opt.signcolumn = 'yes';
|
2024-11-22 02:48:41 -05:00
|
|
|
|
2024-12-21 23:34:10 -05:00
|
|
|
-- remove highlight on words
|
|
|
|
vim.keymap.set('n', '<esc>', ':noh<cr><esc>', {
|
|
|
|
noremap = true,
|
|
|
|
silent = true,
|
|
|
|
});
|
2024-11-22 02:48:41 -05:00
|
|
|
|
2024-12-21 23:34:10 -05:00
|
|
|
-- https://github.com/seblj/roslyn.nvim/issues/121#issuecomment-2544076963
|
|
|
|
vim.opt.cmdheight = 2;
|
|
|
|
'';
|
2024-11-22 02:48:41 -05:00
|
|
|
|
2024-12-21 23:34:10 -05:00
|
|
|
plugins = [
|
|
|
|
pkgs.vimPlugins.fzfWrapper
|
|
|
|
pkgs.vimPlugins.fzf-vim
|
2024-11-22 02:48:41 -05:00
|
|
|
|
2024-12-21 23:34:10 -05:00
|
|
|
{
|
|
|
|
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;
|
2024-11-22 02:48:41 -05:00
|
|
|
|
2024-12-21 23:34:10 -05:00
|
|
|
require('mini.surround').setup({
|
|
|
|
custom_surroundings = {
|
|
|
|
-- Use tree-sitter to search for function call
|
|
|
|
f = {
|
|
|
|
input = ts_input({
|
|
|
|
outer = '@call.outer',
|
|
|
|
inner = '@call.inner',
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
'';
|
|
|
|
}
|
2024-11-22 02:48:41 -05:00
|
|
|
|
2024-12-21 23:34:10 -05:00
|
|
|
{
|
|
|
|
plugin = pkgs.vimPlugins.nvim-config-local;
|
|
|
|
type = "lua";
|
|
|
|
config =
|
|
|
|
# lua
|
|
|
|
''
|
|
|
|
require('config-local').setup({
|
|
|
|
config_files = { '.nvim.lua', '.nvimrc', '.exrc' },
|
2024-11-22 02:48:41 -05:00
|
|
|
|
2024-12-21 23:34:10 -05:00
|
|
|
-- Where the plugin keeps files data
|
|
|
|
hashfile = '${config.xdg.cacheHome}/nvim/config-local',
|
|
|
|
});
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2024-11-22 02:48:41 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
# For accurate stack trace
|
|
|
|
_file = ./default.nix;
|
|
|
|
}
|