summaryrefslogtreecommitdiff
path: root/zshrc
blob: 3528df6923f4ac5e03d95fec6de5d5d380255b24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
autoload -U compinit
compinit
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b'

setopt correct

export HISTSIZE=2000
export HISTFILE="$HOME/.history"
export SAVEHIST=$HISTSIZE
setopt hist_ignore_all_dups
setopt hist_ignore_space

setopt autocd
setopt extendedglob
setopt prompt_subst

autoload -Uz vcs_info
zstyle ':vcs_info:git*' formats '[%b] '

bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word

precmd() { vcs_info }

if [ $UID -eq 0 ]; then
  local user_prompt=$'\U26A0\UFE0F'" %F{red}%n%f"
else
  local user_prompt="%F{green}%n%f"
fi

export PS1='$user_prompt@%M %F{cyan}%2~%f ${vcs_info_msg_0_}%(?..%F{red}[%?]%f )%# '

if [ ! -f $HOME/server ] && [ ! $UID -eq 0 ]; then
  export GPG_TTY="$(tty)"
  export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
  gpgconf --launch gpg-agent
  gpg-connect-agent updatestartuptty /bye > /dev/null
  gpg-connect-agent "scd serialno" "learn --force" /bye > /dev/null
fi

alias l="ls -lah"
alias ll="ls -lh"
alias okular="setsid okular"

export PATH="$HOME/bin:$PATH"
export PATH="$HOME/.local/bin:$PATH"

rh() {
  rm -f ~/.zsh_history
  exec zsh
}

bz() {
  setsid "$@" &> /dev/null < /dev/null
}