diff --git a/capture.zsh b/capture.zsh index aecf3ab..c527e21 100755 --- a/capture.zsh +++ b/capture.zsh @@ -3,11 +3,24 @@ zmodload zsh/zpty || { echo 'error: missing module zsh/zpty' >&2; exit 1 } # spawn shell -zpty z zsh -f -i +zpty z zsh -i # line buffer for pty output local line +# swallow input of zshrc, disable hooks and disable PROMPT +# the prompt is disabled later as well but at least with powerlevel10k +# it needs to be disabled twice. +zpty -w z "autoload add-zsh-hook" +zpty -w z "add-zsh-hook -D precmd '*'" +zpty -w z "add-zsh-hook -D preexec '*'" +zpty -w z "PROMPT=" +zpty -w z "echo thisisalonganduniquestringtomarktheendoftheinit >/dev/null" +zpty -r z line +while [[ $line != *'thisisalonganduniquestringtomarktheendoftheinit'* ]]; do + zpty -r z line +done + setopt rcquotes () { zpty -w z source $1