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; [
|
|
|
|
coc-nvim # LSP client + autocompletion plugin
|
|
|
|
coc-tsserver # typescript LSP
|
|
|
|
coc-eslint # eslint LSP
|
|
|
|
|
|
|
|
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
|
2022-06-23 14:49:13 +03:00
|
|
|
vim-gitgutter # shows git diff markers in the sign column
|
2022-06-23 10:45:58 +03:00
|
|
|
nerdtree # tree explorer
|
|
|
|
nerdtree-git-plugin # shows files git status on the NerdTree
|
|
|
|
neoformat # formating code
|
|
|
|
nvim-treesitter # treesitter configurations and abstraction layer
|
|
|
|
];
|
|
|
|
|
|
|
|
# Additional language servers that we should install mannually
|
|
|
|
lspPackages = with pkgs; [
|
|
|
|
rnix-lsp
|
|
|
|
];
|
|
|
|
|
|
|
|
baseConfig = builtins.readFile ./config.vim;
|
|
|
|
pluginsConfig = builtins.readFile ./plugins.vim;
|
|
|
|
cocConfig = builtins.readFile ./coc.vim;
|
|
|
|
cocSettings = builtins.toJSON (import ./coc_settings.nix);
|
|
|
|
|
|
|
|
vimConfig = baseConfig + pluginsConfig + cocConfig;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.progs.nvim = {
|
|
|
|
enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Add and configure exa, a modern replacement for ls";
|
|
|
|
};
|
|
|
|
|
|
|
|
default = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Set neovim as default editor";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
home.packages = lspPackages;
|
|
|
|
|
|
|
|
programs.neovim = {
|
|
|
|
enable = true;
|
|
|
|
extraConfig = vimConfig;
|
|
|
|
plugins = myVimPlugins;
|
|
|
|
viAlias = true;
|
|
|
|
vimAlias = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
xdg.configFile = {
|
|
|
|
"nvim/coc-settings.json".text = cocSettings;
|
|
|
|
};
|
|
|
|
|
|
|
|
# home.sessionVariables = mkIf cfg.default {
|
|
|
|
# EDITOR = bin;
|
|
|
|
# };
|
|
|
|
|
|
|
|
# programs.zsh.shellAliases = mkIf config.shell.zsh.enable {
|
|
|
|
# vi = bin;
|
|
|
|
# vim = bin;
|
|
|
|
# };
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|