Improved prompt
This commit is contained in:
parent
3689599ae2
commit
2488c8953f
16
.config/discord/settings.json
Normal file
16
.config/discord/settings.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"BACKGROUND_COLOR": "#202225",
|
||||
"IS_MAXIMIZED": true,
|
||||
"IS_MINIMIZED": false,
|
||||
"MINIMIZE_TO_TRAY": false,
|
||||
"OPEN_ON_STARTUP": false,
|
||||
"WINDOW_BOUNDS": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"width": 1688,
|
||||
"height": 1022
|
||||
},
|
||||
"DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING": true,
|
||||
"SKIP_HOST_UPDATE": true,
|
||||
"chromiumSwitches": {}
|
||||
}
|
||||
@ -63,7 +63,7 @@ eval $(awk '{print "PERSONAL_" $0}' ${HOME}/.personal-info 2>/dev/null)
|
||||
if [[ -z ${MACHINE_CHASSIS} ]]; then MACHINE_CHASSIS=$(hostnamectl chassis 2>/dev/null); fi
|
||||
if [[ -z ${MACHINE_CHASSIS} ]]; then MACHINE_CHASSIS="desktop"; fi
|
||||
|
||||
if [[ ${MACHINE_CHASSIS} != "container" ]]; then
|
||||
if [[ ${MACHINE_CHASSIS} != "container" ]] && [[ ${OS_ID} == "arch" ]]; then
|
||||
# Only check if a reboot is necessary if we're not in a container
|
||||
precmd_functions+=(precmd_kernel_info)
|
||||
fi
|
||||
@ -100,7 +100,7 @@ case $OS_ID in
|
||||
show_os_icon=0
|
||||
;;
|
||||
esac
|
||||
prompt="▶"
|
||||
prompt_char="%(?.❯.%F{red}❯%f)"
|
||||
host="%F{cyan}[ %F{green}${hostname}%(!.%F{red} as root.) %F{cyan}]%f"
|
||||
localhost="%F{cyan}[ %F{magenta}%B${hostname}%(!.%F{red} as root.)%b %F{cyan}]%f"
|
||||
serial_host="%F{cyan}[ %F{magenta}${hostname}%(!.%F{red} as root.) %F{cyan}] %F{red}%y%f"
|
||||
@ -108,17 +108,21 @@ container_host="%F{cyan}[ %F{blue}%B${hostname}%(!.%F{red} as root.)%b %F{cyan}]
|
||||
returncode="%(?..%F{red} %?%f)"
|
||||
|
||||
prompt_line1='$kernel_info_msg_0_'
|
||||
prompt_line3=$prompt
|
||||
prompt_line3=" $prompt_char"
|
||||
|
||||
# Create conditional prompt line 2
|
||||
if [[ -v SSH_CLIENT ]]; then
|
||||
prompt_line2='${host}$pyenv_info_msg_0_ ${pwd}'
|
||||
history_line="${host}"
|
||||
elif [[ ${TTY} =~ "tty" ]]; then
|
||||
prompt_line2='${serial_host}$pyenv_info_msg_0_ ${pwd}'
|
||||
history_line="${serial_host}"
|
||||
elif [[ ${MACHINE_CHASSIS} == "container" ]]; then
|
||||
prompt_line2='${container_host}$pyenv_info_msg_0_ ${pwd}'
|
||||
history_line="${container_host}"
|
||||
else
|
||||
prompt_line2='${localhost}$pyenv_info_msg_0_ ${pwd}'
|
||||
history_line="${localhost}"
|
||||
fi
|
||||
|
||||
# Inject icon if available, with ANSI color code stored in $OS_ANSI_COLOR
|
||||
@ -126,15 +130,36 @@ if [[ ${show_os_icon} -eq 1 ]]; then
|
||||
prompt_line2=$'%{\x1b[${OS_ANSI_COLOR}m${os_icon}\x1b[0m%}'" ${prompt_line2}"
|
||||
fi
|
||||
|
||||
if [[ ${TERM} == "dumb" ]]; then
|
||||
# Dumb terminal needs a dumb prompt, otherwise things like
|
||||
# emacs TRAMP break
|
||||
PROMPT='[%~] $ '
|
||||
else
|
||||
PROMPT="${prompt_line1}
|
||||
set-prompt() {
|
||||
if [[ ${TERM} == "dumb" ]]; then
|
||||
# Dumb terminal needs a dumb prompt, otherwise things like
|
||||
# emacs TRAMP break
|
||||
PROMPT='[%~] $ '
|
||||
PROMPT2='> '
|
||||
else
|
||||
PROMPT="${prompt_line1}
|
||||
${prompt_line2}
|
||||
${prompt_line3} "
|
||||
fi
|
||||
PROMPT2=" %F{yellow}%_ ❯%f "
|
||||
fi
|
||||
|
||||
}
|
||||
set-prompt
|
||||
|
||||
rewrite-prompt-and-accept() {
|
||||
if [[ ${TERM} == "dumb" ]]; then
|
||||
return
|
||||
fi
|
||||
PROMPT='${history_line} %F{yellow}%T%f ${pwd}$pyenv_info_msg_0_ %F{green}${prompt_char}%f '
|
||||
# Clear any suggestions; we've committed to this command
|
||||
zle autosuggest-clear
|
||||
zle reset-prompt
|
||||
set-prompt
|
||||
zle accept-line
|
||||
}
|
||||
|
||||
zle -N rewrite-prompt-and-accept
|
||||
bindkey '^M' rewrite-prompt-and-accept
|
||||
|
||||
RPROMPT='$vcs_info_msg_0_$returncode'
|
||||
|
||||
|
||||
@ -1 +0,0 @@
|
||||
prompt.zsh##distro.Arch
|
||||
Loading…
x
Reference in New Issue
Block a user