80 lines
1.9 KiB
Nix
80 lines
1.9 KiB
Nix
{ 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-tsserver # typescript LSP
|
|
coc-eslint # eslint LSP
|
|
coc-rust-analyzer # rust 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
|
|
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
|
|
];
|
|
|
|
# Additional language servers that we should install mannually
|
|
lspPackages = with pkgs; [ rnix-lsp ];
|
|
# Additional tools
|
|
fzfToolsPackages = with pkgs; [ fzf ripgrep ];
|
|
|
|
additionalPackages = lspPackages ++ fzfToolsPackages;
|
|
|
|
vimConfig = builtins.readFile ./config.vim;
|
|
in
|
|
{
|
|
options.progs.nvim = {
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = "Add and configure neovim";
|
|
};
|
|
|
|
default = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = "Set neovim as default editor";
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
home.packages = additionalPackages;
|
|
|
|
programs.neovim = {
|
|
enable = true;
|
|
extraConfig = vimConfig;
|
|
plugins = myVimPlugins;
|
|
viAlias = true;
|
|
vimAlias = true;
|
|
coc = {
|
|
enable = true;
|
|
settings = ./coc_settings.nix;
|
|
};
|
|
};
|
|
|
|
xdg.configFile = {
|
|
"nvim/lua".source = ./lua;
|
|
};
|
|
|
|
home.sessionVariables = mkIf cfg.default {
|
|
EDITOR = "nvim";
|
|
};
|
|
};
|
|
}
|