Add Zsh config back

This commit is contained in:
Evie Litherland-Smith 2024-02-11 06:53:37 +00:00
parent 118c9fd629
commit cc4bf59e73
2 changed files with 48 additions and 0 deletions

17
home/zsh/default.nix Normal file
View file

@ -0,0 +1,17 @@
{...}: {
programs.zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
enableVteIntegration = true;
autocd = true;
historySubstringSearch.enable = true;
oh-my-zsh = {
enable = true;
plugins = ["colored-man-pages" "lol" "rand-quote"];
theme = "";
};
extraInit = "source ${./transient.zsh}\n";
};
}

31
home/zsh/transient.zsh Executable file
View file

@ -0,0 +1,31 @@
#!/usr/bin/env zsh
zle-line-init() {
emulate -L zsh
[[ $CONTEXT == start ]] || return 0
while true; do
zle .recursive-edit
local -i ret=$?
[[ $ret == 0 && $KEYS == $'\4' ]] || break
[[ -o ignore_eof ]] || exit 0
done
local saved_prompt=$PROMPT
local saved_rprompt=$RPROMPT
PROMPT='%# '
RPROMPT=''
zle .reset-prompt
PROMPT=$saved_prompt
RPROMPT=$saved_rprompt
if ((ret)); then
zle .send-break
else
zle .accept-line
fi
return ret
}
zle -N zle-line-init