From 5272bf603a60c601fc9c5c14edc74296d37a7c96 Mon Sep 17 00:00:00 2001 From: chayleaf Date: Sat, 5 Aug 2023 03:10:33 +0700 Subject: [PATCH] add vim config for minimal systems (also revert making fish the default shell on non-minimal systems) --- system/modules/common.nix | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/system/modules/common.nix b/system/modules/common.nix index 8341119..c70e54a 100644 --- a/system/modules/common.nix +++ b/system/modules/common.nix @@ -87,8 +87,23 @@ ] ++ lib.optionals cfg.minimal [ kitty.terminfo # rxvt-unicode-unwrapped.terminfo - vim ]); + programs.vim = lib.mkIf cfg.minimal { + defaultEditor = lib.mkDefault true; + package = pkgs.vim-full.customize { + vimrcConfig.customRC = '' + syntax on + au FileType markdown set colorcolumn=73 textwidth=72 + au FileType gitcommit set colorcolumn=73 + au BufReadPre * set foldmethod=syntax + au BufReadPost * folddoc foldopen! + autocmd BufReadPost * if @% !~# '\.git[\/\\]COMMIT_EDITMSG$' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif + ''; + vimrcConfig.packages.myVimPackage = with pkgs.vimPlugins; { + start = [ vim-sleuth ]; + }; + }; + }; # this is supposed to default to false, but it doesn't because of nixos fish module documentation.man.generateCaches = lib.mkOverride 999 false; # and we don't need html files and so on on minimal machines (it's not like I ever use it anyway) @@ -97,7 +112,9 @@ documentation.doc.enable = lib.mkIf cfg.minimal (lib.mkDefault false); programs.fish.enable = true; # conflicts with bash module's mkDefault - users.defaultUserShell = lib.mkOverride 999 pkgs.fish; + # only override on minimal systems because on non-minimal systems + # my fish config doesn't work well in fb/drm console + users.defaultUserShell = lib.mkIf cfg.minimal (lib.mkOverride 999 pkgs.fish); users.users.${cfg.mainUsername} = { uid = 1000; isNormalUser = true;