2021-03-13 01:02:42 +01:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.my.home.vim;
|
|
|
|
configFiles =
|
|
|
|
let
|
|
|
|
toSource = directory: { source = ./. + "/${directory}"; };
|
|
|
|
configureDirectory =
|
|
|
|
name: lib.nameValuePair "nvim/${name}" (toSource name);
|
|
|
|
linkDirectories =
|
|
|
|
dirs: builtins.listToAttrs (map configureDirectory dirs);
|
|
|
|
in
|
|
|
|
linkDirectories [
|
|
|
|
"after"
|
|
|
|
"autoload"
|
|
|
|
"ftdetect"
|
2022-02-28 11:31:26 +01:00
|
|
|
"lua"
|
2021-03-13 01:02:42 +01:00
|
|
|
"plugin"
|
|
|
|
];
|
|
|
|
in
|
2021-02-22 14:44:22 +01:00
|
|
|
{
|
2021-03-13 01:02:42 +01:00
|
|
|
options.my.home.vim = with lib.my; {
|
|
|
|
enable = mkDisableOption "vim configuration";
|
|
|
|
};
|
|
|
|
|
|
|
|
config.programs.neovim = lib.mkIf cfg.enable {
|
2021-02-22 14:44:22 +01:00
|
|
|
enable = true;
|
|
|
|
# All the aliases
|
|
|
|
viAlias = true;
|
|
|
|
vimAlias = true;
|
|
|
|
vimdiffAlias = true;
|
|
|
|
|
|
|
|
plugins = with pkgs.vimPlugins; [
|
2021-02-23 15:30:50 +01:00
|
|
|
# Theming
|
|
|
|
lightline-vim # Fancy status bar
|
2021-09-29 18:43:37 +02:00
|
|
|
vim-gruvbox8 # Nice dark theme
|
2021-02-23 15:30:50 +01:00
|
|
|
|
|
|
|
# tpope essentials
|
|
|
|
vim-commentary # Easy comments
|
|
|
|
vim-eunuch # UNIX integrations
|
2021-02-23 16:43:51 +01:00
|
|
|
vim-fugitive # A 'git' wrapper
|
2021-02-23 15:30:50 +01:00
|
|
|
vim-git # Sane git syntax files
|
|
|
|
vim-repeat # Enanche '.' for plugins
|
|
|
|
vim-rsi # Readline mappings
|
|
|
|
vim-surround # Deal with pairs
|
|
|
|
vim-unimpaired # Some ex command mappings
|
|
|
|
vim-vinegar # Better netrw
|
|
|
|
|
|
|
|
# Languages
|
|
|
|
rust-vim
|
|
|
|
vim-beancount
|
|
|
|
vim-jsonnet
|
2021-02-22 14:44:22 +01:00
|
|
|
vim-nix
|
2021-02-23 15:30:50 +01:00
|
|
|
vim-pandoc
|
|
|
|
vim-pandoc-syntax
|
|
|
|
vim-toml
|
|
|
|
|
|
|
|
# General enhancements
|
|
|
|
fastfold # Better folding
|
|
|
|
vim-qf # Better quick-fix list
|
|
|
|
|
2021-02-23 16:43:51 +01:00
|
|
|
# Other wrappers
|
|
|
|
fzfWrapper # The vim plugin inside the 'fzf' package
|
|
|
|
fzf-vim # Fuzzy commands
|
|
|
|
git-messenger-vim # A simple blame window
|
|
|
|
|
2021-02-23 15:30:50 +01:00
|
|
|
# LSP and linting
|
2022-02-24 13:20:16 +01:00
|
|
|
lightline-lsp
|
2022-02-25 18:21:35 +01:00
|
|
|
lsp_lines-nvim # Show diagnostics *over* regions
|
2022-02-25 11:48:26 +01:00
|
|
|
null-ls-nvim # LSP integration for linters and formatters
|
2022-02-26 12:26:49 +01:00
|
|
|
(nvim-treesitter.withPlugins (_: pkgs.tree-sitter.allGrammars)) # Better highlighting
|
2022-02-26 19:28:15 +01:00
|
|
|
nvim-treesitter-textobjects # More textobjects
|
2022-02-25 11:48:26 +01:00
|
|
|
plenary-nvim # 'null-ls' dependency
|
2022-02-26 13:51:34 +01:00
|
|
|
|
|
|
|
# UX improvements
|
|
|
|
which-key-nvim # Show available mappings
|
2021-02-22 14:44:22 +01:00
|
|
|
];
|
2021-02-23 15:39:23 +01:00
|
|
|
|
|
|
|
extraConfig = builtins.readFile ./init.vim;
|
2021-02-22 14:44:22 +01:00
|
|
|
};
|
2021-02-23 16:04:47 +01:00
|
|
|
|
2021-03-13 01:02:42 +01:00
|
|
|
config.xdg.configFile = lib.mkIf cfg.enable configFiles;
|
2021-02-22 14:44:22 +01:00
|
|
|
}
|