zsh: add default keymap configuration

(cherry picked from commit a4383075af)
This commit is contained in:
Olli Helenius 2018-12-16 16:23:08 +02:00 committed by Robert Helgesson
parent ad0b33387d
commit 8026e4ff6f
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -19,6 +19,12 @@ let
zdotdir = "$HOME/" + cfg.dotDir; zdotdir = "$HOME/" + cfg.dotDir;
bindkeyCommands = {
emacs = "bindkey -e";
viins = "bindkey -v";
vicmd = "bindkey -a";
};
historyModule = types.submodule ({ config, ... }: { historyModule = types.submodule ({ config, ... }: {
options = { options = {
size = mkOption { size = mkOption {
@ -186,6 +192,13 @@ in
description = "Options related to commands history configuration."; 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 { sessionVariables = mkOption {
default = {}; default = {};
type = types.attrs; type = types.attrs;
@ -303,6 +316,9 @@ in
HELPDIR="${pkgs.zsh}/share/zsh/$ZSH_VERSION/help" 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: '' ${concatStrings (map (plugin: ''
path+="$HOME/${pluginsDir}/${plugin.name}" path+="$HOME/${pluginsDir}/${plugin.name}"
fpath+="$HOME/${pluginsDir}/${plugin.name}" fpath+="$HOME/${pluginsDir}/${plugin.name}"