-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
99 lines (84 loc) · 2.34 KB
/
.zshrc
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfiles/zshhistory
HISTSIZE=10000
SAVEHIST=10000
setopt appendhistory autocd
unsetopt beep
bindkey -v
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/riku/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
# My personal configuration:
# Not so complicated settings:
autoload -Uz colors && colors
# Set some color variables (mainly for prompt):
BLACK="%{$fg[black]%}"
GREEN="%{$fg[green]%}"
BLUE="%{$fg[blue]%}"
CYAN="%{$fg[cyan]%}"
RED="%{$fg[red]%}"
YELLOW="%{$fg[yellow]%}"
MAGENTA="%{$fg[magenta]%}"
WHITE="%{$fg[white]%}"
NO_COLOR="%{$reset_color%}"
# Set special character variables:
SEGMENT_SEP="\ue0b0"
BRANCH="\ue0a0"
DETACHED="\u27a6"
PLUSMINUS="\u00b1"
# Aliases:
alias ls='ls --color=auto'
alias tmux="TERM=screen-256color-bce tmux"
# Prompt settings:
prompt off
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git svn
precmd() { vcs_info }
setopt prompt_subst
zstyle ':vcs_info:git*' formats "%b"
zstyle ':vcs_info:git*' actionformats "%b (%a)"
# Make git prompt:
prompt_git() {
local ref color
is_dirty() {
test -n "$(git status --porcelain --ignore-submodules)"
}
ref="$vcs_info_msg_0_"
if [[ -n "$ref" ]]; then
if is_dirty; then
color=$YELLOW
ref="${ref} $PLUSMINUS"
else
color=$GREEN
ref="${ref} "
fi
if [[ "${ref/.../}" == "$ref" ]]; then
ref="$BRANCH $ref"
else
ref="$DETACHED ${ref/.../}"
fi
echo $color${ref}$NO_COLOR
fi
}
PROMPT=`echo "$BLACK%K{blue}%n@%m%k$BLUE%K{yellow}$SEGMENT_SEP%k$BLACK%K{yellow}%1~%k$YELLOW$SEGMENT_SEP$NO_COLOR "`
RPROMPT='${RED}%(?..%?) `prompt_git`$NO_COLOR'
# Prevent duplication in history:
setopt HIST_IGNORE_DUPS
# History search with patterns matching current line:
autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
[[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-beginning-search
[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-beginning-search
eval $(thefuck --alias)
eval `dircolors ~/.dircolors`
# export TERM=xterm-256color
if ! pgrep -u $USER ssh-agent > /dev/null; then
ssh-agent > ~/.ssh-agent-thing
fi
if [[ "$SSH_AGENT_PID" == "" ]]; then
eval $(<~/.ssh-agent-thing) > /dev/null 2> /dev/null
fi