mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 02:11:33 +00:00
treewide: restructure modules directory; add comments to modules top-level import
This commit is contained in:
parent
6eea801cd6
commit
43263040a4
14 changed files with 218 additions and 181 deletions
|
@ -1,34 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.options) mkEnableOption literalExpression mkOption;
|
||||
inherit (lib.strings) concatStringsSep;
|
||||
inherit (lib.lists) optionals;
|
||||
inherit (lib.types) listOf str;
|
||||
inherit (lib.nvim.dag) entryAfter;
|
||||
|
||||
cfg = config.vim.spellChecking;
|
||||
in {
|
||||
options.vim.spellChecking = {
|
||||
enable = mkEnableOption "neovim's built-in spellchecking";
|
||||
languages = mkOption {
|
||||
type = listOf str;
|
||||
default = ["en"];
|
||||
example = literalExpression ''["en" "de"]'';
|
||||
description = "The languages to be used for spellchecking";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
configRC.spellchecking = entryAfter ["basic"] ''
|
||||
" Spellchecking
|
||||
set spell
|
||||
set spelllang=${concatStringsSep "," cfg.languages}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
config = {
|
||||
vim.startPlugins = ["plenary-nvim"];
|
||||
};
|
||||
}
|
|
@ -1,8 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./basic
|
||||
./init
|
||||
./mappings
|
||||
|
||||
./config.nix
|
||||
];
|
||||
}
|
||||
|
|
|
@ -145,6 +145,7 @@ in {
|
|||
default = true;
|
||||
description = "New splits will open to the right";
|
||||
};
|
||||
|
||||
enableEditorconfig = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
|
@ -167,25 +168,19 @@ in {
|
|||
config.vim.configRC.basic = entryAfter ["globalsScript"] ''
|
||||
" Settings that are set for everything
|
||||
set encoding=utf-8
|
||||
set hidden
|
||||
set shortmess+=c
|
||||
set expandtab
|
||||
set mouse=${cfg.mouseSupport}
|
||||
set tabstop=${toString cfg.tabWidth}
|
||||
set shiftwidth=${toString cfg.tabWidth}
|
||||
set softtabstop=${toString cfg.tabWidth}
|
||||
set expandtab
|
||||
set cmdheight=${toString cfg.cmdHeight}
|
||||
set updatetime=${toString cfg.updateTime}
|
||||
set shortmess+=c
|
||||
set tm=${toString cfg.mapTimeout}
|
||||
set hidden
|
||||
set cursorlineopt=${toString cfg.cursorlineOpt}
|
||||
set scrolloff=${toString cfg.scrollOffset}
|
||||
|
||||
${optionalString cfg.debugMode.enable ''
|
||||
" Debug mode settings
|
||||
set verbose=${toString cfg.debugMode.level}
|
||||
set verbosefile=${cfg.debugMode.logFile}
|
||||
''}
|
||||
|
||||
${optionalString cfg.splitBelow ''
|
||||
set splitbelow
|
||||
''}
|
50
modules/neovim/init/debug.nix
Normal file
50
modules/neovim/init/debug.nix
Normal file
|
@ -0,0 +1,50 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) path enum nullOr;
|
||||
inherit (lib.nvim.dag) entryAfter;
|
||||
|
||||
cfg = config.vim.debugMode;
|
||||
in {
|
||||
options.vim = {
|
||||
debugMode = {
|
||||
enable = mkEnableOption "debug mode";
|
||||
level = mkOption {
|
||||
type = enum [2 3 4 5 8 9 11 12 13 14 15 16];
|
||||
default = 16;
|
||||
description = ''
|
||||
Set verbosity level of Neovim while debug mode is enabled.
|
||||
|
||||
Value must be be one of the levels expected by Neovim's
|
||||
[`verbose` option](https://neovim.io/doc/user/options.html#'verbose')
|
||||
'';
|
||||
};
|
||||
|
||||
logFile = mkOption {
|
||||
type = nullOr path;
|
||||
default = null;
|
||||
description = ''
|
||||
Set the log file that will be used to store verbose messages
|
||||
set by the `verbose` option.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config.vim = mkIf cfg.enable {
|
||||
luaConfigRC.debug-mode = entryAfter ["basic"] ''
|
||||
-- Debug mode settings
|
||||
vim.o.verbose = ${toString cfg.level},
|
||||
|
||||
${optionalString (cfg.logFile != null) ''
|
||||
-- Set verbose log file
|
||||
vim.o.verbosefile = ${cfg.logFile},
|
||||
''}
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
imports = [
|
||||
./configrc.nix
|
||||
./basic.nix
|
||||
./debug.nix
|
||||
./spellcheck.nix
|
||||
];
|
||||
}
|
|
@ -7,17 +7,42 @@
|
|||
|
||||
cfg = config.vim;
|
||||
in {
|
||||
vim.maps = {
|
||||
normal =
|
||||
mkIf cfg.disableArrows {
|
||||
config = {
|
||||
vim.maps = {
|
||||
normal =
|
||||
mkIf cfg.disableArrows {
|
||||
"<up>" = {
|
||||
action = "<nop>";
|
||||
|
||||
noremap = false;
|
||||
};
|
||||
"<down>" = {
|
||||
action = "<nop>";
|
||||
|
||||
noremap = false;
|
||||
};
|
||||
"<left>" = {
|
||||
action = "<nop>";
|
||||
noremap = false;
|
||||
};
|
||||
"<right>" = {
|
||||
action = "<nop>";
|
||||
noremap = false;
|
||||
};
|
||||
}
|
||||
// mkIf cfg.mapLeaderSpace {
|
||||
"<space>" = {
|
||||
action = "<nop>";
|
||||
};
|
||||
};
|
||||
|
||||
insert = mkIf cfg.disableArrows {
|
||||
"<up>" = {
|
||||
action = "<nop>";
|
||||
|
||||
noremap = false;
|
||||
};
|
||||
"<down>" = {
|
||||
action = "<nop>";
|
||||
|
||||
noremap = false;
|
||||
};
|
||||
"<left>" = {
|
||||
|
@ -28,29 +53,6 @@ in {
|
|||
action = "<nop>";
|
||||
noremap = false;
|
||||
};
|
||||
}
|
||||
// mkIf cfg.mapLeaderSpace {
|
||||
"<space>" = {
|
||||
action = "<nop>";
|
||||
};
|
||||
};
|
||||
|
||||
insert = mkIf cfg.disableArrows {
|
||||
"<up>" = {
|
||||
action = "<nop>";
|
||||
noremap = false;
|
||||
};
|
||||
"<down>" = {
|
||||
action = "<nop>";
|
||||
noremap = false;
|
||||
};
|
||||
"<left>" = {
|
||||
action = "<nop>";
|
||||
noremap = false;
|
||||
};
|
||||
"<right>" = {
|
||||
action = "<nop>";
|
||||
noremap = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue