2022-06-23 10:45:58 +03:00
|
|
|
{ lib, config, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.progs.nvim;
|
|
|
|
|
|
|
|
customPlugins = pkgs.callPackage ./custom_plugins.nix {
|
|
|
|
inherit (pkgs.vimUtils) buildVimPlugin;
|
|
|
|
};
|
|
|
|
|
|
|
|
plugins = pkgs.vimPlugins // customPlugins;
|
|
|
|
|
|
|
|
myVimPlugins = with plugins; [
|
2022-08-29 15:40:41 +03:00
|
|
|
coc-tsserver # typescript LSP
|
|
|
|
coc-eslint # eslint LSP
|
|
|
|
coc-rust-analyzer # rust LSP
|
2022-06-23 10:45:58 +03:00
|
|
|
|
2022-08-29 15:40:41 +03:00
|
|
|
editorconfig-vim # use project .editorconfig to configure editor
|
|
|
|
lightline-vim # configurable status line
|
|
|
|
material-vim # modern theme with true colors support
|
|
|
|
vim-nix # nix support
|
|
|
|
vim-easymotion # highlights keys to move quickly
|
|
|
|
vim-gitgutter # shows git diff markers in the sign column
|
|
|
|
nerdtree # tree explorer
|
|
|
|
nerdtree-git-plugin # shows files git status on the NerdTree
|
|
|
|
neoformat # formating code
|
|
|
|
nvim-treesitter # treesitter configurations and abstraction layer
|
|
|
|
fzf-vim # fuzzy finder
|
|
|
|
blamer-nvim # A git blame plugin
|
2022-06-23 10:45:58 +03:00
|
|
|
];
|
|
|
|
|
|
|
|
# Additional language servers that we should install mannually
|
2022-06-23 23:04:59 +03:00
|
|
|
lspPackages = with pkgs; [ rnix-lsp ];
|
|
|
|
# Additional tools
|
2022-08-29 15:40:41 +03:00
|
|
|
fzfToolsPackages = with pkgs; [ fzf ripgrep ];
|
|
|
|
|
|
|
|
additionalPackages = lspPackages ++ fzfToolsPackages;
|
2022-06-23 10:45:58 +03:00
|
|
|
|
2022-08-19 11:43:01 +03:00
|
|
|
vimConfig = builtins.readFile ./config.vim;
|
2022-08-31 11:57:34 +03:00
|
|
|
cocConfig = import ./coc_settings.nix;
|
2022-06-23 10:45:58 +03:00
|
|
|
in
|
|
|
|
{
|
|
|
|
options.progs.nvim = {
|
|
|
|
enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2022-06-23 23:04:59 +03:00
|
|
|
description = "Add and configure neovim";
|
2022-06-23 10:45:58 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
default = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Set neovim as default editor";
|
|
|
|
};
|
|
|
|
};
|
2022-08-29 15:40:41 +03:00
|
|
|
|
2022-06-23 10:45:58 +03:00
|
|
|
config = mkIf cfg.enable {
|
2022-06-23 23:04:59 +03:00
|
|
|
home.packages = additionalPackages;
|
2022-08-29 15:40:41 +03:00
|
|
|
|
2022-06-23 10:45:58 +03:00
|
|
|
programs.neovim = {
|
|
|
|
enable = true;
|
|
|
|
extraConfig = vimConfig;
|
|
|
|
plugins = myVimPlugins;
|
|
|
|
viAlias = true;
|
|
|
|
vimAlias = true;
|
2022-08-19 11:43:01 +03:00
|
|
|
coc = {
|
|
|
|
enable = true;
|
2022-08-31 11:57:34 +03:00
|
|
|
settings = cocConfig;
|
2022-08-19 11:43:01 +03:00
|
|
|
};
|
2022-06-23 10:45:58 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
xdg.configFile = {
|
2022-08-18 23:41:55 +03:00
|
|
|
"nvim/lua".source = ./lua;
|
2022-06-23 10:45:58 +03:00
|
|
|
};
|
|
|
|
|
2022-06-23 23:04:59 +03:00
|
|
|
home.sessionVariables = mkIf cfg.default {
|
2022-08-29 14:11:17 +03:00
|
|
|
EDITOR = "nvim";
|
2022-06-23 23:04:59 +03:00
|
|
|
};
|
2022-06-23 10:45:58 +03:00
|
|
|
};
|
|
|
|
}
|