blob: a720792bc702533b1d0501ccf08e58c54e0a150f (
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
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
# ~/.zshrc
export GPG_TTY=$(tty)
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
if [ "$TERM" = "linux" ]; then
PROMPT='%(?..(%?%) )'
[ -n "$SSH_CLIENT" ] && PROMPT+="[%n@%M] "
PROMPT+='%c %(!.#.$) '
return
fi
# Path to your oh-my-zsh installation.
export ZSH="${XDG_CONFIG_HOME:-$HOME/.config}/oh-my-zsh"
ZSH_THEME="0undefined"
# Uncomment the following line to use case-sensitive completion.
CASE_SENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to automatically update without prompting.
DISABLE_UPDATE_PROMPT="true"
# Uncomment the following line to change how often to auto-update (in days).
export UPDATE_ZSH_DAYS=31
# Uncomment the following line if pasting URLs and other text is messed up.
DISABLE_MAGIC_FUNCTIONS=true
# Uncomment the following line to disable auto-setting terminal title.
DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
#COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
#plugins=(git)
source $ZSH/oh-my-zsh.sh
# User configuration
export MANWIDTH=${MANWIDTH:-80}
man() {
LESS_TERMCAP_md=$'\e[01;38;5;147m' \
LESS_TERMCAP_me=$'\e[0m' \
LESS_TERMCAP_se=$'\e[0m' \
LESS_TERMCAP_so=$'\e[48;5;235;01;38;5;250m' \
LESS_TERMCAP_ue=$'\e[0m' \
LESS_TERMCAP_us=$'\e[38;5;104m' \
command man "$@"
}
setopt nonomatch
setopt interactivecomments
HISTFILE="${XDG_DATA_HOME:-$HOME/.local/share}/histfile"
HISTSIZE=32768
SAVEHIST=32768
setopt hist_ignore_all_dups
setopt hist_reduce_blanks
setopt no_share_history
setopt no_histverify
autoload -Uz compinit
compinit -d ~/.cache/zcompdump-$ZSH_VERSION
autoload -Uz promptinit
promptinit
export KEYTIMEOUT=1
set -o vi
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() {
# # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
# zle -K viins
# echo -ne "\e[5 q"
# }
#zle -N zle-line-init
echo -ne '\e[5 q' # Use beam shape cursor on startup.
# preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
autoload -Uz edit-command-line
zle -N edit-command-line
bindkey -M vicmd ' ' edit-command-line
bindkey "^e" end-of-line
bindkey "^a" beginning-of-line
bindkey -M vicmd "^e" end-of-line
bindkey -M vicmd "^a" beginning-of-line
bindkey "${terminfo[khome]}" beginning-of-line
bindkey "${terminfo[kend]}" end-of-line
bindkey "^[[3~" delete-char
bindkey "^[3;5~" delete-char
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
autoload -U up-line-or-beginning-search
autoload -U down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
bindkey "^[A" up-line-or-beginning-search
bindkey "^[OA" up-line-or-beginning-search
bindkey "^[B" down-line-or-beginning-search
bindkey "^[OB" down-line-or-beginning-search
## Handy functions
upload () {
curl -F file=@${1} http://0x0.st
}
activate () {
if [[ $1 == "" ]]; then
ls --color=no -A ~/.env
else
source ~/.env/$1/bin/activate
fi
}
goto() {
cd ~/gits/personal/Documents/$1
}
stopwatch() {
clear
date1=`date +%s`;
while true; do
echo -ne "\r$(date -u --date @$((`date +%s` - $date1)) +%H:%M:%S)";
sleep 0.1
done
}
fs () {
if [[ $1 == "" ]]; then
printf ']710;%s' "xft:DejaVuSansMono Nerd Font Mono:pixelsize=14"
else
printf ']710;%s' "xft:DejaVuSansMono Nerd Font Mono:pixelsize=${1}"
fi
}
calcgrade () {
if [ -z $1 ]; then
echo "Please submit an argument"
fi
D=$(find . -maxdepth 3 -name $1\* -type d)
if [ -z $D ]; then
echo $1 "not found"
else
ls $D/guidelines.mrk
echo $( \
grep -oE "([0-9]+(\.[0-9]+)?)/[0-9]+" $D/guidelines.mrk \
| sed -Ee 's/^([0-9]+(\.[0-9]+)?)\/.*/\1/g' \
| tr '\n' '+' \
| sed -Ee 's/^(.*)\+$/\1/g' -e 's/\+/ + /g') \
| bc
fi
}
fr () {
which futhark > /dev/null
if [ ! -z $? ]; then
activate futhark
fi
futhark repl
}
## Aliases
alias :q='exit'
alias cgpu='sshpass -e ssh -l qgt268 ku-gpu'
alias fsharpi='fsharpi --nologo'
alias fsharpc='fsharpc --nologo --standalone'
alias gdb='gdb -q'
alias glog2="git log --graph --abbrev-commit --decorate --format=format:'%Cgreen%h%C(reset) [%G?] %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%Cred%d%C(reset)' --all"
alias glog='git log --pretty="%Cgreen%H%Creset [%G?] %cn: %s %Cred%d%Creset"'
alias ls='ls --color=auto'
alias mutt='neomutt'
alias pbcopy='xclip -selection clipboard -i'
alias pbpaste='xclip -selection clipboard -o'
alias push='git push && mpg123 ~/Downloads/Mario-coin-sound.mp3'
alias s='vim $(fzf)'
alias scan='sudo iwlist wlp3s0 scan > /dev/null'
alias v='echo -ne "\e[1 q" && vim --servername vim'
alias less='less -R'
## Do before dropping into shell
source ~/.secrets/sshpass
BANNERFILE=~/.config/texts/todo.md
if [[ $(tput cols) -gt 140 ]]; then
pr -mtW 140 $BANNERFILE ~/.config/texts/setsail
else
cat $BANNERFILE
fi
|