From 31c237d14939aedd987f2adf3c00e74a97596469 Mon Sep 17 00:00:00 2001 From: yavko Date: Sun, 6 Aug 2023 14:24:54 +0300 Subject: [PATCH 1/4] feat(spell): add multiple language support and vim-dirtytalk BREAKING CHANGE: `vim.spellChecking.language` is replaced with `vim.spellChecking.languages` --- flake.lock | 17 +++++++++++++++++ flake.nix | 6 ++++++ modules/basic/config.nix | 7 +++++-- modules/basic/module.nix | 11 ++++++----- 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/flake.lock b/flake.lock index 078c43f..6820ac4 100644 --- a/flake.lock +++ b/flake.lock @@ -1491,6 +1491,7 @@ "toggleterm-nvim": "toggleterm-nvim", "tokyonight": "tokyonight", "trouble": "trouble", + "vim-dirtytalk": "vim-dirtytalk", "vim-illuminate": "vim-illuminate", "vim-markdown": "vim-markdown", "vim-repeat": "vim-repeat", @@ -1788,6 +1789,22 @@ "type": "github" } }, + "vim-dirtytalk": { + "flake": false, + "locked": { + "lastModified": 1690722430, + "narHash": "sha256-kjyLwkAk6mqK7u4+zAr+Yh+zbSiukNKtXwb7t39LUco=", + "owner": "psliwka", + "repo": "vim-dirtytalk", + "rev": "a49251dce1852875951d95f7013979ece5caebf0", + "type": "github" + }, + "original": { + "owner": "psliwka", + "repo": "vim-dirtytalk", + "type": "github" + } + }, "vim-illuminate": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix index 957010b..ea91125 100644 --- a/flake.nix +++ b/flake.nix @@ -456,6 +456,12 @@ flake = false; }; + # Spellchecking + vim-dirtytalk = { + url = "github:psliwka/vim-dirtytalk"; + flake = false; + }; + # Terminal toggleterm-nvim = { url = "github:akinsho/toggleterm.nvim"; diff --git a/modules/basic/config.nix b/modules/basic/config.nix index 9329346..526285e 100644 --- a/modules/basic/config.nix +++ b/modules/basic/config.nix @@ -8,7 +8,10 @@ with builtins; let cfg = config.vim; in { config = { - vim.startPlugins = ["plenary-nvim"]; + vim.startPlugins = + if cfg.spellChecking.enableProgrammingWordList + then ["plenary-nvim" "vim-dirtytalk"] + else ["plenary-nvim"]; vim.maps.normal = mkIf cfg.disableArrows { @@ -140,7 +143,7 @@ in { ''} ${optionalString cfg.spellChecking.enable '' set spell - set spelllang=${toString cfg.spellChecking.language} + set spelllang=${builtins.concatStringsSep "," cfg.spellChecking.languages}${optionalString cfg.spellChecking.enableProgrammingWordList ",programming"} ''} ${optionalString (cfg.leaderKey != null) '' let mapleader = "${toString cfg.leaderKey}" diff --git a/modules/basic/module.nix b/modules/basic/module.nix index 1793607..ff37cf8 100644 --- a/modules/basic/module.nix +++ b/modules/basic/module.nix @@ -31,11 +31,12 @@ with builtins; { spellChecking = { enable = mkEnableOption "neovim's built-in spellchecking"; - language = mkOption { - type = types.str; - description = "The language to be used for spellchecking"; - default = "en_US"; - example = "de"; + enableProgrammingWordList = mkEnableOption "adds vim-dirtytalk, a wordlist for programmers, that includes programming words"; + languages = mkOption { + type = types.listOf types.str; + description = "The languages to be used for spellchecking"; + default = ["en_US"]; + example = ["en_US" "de"]; }; }; From 24c4a08983cc59d6f4262d7a542c4ed82f6185d7 Mon Sep 17 00:00:00 2001 From: yavko Date: Sun, 6 Aug 2023 14:26:33 +0300 Subject: [PATCH 2/4] docs(release_notes): add spellchecking change note --- docs/release-notes/rl-0.5.adoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/release-notes/rl-0.5.adoc b/docs/release-notes/rl-0.5.adoc index 5b45d11..7d7f2a0 100644 --- a/docs/release-notes/rl-0.5.adoc +++ b/docs/release-notes/rl-0.5.adoc @@ -22,6 +22,8 @@ https://github.com/yavko[yavko]: * Added Deno Language Server for javascript/typescript +* Added support for multiple languages <>, and added vim-dirtytalk <> + https://github.com/notashelf[notashelf]: * Added GitHub Copilot to completion sources. From 13416f0cdff9b06e390f55c970067945ea11e073 Mon Sep 17 00:00:00 2001 From: yavko Date: Thu, 10 Aug 2023 14:48:18 +0300 Subject: [PATCH 3/4] style(spell): apply suggestions --- modules/basic/config.nix | 5 +---- modules/basic/module.nix | 8 ++++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/modules/basic/config.nix b/modules/basic/config.nix index 526285e..f85da79 100644 --- a/modules/basic/config.nix +++ b/modules/basic/config.nix @@ -8,10 +8,7 @@ with builtins; let cfg = config.vim; in { config = { - vim.startPlugins = - if cfg.spellChecking.enableProgrammingWordList - then ["plenary-nvim" "vim-dirtytalk"] - else ["plenary-nvim"]; + vim.startPlugins = ["plenary-nvim"] ++ lib.optionals (cfg.spellChecking.enableProgrammingWordList) ["vim-dirtytalk"]; vim.maps.normal = mkIf cfg.disableArrows { diff --git a/modules/basic/module.nix b/modules/basic/module.nix index ff37cf8..553ee15 100644 --- a/modules/basic/module.nix +++ b/modules/basic/module.nix @@ -31,12 +31,12 @@ with builtins; { spellChecking = { enable = mkEnableOption "neovim's built-in spellchecking"; - enableProgrammingWordList = mkEnableOption "adds vim-dirtytalk, a wordlist for programmers, that includes programming words"; + enableProgrammingWordList = mkEnableOption "vim-dirtytalk, a wordlist for programmers, that includes programming words"; languages = mkOption { - type = types.listOf types.str; + type = with types; listOf str; description = "The languages to be used for spellchecking"; - default = ["en_US"]; - example = ["en_US" "de"]; + default = ["en"]; + example = ["en" "de"]; }; }; From 2e01bdc86cedbd03a2d47820a2420ebc0416e21b Mon Sep 17 00:00:00 2001 From: yavko Date: Thu, 10 Aug 2023 18:51:00 +0300 Subject: [PATCH 4/4] fix(spell): make dirtytalk plugin actually exist --- lib/types/plugins.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/types/plugins.nix b/lib/types/plugins.nix index 18ad20c..03251de 100644 --- a/lib/types/plugins.nix +++ b/lib/types/plugins.nix @@ -91,6 +91,7 @@ with lib; let "nvim-navbuddy" "copilot-cmp" "lsp-lines" + "vim-dirtytalk" ]; # You can either use the name of the plugin or a package. pluginType = with types;