add starship
This commit is contained in:
@@ -13,7 +13,7 @@ setopt HIST_VERIFY
|
||||
setopt AUTO_CD EXTENDED_GLOB NOTIFY INTERACTIVE_COMMENTS
|
||||
bindkey -e
|
||||
|
||||
WORDCHARS=${WORDCHARS//[\/=\*-]/}
|
||||
WORDCHARS=${WORDCHARS//[\/=\*\.-]/}
|
||||
|
||||
# Rookie keybindings :)
|
||||
bindkey '^[[1;5D' backward-word # C-Left
|
||||
|
||||
@@ -1,7 +1,25 @@
|
||||
# Fallback prompt (if oh-my-posh is not available)
|
||||
PROMPT='%F{blue}%n@%m%f %F{cyan}%~%f > '
|
||||
|
||||
# starship
|
||||
if (( $+commands[starship] )); then
|
||||
eval "$(starship init zsh)"
|
||||
|
||||
autoload -Uz add-zle-hook-widget
|
||||
add-zle-hook-widget zle-line-finish transient-prompt
|
||||
|
||||
function transient-prompt() {
|
||||
local file palette color
|
||||
file=${STARSHIP_CONFIG:-"$HOME/.config/starship.toml"}
|
||||
palette=$(sed -n "s/^palette\s*=\s*'\(.*\)'/\1/p" "$file")
|
||||
color=$(sed -n "/^\[palettes\.${palette}\]/,/^\[/{s/^accent\s*=\s*\"\(.*\)\"/\1/p}" "$file")
|
||||
|
||||
PROMPT="%F{$color}#%f " zle .reset-prompt
|
||||
}
|
||||
|
||||
|
||||
# oh-my-posh
|
||||
if [[ -f "$HOME/.config/posh_theme.omp.json" ]] && (( $+commands[oh-my-posh] )); then
|
||||
eval "$(oh-my-posh init zsh --config "$HOME/.config/posh_theme.omp.json")"
|
||||
elif [[ -f "$HOME/.config/posh_theme.omp.json" ]] && (( $+commands[oh-my-posh] )); then
|
||||
eval "$(oh-my-posh init zsh --config "$HOME/.config/posh_theme.omp.json")"
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user