zsh: Update config

This commit is contained in:
2024-05-05 10:31:26 +02:00
parent d8a65e5082
commit 72a77275aa

View File

@@ -1,16 +1,8 @@
[[ -z "$PS1" ]] && return
{% if user.gpg_agent %} {% if user.gpg_agent %}
export GPG_TTY=$(tty) export GPG_TTY=$(tty)
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
{% endif %} {% endif %}
if [[ -f /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]] ; then
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
elif [[ -f /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]] ; then
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
fi
{% if user.ssh_agent %} {% if user.ssh_agent %}
if ! pgrep -u "$USER" ssh-agent > /dev/null ; then if ! pgrep -u "$USER" ssh-agent > /dev/null ; then
ssh-agent > "$XDG_RUNTIME_DIR/ssh-agent.env" ssh-agent > "$XDG_RUNTIME_DIR/ssh-agent.env"
@@ -389,7 +381,7 @@ tmp() {
--symbolic-full-name 2>/dev/null)/refs\/remotes\/} --symbolic-full-name 2>/dev/null)/refs\/remotes\/}
if [[ -n ${remote} ]] ; then if [[ -n ${remote} ]] ; then
hook_com[branch]="${hook_com[branch]}:%b%{$fg[magenta]%}${remote}${(j:/:)gitstatus}${reset_color}" hook_com[branch]="%F{cyan}${hook_com[branch]}%F{$mainc}:%b%F{magenta}${remote}%F{yellow}${(j:/:)gitstatus}%F{$mainc}"
fi fi
} }
@@ -413,18 +405,18 @@ precmd() {
vcs_info vcs_info
} }
if [[ DARKMODE == "true" ]] ; then if [[ -e "$XDG_RUNTIME_DIR/darkmode" ]] ; then
c=white mainc=white
else else
c=black mainc=black
fi fi
_topstr='%{$fg[green]%}%n@%m%{$fg[$c]%} %{%B$fg[yellow]%}%3~%{%b%} ${vcs_info_msg_0_}%{$fg[$c]%} ' _topstr='%F{green}%n%F{$mainc} ─ %B%F{yellow}%4~%b ${vcs_info_msg_0_}%F{$mainc} '
botstr='%B${PINFO}%(!.#.$)%b ' botstr='%B${PINFO}%(!.#.$)%b '
PROMPT='%{$fg[$c]%}┌─ '"${_topstr}"' PROMPT='%F{$mainc}┌─ '"${_topstr}"'
└─ '"${botstr}" └─ '"${botstr}"
RPROMPT="%{$fg[cyan]%}%*%{$fg[$c]%} ─ [%?]" RPROMPT='%b%F{cyan}%*%F{$mainc} [%?]'
autoload zkbd autoload zkbd
@@ -456,4 +448,9 @@ bindkey '^i' expand-or-complete-prefix
export FZF_DEFAULT_OPTS='--height 50% --border' export FZF_DEFAULT_OPTS='--height 50% --border'
eval "$(fzf --zsh)" eval "$(fzf --zsh)"
# These have to be sourced at the end, see
# https://github.com/zsh-users/zsh-syntax-highlighting?tab=readme-ov-file#why-must-zsh-syntax-highlightingzsh-be-sourced-at-the-end-of-the-zshrc-file
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
{% endraw %} {% endraw %}