From e73469d1028734b6a88e4cd228c2cf8ca4ad3720 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 12 Feb 2024 10:11:53 +0300 Subject: [PATCH] modules/basic: fix search sensitivity options; restructure --- modules/basic/config.nix | 37 +++++++++++++++++++++++++++++-------- modules/basic/module.nix | 31 +++++++++++++++++++++---------- 2 files changed, 50 insertions(+), 18 deletions(-) diff --git a/modules/basic/config.nix b/modules/basic/config.nix index 270f8ae..1a3e97b 100644 --- a/modules/basic/config.nix +++ b/modules/basic/config.nix @@ -58,12 +58,6 @@ in { }; vim.configRC.basic = nvim.dag.entryAfter ["globalsScript"] '' - ${optionalString cfg.debugMode.enable '' - " Debug mode settings - set verbose=${toString cfg.debugMode.level} - set verbosefile=${cfg.debugMode.logFile} - ''} - " Settings that are set for everything set encoding=utf-8 set mouse=${cfg.mouseSupport} @@ -79,15 +73,24 @@ in { 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 ''} + ${optionalString cfg.splitRight '' set splitright ''} + ${optionalString cfg.showSignColumn '' set signcolumn=yes ''} + ${optionalString cfg.autoIndent '' set autoindent ''} @@ -97,67 +100,85 @@ in { set nobackup set nowritebackup ''} + ${optionalString (cfg.bell == "none") '' set noerrorbells set novisualbell ''} + ${optionalString (cfg.bell == "on") '' set novisualbell ''} + ${optionalString (cfg.bell == "visual") '' set noerrorbells ''} + ${optionalString (cfg.lineNumberMode == "relative") '' set relativenumber ''} + ${optionalString (cfg.lineNumberMode == "number") '' set number ''} + ${optionalString (cfg.lineNumberMode == "relNumber") '' set number relativenumber ''} + ${optionalString cfg.useSystemClipboard '' set clipboard+=unnamedplus ''} + ${optionalString cfg.mapLeaderSpace '' let mapleader=" " let maplocalleader=" " ''} + ${optionalString cfg.syntaxHighlighting '' syntax on ''} + ${optionalString (!cfg.wordWrap) '' set nowrap ''} + ${optionalString cfg.hideSearchHighlight '' set nohlsearch set incsearch ''} + ${optionalString cfg.colourTerm '' set termguicolors set t_Co=256 ''} + ${optionalString (!cfg.enableEditorconfig) '' let g:editorconfig = v:false ''} + ${optionalString cfg.spellChecking.enable '' set spell set spelllang=${concatStringsSep "," cfg.spellChecking.languages}${optionalString cfg.spellChecking.enableProgrammingWordList ",programming"} ''} + ${optionalString (cfg.leaderKey != null) '' let mapleader = "${toString cfg.leaderKey}" ''} + ${optionalString (cfg.searchCase == "ignore") '' set nosmartcase set ignorecase ''} + ${optionalString (cfg.searchCase == "smart") '' - set noignorecase set smartcase + set ignorecase ''} + ${optionalString (cfg.searchCase == "sensitive") '' - set noignorecase set nosmartcase + set noignorecase ''} ''; }; diff --git a/modules/basic/module.nix b/modules/basic/module.nix index cf972c0..4a2750f 100644 --- a/modules/basic/module.nix +++ b/modules/basic/module.nix @@ -30,6 +30,14 @@ in { }; }; + enableLuaLoader = mkEnableOption "experimental Lua module loader to speed up the start up process"; + + leaderKey = mkOption { + type = with types; nullOr str; + default = null; + description = "The leader key to be used internally"; + }; + spellChecking = { enable = mkEnableOption "neovim's built-in spellchecking"; enableProgrammingWordList = mkEnableOption "vim-dirtytalk, a wordlist for programmers, that includes programming words"; @@ -41,12 +49,6 @@ in { }; }; - leaderKey = mkOption { - type = with types; nullOr str; - default = null; - description = "The leader key to be used internally"; - }; - colourTerm = mkOption { type = types.bool; default = true; @@ -98,13 +100,24 @@ in { mouseSupport = mkOption { type = with types; enum ["a" "n" "v" "i" "c"]; default = "a"; - description = "Set modes for mouse support. a - all, n - normal, v - visual, i - insert, c - command"; + description = '' + Set modes for mouse support. + + * a - all + * n - normal + * v - visual + * i - insert + * c - command + ''; }; lineNumberMode = mkOption { type = with types; enum ["relative" "number" "relNumber" "none"]; default = "relNumber"; - description = "How line numbers are displayed. none, relative, number, relNumber"; + description = '' + How line numbers are displayed. Available options are + none, relative, number, relNumber + ''; }; preventJunkFiles = mkOption { @@ -178,8 +191,6 @@ in { description = "Highlight the text line of the cursor with CursorLine hl-CursorLine"; }; - enableLuaLoader = mkEnableOption "experimental Lua module loader to speed up the start up process"; - searchCase = mkOption { type = types.enum ["ignore" "smart" "sensitive"]; default = "sensitive";