]> git.friedersdorff.com Git - max/saltfiles.git/blob - states/zsh/files/zshrc
Add newline between prompts if in git repo
[max/saltfiles.git] / states / zsh / files / zshrc
1 # The following lines were added by compinstall
2
3 zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
4 zstyle ':completion:*' completions 1
5 zstyle ':completion:*' expand suffix
6 zstyle ':completion:*' glob 1
7 zstyle ':completion:*' ignore-parents parent pwd
8 zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
9 zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
10 zstyle ':completion:*' list-suffixes true
11 zstyle ':completion:*' max-errors 2
12 zstyle ':completion:*' menu select=1
13 zstyle ':completion:*' preserve-prefix '//[^/]##/'
14 zstyle ':completion:*' prompt 'Corrections with %e differences:'
15 zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
16 zstyle ':completion:*' substitute 1
17 zstyle :compinstall filename '/home/max/.zshrc'
18
19 autoload -Uz compinit
20 compinit
21 # End of lines added by compinstall
22 # Lines configured by zsh-newuser-install
23 HISTFILE=~/.histfile
24 HISTSIZE=20000
25 SAVEHIST=20000
26 setopt appendhistory autocd extendedglob nomatch
27 unsetopt beep notify
28 bindkey -v
29 # End of lines configured by zsh-newuser-install
30
31
32 git_prompt() {
33         ref=$(git symbolic-ref HEAD | cut -d'/' -f3-)
34         echo $ref
35 }
36
37 NEWLINE=$'\n'
38 setopt prompt_subst
39 autoload -Uz vcs_info
40 zstyle ':vcs_info:*' actionformats \
41     "%F{5}[%f%b%F{3}|%F{1}%a%F{5}]%f${NEWLINE}"
42 zstyle ':vcs_info:*' formats       \
43     "%F{5}[%f%b%F{5}]%f${NEWLINE}"
44
45 zstyle ':vcs_info:*' enable git
46
47 # or use pre_cmd, see man zshcontrib
48 precmd() {
49         vcs_info
50         if [[ -n ${vcs_info_msg_0_} ]]; then
51                 echo
52         fi
53 }
54
55 prompt='$vcs_info_msg_0_'
56 prompt+="%(?;%F{green};%F{red})[%h]%f "
57 prompt+="%F{red}%B%n%b%f@%F{red}%B%m%b%f"
58 prompt+=":%F{blue}%~%f"
59 prompt+="${NEWLINE}%(!.#.$) "
60
61 if ! pgrep -x -u "${USER}" gpg-agent >/dev/null 2>&1; then
62   gpg-connect-agent /bye >/dev/null 2>&1
63 fi
64
65 unset SSH_AGENT_PID
66 if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
67   export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
68 fi
69
70 gpg-connect-agent updatestartuptty /bye > /dev/null