-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
executable file
·158 lines (140 loc) · 3.61 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# Environment variables
export LANG=en_US.UTF-8
export PATH=/usr/lib/ccache/bin:$PATH:~/.local/share/bin
export EDITOR='vim'
export VISUAL='vim'
export MOZ_ENABLE_WAYLAND=1
export BROWSER=/usr/bin/firefox-nightly
export GTK_THEME=Vertex-Dark
# Fix fonts not showing up in java applications
export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true'
export _JAVA_AWT_WM_NONREPARENTING=1
# Aliases
alias lsa="ls -lah"
# General Functions
function mkcd() {
mkdir "$1" && cd "$1"
}
function mkpcd() {
mkdir -p "$1" && cd "$1"
}
# Old oh-my-zsh style path completion
autoload -Uz compinit
compinit
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
# History
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_IGNORE_SPACE
# Fix keys
bindkey "^[[H" beginning-of-line # Termite
bindkey "^[[F" end-of-line # Termite
bindkey "\033[7~" beginning-of-line # URxvt
bindkey "\033[8~" end-of-line # URxvt
bindkey "\033[1~" beginning-of-line # TTY
bindkey "\033[4~" end-of-line # TTY
bindkey "\033[2~" insert-char
bindkey "\033[3~" delete-char
bindkey -v '^?' backward-delete-char # Allow BS over inserts
# TTY specifics
if [ "$TERM" = "linux" ]; then
setfont ter-powerline-v18n
echo -en "\e]P0000000" #black
echo -en "\e]P8333333" #darkgrey
echo -en "\e]P19f6767" #darkred
echo -en "\e]P99f6767" #red
echo -en "\e]P292ac68" #darkgreen
echo -en "\e]PA92ac68" #green
echo -en "\e]P3d0d293" #brown
echo -en "\e]PBd0d293" #yellow
echo -en "\e]P49aacc3" #darkblue
echo -en "\e]PC9aacc3" #blue
echo -en "\e]P5bb77a4" #darkmagenta
echo -en "\e]PDbb77a4" #magenta
echo -en "\e]P677bbb5" #darkcyan
echo -en "\e]PE77bbb5" #cyan
echo -en "\e]P7777777" #lightgrey
echo -en "\e]PFffffff" #white
clear #for background artifacting
fi
# Prompt
function +vi-git-process() {
if [[ -n "${hook_com[staged]}" ]] && [[ -n "${hook_com[unstaged]}" ]]; then
hook_com[unstaged]="${hook_com[unstaged][2]}"
fi
}
prompt_git() {
if ! $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
return;
fi
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' get-revision true
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' formats "%b/%8>>%i%<<%c%u"
zstyle ':vcs_info:*' actionformats '%b/%8>>%i%<</%a%c%u'
zstyle ':vcs_info:*' stagedstr '/s'
zstyle ':vcs_info:*' unstagedstr '/u'
zstyle ':vcs_info:git*+set-message:*' hooks git-process
vcs_info
echo -n " "
if [[ -n $(git status --porcelain 2>/dev/null | tail -n1) ]]; then
echo -n "%F{yellow}"
else
echo -n "%F{green}"
fi
echo -n "${vcs_info_msg_0_%% }%f"
}
prompt_tmux() {
if [ -z "$TMUX" ]; then
return;
fi
echo -n "["$(tmux display-message -p '#S')"] "
}
prompt_build() {
echo -n '%B'
prompt_tmux
echo -n '%(?..%F{red}%?%f )'
echo -n '%F{cyan}%1~%f'
prompt_git
echo -n '%(!.#.>)'
echo -n ' %b'
}
setopt PROMPT_SUBST
PROMPT='$(prompt_build)'
# Display vi mode
KEYTIMEOUT=5
if [ "$TERM" = "linux" ]; then
# Display '<<<' on the right for normal and nothing for insert
function zle-keymap-select {
if [[ ${KEYMAP} == vicmd ]] || [[ $1 = 'block' ]]; then
RPROMPT="%B%F{red}<<<%f%b"
else
RPROMPT=""
fi
zle reset-prompt
}
zle -N zle-keymap-select
RPROMPT=""
else
# Display block cursor for normal and I-beam cursor for insert
function zle-line-init {
zle -K viins
}
zle -N zle-line-init
function zle-keymap-select {
if [[ ${KEYMAP} == vicmd ]] || [[ $1 = 'block' ]]; then
echo -ne '\e[1 q'
else
echo -ne '\e[5 q'
fi
}
zle -N zle-keymap-select
echo -ne '\e[5 q'
preexec() {
echo -ne '\e[1 q'
}
echo -ne "\e]0;${PWD/$HOME/~}\a"
chpwd() {
echo -ne "\e]0;${PWD/$HOME/~}\a"
}
fi