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
|
|
|
{
|
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 {
|
2021-02-22 14:44:22 +01:00
|
|
|
enable = true;
|
2023-02-07 15:19:46 +01:00
|
|
|
|
|
|
|
# This is the best editor
|
|
|
|
defaultEditor = true;
|
|
|
|
|
2021-02-22 14:44:22 +01:00
|
|
|
# All the aliases
|
|
|
|
viAlias = true;
|
|
|
|
vimAlias = true;
|
|
|
|
vimdiffAlias = true;
|
|
|
|
|
|
|
|
plugins = with pkgs.vimPlugins; [
|
2021-02-23 15:30:50 +01:00
|
|
|
# Theming
|
2023-02-27 17:00:29 +01:00
|
|
|
gruvbox-nvim # Nice dark theme
|
2022-03-02 13:54:52 +01:00
|
|
|
lualine-nvim # A lua-based status line
|
2022-03-02 13:55:22 +01:00
|
|
|
lualine-lsp-progress # Show progress for LSP servers
|
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-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-toml
|
|
|
|
|
|
|
|
# General enhancements
|
|
|
|
vim-qf # Better quick-fix list
|
2023-02-12 12:36:50 +01:00
|
|
|
nvim-osc52 # Send clipboard data through terminal escape for SSH
|
2021-02-23 15:30:50 +01:00
|
|
|
|
2021-02-23 16:43:51 +01:00
|
|
|
# Other wrappers
|
|
|
|
git-messenger-vim # A simple blame window
|
|
|
|
|
2021-02-23 15:30:50 +01:00
|
|
|
# LSP and linting
|
2022-06-23 10:02:30 +02:00
|
|
|
nvim-lspconfig # Easy LSP configuration
|
2023-02-27 15:53:31 +01:00
|
|
|
lsp-format-nvim # Simplified formatting configuration
|
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
|
2023-02-08 15:03:23 +01:00
|
|
|
nvim-treesitter.withAllGrammars # Better highlighting
|
2022-02-26 19:28:15 +01:00
|
|
|
nvim-treesitter-textobjects # More textobjects
|
2022-03-07 21:10:53 +01:00
|
|
|
nvim-ts-context-commentstring # Comment string in nested language blocks
|
2022-03-07 13:05:28 +01:00
|
|
|
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
|
2023-08-07 17:37:35 +02:00
|
|
|
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
|
2022-03-07 17:49:29 +01:00
|
|
|
cmp-path # Path name suggestions
|
2022-03-07 15:27:57 +01:00
|
|
|
cmp-under-comparator # Sort items that start with '_' lower
|
2023-01-20 20:16:16 +01:00
|
|
|
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
|
2022-03-11 10:38:42 +01:00
|
|
|
nvim-notify # Better notification API
|
2022-08-31 15:50:22 +02:00
|
|
|
nvim-surround # Deal with pairs, now in Lua
|
2022-03-07 13:15:36 +01:00
|
|
|
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
|
2022-03-07 13:05:28 +01:00
|
|
|
telescope-nvim # Fuzzy finder interface
|
2022-03-11 10:08:25 +01:00
|
|
|
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;
|
2022-03-04 12:52:48 +01:00
|
|
|
|
|
|
|
# Linters, formatters, etc...
|
|
|
|
extraPackages = with pkgs; [
|
2022-03-04 12:54:50 +01:00
|
|
|
# C/C++
|
|
|
|
clang-tools
|
|
|
|
|
2022-03-04 12:52:48 +01:00
|
|
|
# Nix
|
|
|
|
nixpkgs-fmt
|
|
|
|
|
|
|
|
# Shell
|
|
|
|
shellcheck
|
|
|
|
shfmt
|
|
|
|
];
|
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
|
|
|
}
|