Add imperative cspell dictionary and views
- Vim views allow us to stay in the same place
- A cspell imperative dictionary lets us add words without having to rebuild
diff --git a/modules/neovim.nix b/modules/neovim.nix
index 4812584..864cee7 100644
--- a/modules/neovim.nix
+++ b/modules/neovim.nix
@@ -2,20 +2,24 @@
pkgs,
lib,
home,
+ username,
...
}: let
utils = import ../utils lib;
in {
config = {
- environment.variables = {
- EDITOR = "nvim";
+ environment = {
+ variables = {
+ EDITOR = "nvim";
+ };
+ defaultPackages = [
+ pkgs.perl
+ pkgs.rsync
+ pkgs.strace
+ pkgs.neovim
+ ]; # The basic default packages, although with nvim replacing nano
+ persistence."/nix/persist".users.${username}.directories = [".local/share/cspell"];
};
- environment.defaultPackages = [
- pkgs.perl
- pkgs.rsync
- pkgs.strace
- pkgs.neovim
- ]; # The basic default packages, although with nvim replacing nano
};
home = {
diff --git a/modules/neovim/binds/binds.vim b/modules/neovim/binds/binds.vim
index e9aeec5..85e8886 100644
--- a/modules/neovim/binds/binds.vim
+++ b/modules/neovim/binds/binds.vim
@@ -35,6 +35,7 @@
command W w
command Wq wq
call SetupCommandAlias("git","Git")
+call SetupCommandAlias("rg","Rg")
set ignorecase
set smartcase
@@ -43,3 +44,16 @@
let g:cursorhold_updatetime = 1000
autocmd CursorHoldI,CursorHold,BufLeave ?* silent! update
+
+set viewoptions-=options
+autocmd BufWinLeave ?* silent! mkview!
+
+function! s:loadViewOrUnfold()
+ try
+ loadview
+ catch
+ folddoclosed foldopen
+ endtry
+endfunction
+
+autocmd BufWinEnter ?* call s:loadViewOrUnfold()
diff --git a/modules/neovim/coc/default.nix b/modules/neovim/coc/default.nix
index c45a742..0a49dc7 100644
--- a/modules/neovim/coc/default.nix
+++ b/modules/neovim/coc/default.nix
@@ -3,6 +3,7 @@
system,
lib,
nixpkgs-minion,
+ home,
...
}: {
programs.neovim = {
@@ -11,7 +12,14 @@
settings = {
"suggest.noselect" = false;
"cSpell.checkOnlyEnabledfileTypes" = false;
- "git.enableGutters" = false; # We're using another plugin to do this
+ "cSpell.dictionaryDefinitions" = [
+ {
+ name = "imperative";
+ path = "${home.home.homeDirectory}/.local/share/cspell/dictionary.txt";
+ }
+ ];
+ "cSpell.dictionaries" = ["imperative"];
+ "git.enableGutters" = false; # We're using another plugin to do this
"rust-analyzer.serverPath" = "${pkgs.rust-analyzer}/bin/rust-analyzer";
languageserver = {
nix = {