2023-02-27 15:53:34 +01:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
...
|
2023-11-06 10:33:38 +01:00
|
|
|
}: let
|
2023-11-14 08:18:32 +01:00
|
|
|
inherit (builtins) concatStringsSep;
|
2024-03-24 01:14:39 +01:00
|
|
|
inherit (lib.modules) mkIf;
|
|
|
|
inherit (lib.lists) optionals;
|
|
|
|
inherit (lib.strings) optionalString;
|
|
|
|
inherit (lib.nvim.dag) entryAfter;
|
2023-11-06 10:33:38 +01:00
|
|
|
|
2023-02-27 15:53:34 +01:00
|
|
|
cfg = config.vim;
|
|
|
|
in {
|
|
|
|
config = {
|
2024-03-24 01:14:39 +01:00
|
|
|
vim.startPlugins = ["plenary-nvim"] ++ optionals (cfg.spellChecking.enableProgrammingWordList) ["vim-dirtytalk"];
|
2023-02-27 15:53:34 +01:00
|
|
|
|
2023-04-10 13:42:31 +02:00
|
|
|
vim.maps.normal =
|
|
|
|
mkIf cfg.disableArrows {
|
|
|
|
"<up>" = {
|
|
|
|
action = "<nop>";
|
2023-02-27 15:53:34 +01:00
|
|
|
|
2023-04-10 13:42:31 +02:00
|
|
|
noremap = false;
|
|
|
|
};
|
|
|
|
"<down>" = {
|
|
|
|
action = "<nop>";
|
2023-02-27 15:53:34 +01:00
|
|
|
|
2023-04-10 13:42:31 +02:00
|
|
|
noremap = false;
|
|
|
|
};
|
|
|
|
"<left>" = {
|
|
|
|
action = "<nop>";
|
|
|
|
noremap = false;
|
|
|
|
};
|
|
|
|
"<right>" = {
|
|
|
|
action = "<nop>";
|
|
|
|
noremap = false;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
// mkIf cfg.mapLeaderSpace {
|
|
|
|
"<space>" = {
|
|
|
|
action = "<nop>";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
vim.maps.insert = mkIf cfg.disableArrows {
|
|
|
|
"<up>" = {
|
|
|
|
action = "<nop>";
|
|
|
|
noremap = false;
|
|
|
|
};
|
|
|
|
"<down>" = {
|
|
|
|
action = "<nop>";
|
|
|
|
noremap = false;
|
|
|
|
};
|
|
|
|
"<left>" = {
|
|
|
|
action = "<nop>";
|
|
|
|
noremap = false;
|
|
|
|
};
|
|
|
|
"<right>" = {
|
|
|
|
action = "<nop>";
|
|
|
|
noremap = false;
|
|
|
|
};
|
|
|
|
};
|
2023-02-27 15:53:34 +01:00
|
|
|
|
2024-03-24 01:14:39 +01:00
|
|
|
vim.configRC.basic = entryAfter ["globalsScript"] ''
|
2023-02-27 15:53:34 +01:00
|
|
|
" Settings that are set for everything
|
|
|
|
set encoding=utf-8
|
|
|
|
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
|
2023-05-19 14:14:25 +02:00
|
|
|
set cursorlineopt=${toString cfg.cursorlineOpt}
|
2023-08-25 22:18:50 +02:00
|
|
|
set scrolloff=${toString cfg.scrollOffset}
|
2023-05-16 16:25:20 +02:00
|
|
|
|
2024-02-12 08:11:53 +01:00
|
|
|
${optionalString cfg.debugMode.enable ''
|
|
|
|
" Debug mode settings
|
|
|
|
set verbose=${toString cfg.debugMode.level}
|
|
|
|
set verbosefile=${cfg.debugMode.logFile}
|
|
|
|
''}
|
|
|
|
|
2023-02-27 15:53:34 +01:00
|
|
|
${optionalString cfg.splitBelow ''
|
|
|
|
set splitbelow
|
|
|
|
''}
|
2024-02-12 08:11:53 +01:00
|
|
|
|
2023-02-27 15:53:34 +01:00
|
|
|
${optionalString cfg.splitRight ''
|
|
|
|
set splitright
|
|
|
|
''}
|
2024-02-12 08:11:53 +01:00
|
|
|
|
2023-02-27 15:53:34 +01:00
|
|
|
${optionalString cfg.showSignColumn ''
|
|
|
|
set signcolumn=yes
|
|
|
|
''}
|
2024-02-12 08:11:53 +01:00
|
|
|
|
2023-02-27 15:53:34 +01:00
|
|
|
${optionalString cfg.autoIndent ''
|
|
|
|
set autoindent
|
|
|
|
''}
|
|
|
|
|
|
|
|
${optionalString cfg.preventJunkFiles ''
|
|
|
|
set noswapfile
|
|
|
|
set nobackup
|
|
|
|
set nowritebackup
|
|
|
|
''}
|
2024-02-12 08:11:53 +01:00
|
|
|
|
2023-02-27 15:53:34 +01:00
|
|
|
${optionalString (cfg.bell == "none") ''
|
|
|
|
set noerrorbells
|
|
|
|
set novisualbell
|
|
|
|
''}
|
2024-02-12 08:11:53 +01:00
|
|
|
|
2023-02-27 15:53:34 +01:00
|
|
|
${optionalString (cfg.bell == "on") ''
|
|
|
|
set novisualbell
|
|
|
|
''}
|
2024-02-12 08:11:53 +01:00
|
|
|
|
2023-02-27 15:53:34 +01:00
|
|
|
${optionalString (cfg.bell == "visual") ''
|
|
|
|
set noerrorbells
|
|
|
|
''}
|
2024-02-12 08:11:53 +01:00
|
|
|
|
2023-02-27 15:53:34 +01:00
|
|
|
${optionalString (cfg.lineNumberMode == "relative") ''
|
|
|
|
set relativenumber
|
|
|
|
''}
|
2024-02-12 08:11:53 +01:00
|
|
|
|
2023-02-27 15:53:34 +01:00
|
|
|
${optionalString (cfg.lineNumberMode == "number") ''
|
|
|
|
set number
|
|
|
|
''}
|
2024-02-12 08:11:53 +01:00
|
|
|
|
2023-02-27 15:53:34 +01:00
|
|
|
${optionalString (cfg.lineNumberMode == "relNumber") ''
|
|
|
|
set number relativenumber
|
|
|
|
''}
|
2024-02-12 08:11:53 +01:00
|
|
|
|
2023-02-27 15:53:34 +01:00
|
|
|
${optionalString cfg.useSystemClipboard ''
|
|
|
|
set clipboard+=unnamedplus
|
|
|
|
''}
|
2024-02-12 08:11:53 +01:00
|
|
|
|
2023-02-27 15:53:34 +01:00
|
|
|
${optionalString cfg.mapLeaderSpace ''
|
|
|
|
let mapleader=" "
|
|
|
|
let maplocalleader=" "
|
|
|
|
''}
|
2024-02-12 08:11:53 +01:00
|
|
|
|
2023-02-27 15:53:34 +01:00
|
|
|
${optionalString cfg.syntaxHighlighting ''
|
|
|
|
syntax on
|
|
|
|
''}
|
2024-02-12 08:11:53 +01:00
|
|
|
|
2023-02-27 15:53:34 +01:00
|
|
|
${optionalString (!cfg.wordWrap) ''
|
|
|
|
set nowrap
|
|
|
|
''}
|
2024-02-12 08:11:53 +01:00
|
|
|
|
2023-02-27 15:53:34 +01:00
|
|
|
${optionalString cfg.hideSearchHighlight ''
|
|
|
|
set nohlsearch
|
|
|
|
set incsearch
|
|
|
|
''}
|
2024-02-12 08:11:53 +01:00
|
|
|
|
2023-02-27 15:53:34 +01:00
|
|
|
${optionalString cfg.colourTerm ''
|
|
|
|
set termguicolors
|
|
|
|
set t_Co=256
|
|
|
|
''}
|
2024-02-12 08:11:53 +01:00
|
|
|
|
2023-04-22 00:05:19 +02:00
|
|
|
${optionalString (!cfg.enableEditorconfig) ''
|
|
|
|
let g:editorconfig = v:false
|
2023-04-17 19:13:18 +02:00
|
|
|
''}
|
2024-02-12 08:11:53 +01:00
|
|
|
|
2023-08-01 16:28:06 +02:00
|
|
|
${optionalString cfg.spellChecking.enable ''
|
2023-06-06 02:25:50 +02:00
|
|
|
set spell
|
2023-11-14 08:18:32 +01:00
|
|
|
set spelllang=${concatStringsSep "," cfg.spellChecking.languages}${optionalString cfg.spellChecking.enableProgrammingWordList ",programming"}
|
2023-06-06 02:25:50 +02:00
|
|
|
''}
|
2024-02-12 08:11:53 +01:00
|
|
|
|
2023-07-30 17:32:53 +02:00
|
|
|
${optionalString (cfg.leaderKey != null) ''
|
|
|
|
let mapleader = "${toString cfg.leaderKey}"
|
|
|
|
''}
|
2024-02-12 08:11:53 +01:00
|
|
|
|
2023-10-28 14:53:06 +02:00
|
|
|
${optionalString (cfg.searchCase == "ignore") ''
|
|
|
|
set nosmartcase
|
|
|
|
set ignorecase
|
|
|
|
''}
|
2024-02-12 08:11:53 +01:00
|
|
|
|
2023-10-28 14:53:06 +02:00
|
|
|
${optionalString (cfg.searchCase == "smart") ''
|
|
|
|
set smartcase
|
2024-02-12 08:11:53 +01:00
|
|
|
set ignorecase
|
2023-10-28 14:53:06 +02:00
|
|
|
''}
|
2024-02-12 08:11:53 +01:00
|
|
|
|
2023-10-28 14:53:06 +02:00
|
|
|
${optionalString (cfg.searchCase == "sensitive") ''
|
|
|
|
set nosmartcase
|
2024-02-12 08:11:53 +01:00
|
|
|
set noignorecase
|
2023-10-28 14:53:06 +02:00
|
|
|
''}
|
2023-02-27 15:53:34 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|