From d699591296e570f82cd08f63c4bce4f067b79b9d Mon Sep 17 00:00:00 2001 From: kat witch Date: Thu, 14 Oct 2021 23:45:29 +0100 Subject: [PATCH] remove vendored vim --- config/modules/home/vim.nix | 158 ------------------------------------ 1 file changed, 158 deletions(-) delete mode 100644 config/modules/home/vim.nix diff --git a/config/modules/home/vim.nix b/config/modules/home/vim.nix deleted file mode 100644 index 42e206b2..00000000 --- a/config/modules/home/vim.nix +++ /dev/null @@ -1,158 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - - cfg = config.programs.vim; - defaultPlugins = [ "vim-sensible" ]; - - knownSettings = { - background = types.enum [ "dark" "light" ]; - backupdir = types.listOf types.str; - copyindent = types.bool; - directory = types.listOf types.str; - expandtab = types.bool; - hidden = types.bool; - history = types.int; - ignorecase = types.bool; - modeline = types.bool; - mouse = types.enum [ "n" "v" "i" "c" "h" "a" "r" ]; - mousefocus = types.bool; - mousehide = types.bool; - mousemodel = types.enum [ "extend" "popup" "popup_setpos" ]; - number = types.bool; - relativenumber = types.bool; - shiftwidth = types.int; - smartcase = types.bool; - tabstop = types.int; - undodir = types.listOf types.str; - undofile = types.bool; - }; - - vimSettingsType = types.submodule { - options = - let - opt = name: type: mkOption { - type = types.nullOr type; - default = null; - visible = false; - }; - in - mapAttrs opt knownSettings; - }; - - setExpr = name: value: - let - v = - if isBool value then (if value then "" else "no") + name - else - "${name}=${ - if isList value - then concatStringsSep "," value - else toString value - }"; - in - optionalString (value != null) ("set " + v); - -in - -{ - options = { - programs.vim = { - enable = mkEnableOption "Vim"; - - plugins = mkOption { - type = types.listOf types.str; - default = defaultPlugins; - example = [ "YankRing" ]; - description = '' - List of vim plugins to install. To get a list of supported plugins run: - nix-env -f '<nixpkgs>' -qaP -A vimPlugins. - ''; - }; - - settings = mkOption { - type = vimSettingsType; - default = { }; - example = literalExample '' - { - expandtab = true; - history = 1000; - background = "dark"; - } - ''; - description = '' - At attribute set of Vim settings. The attribute names and - corresponding values must be among the following supported - options. - - - ${concatStringsSep "\n" ( - mapAttrsToList (n: v: '' - - ${n} - ${v.description} - - '') knownSettings - )} - - - See the Vim documentation for detailed descriptions of these - options. Note, use extraConfig to - manually set any options not listed above. - ''; - }; - - extraConfig = mkOption { - type = types.lines; - default = ""; - example = '' - set nocompatible - set nobackup - ''; - description = "Custom .vimrc lines"; - }; - - package = mkOption { - type = types.package; - description = "Resulting customized vim package"; - readOnly = true; - }; - - packageConfigurable = mkOption { - type = types.package; - description = "Configurable vim package"; - default = pkgs.vim_configurable; - defaultText = "pkgs.vim_configurable"; - }; - }; - }; - - config = ( - let - customRC = '' - ${concatStringsSep "\n" ( - filter (v: v != "") ( - mapAttrsToList setExpr ( - builtins.intersectAttrs knownSettings cfg.settings)))} - - ${cfg.extraConfig} - ''; - - vim = cfg.packageConfigurable.customize { - name = "vim"; - vimrcConfig.customRC = customRC; - vimrcConfig.vam.knownPlugins = pkgs.vimPlugins; - vimrcConfig.vam.pluginDictionaries = [ - { names = defaultPlugins ++ cfg.plugins; } - ]; - }; - - in - mkIf cfg.enable { - programs.vim.package = vim; - home.packages = [ cfg.package ]; - } - ); -}