nix-config/home/vim/default.nix

78 lines
1.9 KiB
Nix
Raw Normal View History

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"
"plugin"
];
in
{
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 {
enable = true;
# All the aliases
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
plugins = with pkgs.vimPlugins; [
# Theming
lightline-vim # Fancy status bar
2021-02-23 15:54:11 +01:00
{
plugin = onedark-vim; # Nice dark theme
optional = true; # Needs to be `packadd`-ed manually...
}
# tpope essentials
vim-commentary # Easy comments
vim-eunuch # UNIX integrations
2021-02-23 16:43:51 +01:00
vim-fugitive # A 'git' wrapper
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
vim-nix
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
# LSP and linting
ale # Asynchronous Linting Engine
lightline-ale # Status bar integration
];
2021-02-23 15:39:23 +01:00
extraConfig = builtins.readFile ./init.vim;
};
2021-02-23 16:04:47 +01:00
2021-03-13 01:02:42 +01:00
config.xdg.configFile = lib.mkIf cfg.enable configFiles;
}