-
Notifications
You must be signed in to change notification settings - Fork 2
/
dot_zshrc.local
181 lines (137 loc) · 4.62 KB
/
dot_zshrc.local
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
setopt vi
bindkey -M viins '^P' up-history
bindkey -M viins '^N' down-history
bindkey -M viins '^W' backward-delete-word
bindkey -M viins '^[.' insert-last-word
KEYTIMEOUT=1
# Change cursor shape for different vi modes.
function zle-keymap-select {
if [[ ${KEYMAP} == vicmd ]] ||
[[ $1 = 'block' ]]; then
echo -ne '\e[1 q'
elif [[ ${KEYMAP} == main ]] ||
[[ ${KEYMAP} == viins ]] ||
[[ ${KEYMAP} = '' ]] ||
[[ $1 = 'beam' ]]; then
echo -ne '\e[5 q'
fi
}
zle -N zle-keymap-select
zle-line-init() {
zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
echo -ne "\e[5 q"
}
zle -N zle-line-init
echo -ne '\e[5 q' # Use beam shape cursor on startup.
_fix_cursor() {
echo -ne '\e[5 q'
}
precmd_functions+=(_fix_cursor)
#Git
alias gitlog='git log --pretty=format:"%h - %an, %ar : %s"'
alias gst='git st'
#Maven
export M2_HOME=/opt/maven
export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")
export JDK_HOME=$(readlink -f /usr/bin/javac | sed "s:bin/javac::")
#export MAVEN_OPTS="-Xmx2048m -XX:MaxPermSize=2048M"
export WORDCHARS="*?_-.[]~=&;!#$%^(){}<>"
export PATH=~/bin:~/.cargo/bin:~/go/bin:$PATH
#TMUX
alias tmux="tmux -2"
if [ "$TERM" = "screen" ] && [ -n "$TMUX" ]; then
export TERM='screen-256color'
fi
# avoid nomatch errors
setopt nonomatch
#disable annoying ui prompts
export PINENTRY_USER_DATA="USE_CURSES=1"
unset GPG_AGENT_INFO
unset SSH_ASKPASS
# less
export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;38;5;74m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[38;5;246m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[04;38;5;146m'
export LESS_TERMCAP_so=$'\e[0;31m'
# Go
export GOPATH=~/go
#export GLAMOUR_STYLE=light
if [[ -x "$(command -v starship)" ]];
then
prompt off
eval "$(starship init zsh)"
fi
function ediff() {
if [ "X${2}" = "X" ]; then
echo "USAGE: ediff <FILE 1> <FILE 2>"
else
# The --eval flag takes lisp code and evaluates it with EMACS
emacsclient -nw --eval "(ediff-files \"$1\" \"$2\")"
fi
}
# fw
# fuck you nautilus
alias nautilus='nautilus --no-desktop'
alias layus='setxkbmap us && pkill -RTMIN+1 i3blocks'
alias layde='setxkbmap de && pkill -RTMIN+1 i3blocks'
alias layusint='setxkbmap us -variant intl && pkill -RTMIN+1 i3blocks'
alias mplayer='mplayer -stop-xscreensaver'
alias vim='nvim'
alias emacs='echo Did you mean "nvim"?'
alias restartEmacs='systemctl restart --user emacs'
alias get_local_ip="ip a | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1' | grep -v '172.'"
alias docker-killall='docker kill $(docker ps -q)'
alias docker-be-gone='docker rmi -f $(docker images -a -q); docker rm -f $(docker ps -a -q)'
alias docker-forget-untagged='docker rmi $(docker images | grep "<none>" | awk "{print $3}")'
alias pwn-docker='docker rm -f $(docker ps -a -q)'
alias back-to-master='git checkout $(git remote show origin | awk "/HEAD branch/ { print \$3 }") && git uff && git-trim'
alias setup-master-ref-for-git='git symbolic-ref refs/remotes/origin/master refs/remotes/origin/main && git symbolic-ref refs/heads/master refs/heads/main'
alias zvenv='source ~/venv/bin/activate'
alias dist-upgrade-cargo='cargo install-update -a'
unalias ag 2>/dev/null
alias ag='ag --smart-case --color-line-number "1;34"'
export SBT_OPTS="-XX:MaxMetaspaceSize=512M -XX:MetaspaceSize=256M -Xms512M -Xmx2G -XX:+UseG1GC"
alias fbtoggl-delete='fbtoggl time-entries delete --id $(fbtoggl --format json time-entries list | jq .id | sk --preview "fbtoggl --format table time-entries details --id {}")'
alias zbn='zellij action rename-tab $(basename $(pwd))'
# setup exa
if [[ -x "$(command -v eza)" ]];
then
unalias ls
unalias la
unalias ll
alias ls="command eza --icons=auto"
alias la="command eza -la --icons=auto"
alias ll="command eza -l --icons=auto"
alias lt="command eza --tree --icons=auto"
fi;
if [[ -x "$(command -v fnm)" ]];
then
eval "$(fnm env)"
fi;
# fw
if [[ -x "$(command -v fw)" ]];
then
if [[ -x "$(command -v sk)" ]];
then
eval $(fw print-zsh-setup --with-skim 2>/dev/null);
elif [[ -x "$(command -v fzf)" ]];
then
eval $(fw print-zsh-setup --with-fzf 2>/dev/null);
else
eval $(fw print-zsh-setup 2>/dev/null);
fi;
fi;
export SUDO_EDITOR='nvim'
export EDITOR='nvim'
export PAGER='bat'
# zsh syntax highlight
[[ -f /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]] && {
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
}
## Local Variables:
## mode: shell-script
## End: