mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-26 15:06:45 +00:00
modules: move vim-dirtytalk to plugins/spellcheck
This commit is contained in:
parent
6011ec2bab
commit
b4384a833f
7 changed files with 48 additions and 8 deletions
|
@ -29,6 +29,8 @@ inputs: let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
vim.spellcheck.vim-dirtytalk.enable = true;
|
||||||
|
|
||||||
vim.lsp = {
|
vim.lsp = {
|
||||||
formatOnSave = true;
|
formatOnSave = true;
|
||||||
lspkind.enable = false;
|
lspkind.enable = false;
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
"rich-presence"
|
"rich-presence"
|
||||||
"session"
|
"session"
|
||||||
"snippets"
|
"snippets"
|
||||||
|
"spellcheck"
|
||||||
"statusline"
|
"statusline"
|
||||||
"tabline"
|
"tabline"
|
||||||
"terminal"
|
"terminal"
|
||||||
|
|
|
@ -5,17 +5,15 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.options) mkEnableOption literalExpression mkOption;
|
inherit (lib.options) mkEnableOption literalExpression mkOption;
|
||||||
inherit (lib.strings) concatStringsSep optionalString;
|
inherit (lib.strings) concatStringsSep;
|
||||||
inherit (lib.lists) optionals;
|
inherit (lib.lists) optionals;
|
||||||
inherit (lib.types) listOf str;
|
inherit (lib.types) listOf str;
|
||||||
inherit (lib.nvim.dag) entryAfter;
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
|
|
||||||
cfg = config.vim.spellChecking;
|
cfg = config.vim.spellChecking;
|
||||||
languages = cfg.languages ++ optionals cfg.enableProgrammingWordList ["programming"];
|
|
||||||
in {
|
in {
|
||||||
options.vim.spellChecking = {
|
options.vim.spellChecking = {
|
||||||
enable = mkEnableOption "neovim's built-in spellchecking";
|
enable = mkEnableOption "neovim's built-in spellchecking";
|
||||||
enableProgrammingWordList = mkEnableOption "vim-dirtytalk, a wordlist for programmers, that includes programming words";
|
|
||||||
languages = mkOption {
|
languages = mkOption {
|
||||||
type = listOf str;
|
type = listOf str;
|
||||||
default = ["en"];
|
default = ["en"];
|
||||||
|
@ -26,12 +24,10 @@ in {
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = optionals cfg.spellChecking.enableProgrammingWordList ["vim-dirtytalk"];
|
|
||||||
configRC.spellchecking = entryAfter ["basic"] ''
|
configRC.spellchecking = entryAfter ["basic"] ''
|
||||||
${optionalString cfg.enable ''
|
" Spellchecking
|
||||||
set spell
|
set spell
|
||||||
set spelllang=${concatStringsSep "," languages}
|
set spelllang=${concatStringsSep "," cfg.languages}
|
||||||
''}
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
5
modules/plugins/spellcheck/default.nix
Normal file
5
modules/plugins/spellcheck/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./vim-dirtytalk
|
||||||
|
];
|
||||||
|
}
|
23
modules/plugins/spellcheck/vim-dirtytalk/config.nix
Normal file
23
modules/plugins/spellcheck/vim-dirtytalk/config.nix
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
|
cfg = config.vim.spellcheck;
|
||||||
|
in {
|
||||||
|
config = mkIf cfg.vim-dirtytalk.enable {
|
||||||
|
vim = {
|
||||||
|
startPlugins = ["vim-dirtytalk"];
|
||||||
|
|
||||||
|
# vim-dirtytalk doesn't have any setup
|
||||||
|
# but we would like to append programming to spelllang
|
||||||
|
# as soon as possible while the plugin is enabled
|
||||||
|
luaConfigRC.vim-dirtytalk = entryAfter ["basic"] ''
|
||||||
|
-- append programming to spelllang
|
||||||
|
vim.opt.spelllang:append("programming")
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
6
modules/plugins/spellcheck/vim-dirtytalk/default.nix
Normal file
6
modules/plugins/spellcheck/vim-dirtytalk/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./config.nix
|
||||||
|
./vim-dirtytalk.nix
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.options) mkEnableOption;
|
||||||
|
in {
|
||||||
|
options.vim.spellcheck.vim-dirtytalk = {
|
||||||
|
enable = mkEnableOption "vim-dirtytalk, a wordlist for programmers, that includes programming words";
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue