zsh: zsh: i have further fucked it

This commit is contained in:
Erin 2022-10-17 12:31:49 -04:00
parent 2abcef1ce1
commit b7fa9465c6
3 changed files with 9 additions and 6 deletions

View file

@ -0,0 +1,3 @@
# creates the preexec_functions and precmd_functions arrays to be filled later
export preexec_functions=()
export precmd_functions=()

View file

@ -10,4 +10,3 @@ precmd_functions+="vcs_info"
# Prompt shows hostname if connected to a remote or if root # Prompt shows hostname if connected to a remote or if root
PROMPT="%B$([ -n "$is_remote" ] || [ "$EUID" = 0 ] && echo "%F{magenta}%m%f ")%F{$([ "$EUID" = 0 ] && echo "red" || echo "cyan")}%n%f %F{blue}%~%f%b \${vcs_info_msg_0_}%B%#%b " PROMPT="%B$([ -n "$is_remote" ] || [ "$EUID" = 0 ] && echo "%F{magenta}%m%f ")%F{$([ "$EUID" = 0 ] && echo "red" || echo "cyan")}%n%f %F{blue}%~%f%b \${vcs_info_msg_0_}%B%#%b "

View file

@ -1,14 +1,15 @@
# Hook preexec/precmd to dynamically set rprompt with useful info # Hook preexec/precmd to dynamically set rprompt with useful info
preexec_functions+=start_prompt_timer
function start_prompt_timer { function start_prompt_timer {
# Store command execution start time # Store command execution start time
timer="${timer:-"$(date +%s.%N)"}" timer="${timer:-"$(date +%s.%N)"}"
} }
preexec_functions+="start_prompt_timer"
# this actually does need to be the precmd function because it needs to run # this needs to be the first precmd function because it needs to run before any
# before any other precmd hooks (e.g. the VS Code terminal integration hook) # other precmd hooks (e.g. the VS Code terminal integration hook) happen,
# happen, otherwise $? will be fucked # otherwise $? will be fucked
function precmd { precmd_functions=(build_rprompt ${precmd_functions[@]})
function build_rprompt {
# Start with a fresh prompt # Start with a fresh prompt
RPROMPT="" RPROMPT=""
if [ -z $new_session ]; then if [ -z $new_session ]; then