Add zsh p10k instant prompt

This commit is contained in:
Joshua Yuen 2026-01-19 18:11:01 -05:00
parent 06efdfb847
commit d24816b15d
Signed by: josh
GPG Key ID: 502720BC22ED411C
1 changed files with 21 additions and 9 deletions

View File

@ -1,9 +1,11 @@
{
config,
lib,
osConfig,
pkgs,
...
}:
with lib;
let
cfg = osConfig.modules.zsh;
xdgCfg = config.xdg;
@ -38,23 +40,33 @@ in
extended = true;
};
initContent = ''
initContent =
let
zshConfigInitEarly = mkOrder 500 ''
# p10k
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" ]]; then
source "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh"
fi
source "${xdgCfg.configHome}/zsh/p10k.zsh";
'';
zshConfig = mkOrder 1000 ''
# vi keybindings for menu select
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'j' vi-down-line-or-history
bindkey -M menuselect 'l' vi-forward-char
#bindkey -M menuselect 'h' vi-backward-char
#bindkey -M menuselect 'k' vi-up-line-or-history
#bindkey -M menuselect 'j' vi-down-line-or-history
#bindkey -M menuselect 'l' vi-forward-char
# Tab to accept current selection
bind-key -M menuselect '^I' accept-and-infer-next-history
#bindkey -M menuselect '^I' accept-and-infer-next-history
# Control arrow keys
bindkey '^[[1;5C' forward-word
bindkey '^[[1;5D' backward-word
'';
in mkMerge [ zshConfigInitEarly zshConfig ];
shellAliases = {
".." = "cd ..";