From a4383075af86c46a812f982b270023d9e943f898 Mon Sep 17 00:00:00 2001 From: Olli Helenius Date: Sun, 16 Dec 2018 16:23:08 +0200 Subject: [PATCH] zsh: add default keymap configuration --- modules/programs/zsh.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/modules/programs/zsh.nix b/modules/programs/zsh.nix index f4605fc6..f46b6f66 100644 --- a/modules/programs/zsh.nix +++ b/modules/programs/zsh.nix @@ -19,6 +19,12 @@ let zdotdir = "$HOME/" + cfg.dotDir; + bindkeyCommands = { + emacs = "bindkey -e"; + viins = "bindkey -v"; + vicmd = "bindkey -a"; + }; + historyModule = types.submodule ({ config, ... }: { options = { size = mkOption { @@ -186,6 +192,13 @@ in description = "Options related to commands history configuration."; }; + defaultKeymap = mkOption { + type = types.nullOr (types.enum [ "emacs" "viins" "vicmd" ]); + default = null; + example = "emacs"; + description = "The default base keymap to use"; + }; + sessionVariables = mkOption { default = {}; type = types.attrs; @@ -303,6 +316,9 @@ in HELPDIR="${pkgs.zsh}/share/zsh/$ZSH_VERSION/help" + ${if cfg.defaultKeymap != null && hasAttr cfg.defaultKeymap bindkeyCommands + then getAttr cfg.defaultKeymap bindkeyCommands else ""} + ${concatStrings (map (plugin: '' path+="$HOME/${pluginsDir}/${plugin.name}" fpath+="$HOME/${pluginsDir}/${plugin.name}"