nix-config/modules/home/vim/default.nix

112 lines
3 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"
"lua"
2021-03-13 01:02:42 +01:00
"plugin"
];
in
{
2023-03-16 17:39:13 +01:00
options.my.home.vim = with lib; {
enable = my.mkDisableOption "vim configuration";
2021-03-13 01:02:42 +01:00
};
config.programs.neovim = lib.mkIf cfg.enable {
enable = true;
# This is the best editor
defaultEditor = true;
# All the aliases
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
plugins = with pkgs.vimPlugins; [
# Theming
gruvbox-nvim # Nice dark theme
2022-03-02 13:54:52 +01:00
lualine-nvim # A lua-based status line
lualine-lsp-progress # Show progress for LSP servers
# tpope essentials
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-unimpaired # Some ex command mappings
# Languages
rust-vim
vim-beancount
vim-jsonnet
vim-nix
vim-toml
# General enhancements
vim-qf # Better quick-fix list
2021-02-23 16:43:51 +01:00
# Other wrappers
git-messenger-vim # A simple blame window
# LSP and linting
nvim-lspconfig # Easy LSP configuration
lsp-format-nvim # Simplified formatting configuration
lsp_lines-nvim # Show diagnostics *over* regions
none-ls-nvim # LSP integration for linters and formatters
nvim-treesitter.withAllGrammars # Better highlighting
nvim-treesitter-textobjects # More textobjects
plenary-nvim # 'null-ls', 'telescope' dependency
2022-02-26 13:51:34 +01:00
2022-03-04 16:54:40 +01:00
# Completion
2023-01-20 20:15:31 +01:00
luasnip # Snippet manager compatible with LSP
friendly-snippets # LSP snippets collection
2022-03-04 16:54:40 +01:00
nvim-cmp # Completion engine
cmp-async-path # More responsive path completion
2022-03-04 16:54:40 +01:00
cmp-buffer # Words from open buffers
2022-03-04 20:22:43 +01:00
cmp-nvim-lsp # LSP suggestions
2022-03-04 16:54:40 +01:00
cmp-nvim-lua # NeoVim lua API
cmp-under-comparator # Sort items that start with '_' lower
cmp_luasnip # Snippet suggestions from LuaSnip
2022-03-04 16:54:40 +01:00
2022-02-26 13:51:34 +01:00
# UX improvements
2022-03-07 14:01:50 +01:00
dressing-nvim # Integrate native UI hooks with Telescope etc...
2022-03-03 22:14:19 +01:00
gitsigns-nvim # Fast git UI integration
nvim-surround # Deal with pairs, now in Lua
2024-07-10 22:40:36 +02:00
oil-nvim # Better alternative to NetrW
telescope-fzf-native-nvim # Use 'fzf' fuzzy matching algorithm
2022-03-08 20:57:28 +01:00
telescope-lsp-handlers-nvim # Use 'telescope' for various LSP actions
telescope-nvim # Fuzzy finder interface
2022-03-11 10:08:25 +01:00
which-key-nvim # Show available mappings
];
2021-02-23 15:39:23 +01:00
extraConfig = builtins.readFile ./init.vim;
# Linters, formatters, etc...
extraPackages = with pkgs; [
# C/C++
clang-tools
# Nix
nixpkgs-fmt
# Shell
bash-language-server
shfmt
];
};
2021-02-23 16:04:47 +01:00
2021-03-13 01:02:42 +01:00
config.xdg.configFile = lib.mkIf cfg.enable configFiles;
}