{ config, lib, pkgs, ... }: let cfg = config.modules.zsh; inherit (lib) mkEnableOption mkOption mkIf types; in { options.modules.zsh = { enable = mkEnableOption "zsh"; theme = mkOption { type = types.str; description = "name of zsh theme to apply"; default = "stefan"; }; }; config = mkIf cfg.enable { home.packages = with pkgs; [ zsh zsh-autosuggestions gitstatus ]; # omz isn't actually used, directory is arbitrary home.file.".oh-my-zsh/themes" = { source = ./themes; recursive = true; }; programs.zsh = { enable = true; autocd = true; enableCompletion = true; defaultKeymap = "viins"; dirHashes = { home = "~/home"; dl = "~/dl"; src = "~/src"; }; shellAliases = { ls = "eza"; ll = "eza -l"; hide = "swayhide"; }; autosuggestion.enable = true; initExtra = '' source ~/.oh-my-zsh/themes/${cfg.theme}.zsh-theme setopt nobeep export KEYTIMEOUT=1 # note, set higher if you want to use surround mode bindkey -M vicmd m vi-backward-char bindkey -M vicmd n vi-down-line-or-history bindkey -M vicmd e vi-up-line-or-history bindkey -M vicmd i vi-forward-char bindkey -M vicmd N vi-join bindkey -M vicmd h vi-set-mark bindkey -M vicmd j vi-repeat-search bindkey -M vicmd k vi-forward-word-end bindkey -M vicmd l vi-insert bindkey -M vicmd J vi-rev-repeat-search # vim style backspace (im a young soul) bindkey -v '^?' backward-delete-char ''; }; }; }