-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
343 lines (268 loc) · 9.58 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
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
#!/bin/zsh
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
# if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
# source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
# fi
# Stop script of any command return non-zero
# set -e
#zsh_theme="powerlevel10k/powerlevel10k"
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
#[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# export LC_CTYPE="en_US.UTF-8"
###########################
plugins=(
colorize
command-not-found
zsh-completions
zsh-autosuggestions
zsh-syntax-highlighting
)
###########################
# precmd_vcs_info() { vcs_info }
# precmd_functions+=( precmd_vcs_info )
setopt prompt_subst
RPROMPT='${vcs_info_msg_0_}'
PROMPT='${vcs_info_msg_0_}%# '
zstyle ':vcs_info:git:*' formats '%b'
#fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=5'
# Load Git completion
zstyle ':completion:*:*:git:*' script ~/.zsh/git-completion.bash
fpath=(~/.zsh $fpath)
autoload -Uz compinit && compinit
# Make any executable placed in ~/bin discoverable on $PATH
if [ -d "$HOME/bin" ]; then
export PATH="$HOME/bin:$PATH"
fi
# Make any executable placed in ~/.local/bin discoverable on $PATH
if [ -d "$HOME/.local/bin" ]; then
export PATH="$HOME/.local/bin:$PATH"
fi
export KITTY_CONFIG_DIRECTORY="$HOME/.config/kitty/kitty.conf"
# Increase Bash history size. Allow 32³ entries; the default is 500.
#
HISTFILE=~/.zsh_history
HISTSIZE=32768
SAVEHIST=30000
HISTFILESIZE="${HISTSIZE}"
setopt APPENDHISTORY
# Ignore duplicates, ls without options and builtin commands
#
HISTCONTROL=ignoreboth
HISTIGNORE="&:ls:[bf]g:exit"
# Modify history file
#
setopt INC_APPEND_HISTORY
HISTTIMEFORMAT="[%F %T] "
# Add timestampt to command
#
setopt EXTENDED_HISTORY
# No Duplicates
#
setopt HIST_IGNORE_ALL_DUPS
setopt SHARE_HISTORY
unsetopt HIST_IGNORE_DUPS
# Color for manpages
#
export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;31m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;44;33m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;32m'
# Make emacs the default editor.
#
export EDITOR='emacs'
# Add the Rust binaries
#
export PATH="$PATH:/home/djhunter67/.cargo/bin"
# Change caps lock to left CTRL
#xmodmap ~/.Xmodmap
# Make Python use UTF-8 encoding for output to stdin, stdout, and stderr.
#
export PYTHONIOENCODING='UTF-8'
# Prefer US English and use UTF-8.
#
export LANG='en_US.UTF-8'
export LC_ALL='en_US.UTF-8'
# Highlight section titles in manual pages.
#
export LESS_TERMCAP_md="${yellow}"
# Golang Library and dependancies
export PATH=$PATH:/usr/local/go/bin
# Replace Emacs hash table deserialization method.
export LSP_USE_PLISTS=true
#######################################
# User specific aliases
#######################################
# alias python='/usr/local/bin/python3.10'
# alias pip='/usr/local/bin/python3.10 -m pip'
# [ "$TERM" = "xterm-kitty" ] && alias ssh='kitty +kitten ssh'
export TERM=xterm
alias Ripley='ssh [email protected]'
alias ubuntu_box='kitty +kitten ssh [email protected]'
#alias venv="python -m venv venv && source venv/bin/activate && pip install -U pip setuptools &> /dev/null && git init &> /dev/null && touch README.md && git add . && git cm 'init git' && git st"
alias webcam="sudo modprobe v4l2loopback exclusive_caps=1 max_buffers=2; pkill -f gphoto2 && gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -threads 4 -f v4l2 /dev/video0"
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias l="ls -lFh --color=auto"
alias ll="pls --align --multi-cols -d group -d size -d atime -u decimal -s atime --dirs --files"
alias icat="kitty +kitten icat"
alias la="pls -a -d -s mtime -u decimal -i nerd -c --no-dirs"
alias dif="kitty +kitten diff"
# cd into the old directory
#
alias bd='cd "$OLDPWD"'
# Use the emacs server
#
#alias emacs='emacsclient'
# Grep, egrep, zgrep colors
#
alias grep='grep --color=auto' # GREP_OPTIONS is deprecated
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
# Allow aliases to be sudo'ed
#
alias sudo='sudo '
# Get the week number
#
alias week='date +%V'
# Clean alias and path list
#
alias aliases="alias | sed 's/=.*//'"
alias paths='echo -e ${PATH//:/\\n}'
# Return only the WAN IP
#
#alias ip="curl -s ipinfo.io | jq -r '.ip'"
# 100MB Speedtest
#
alias speedtest="wget -O /dev/null http://speed.transip.nl/100mb.bin"
# Make CAPS LOCK into CTRL
#
#xmodmap ~/.Xmodmap
# Clear DELUGE
#
# alias DELUGE='rm -rf ~/Downloads/DELUGE/*'
######################################
# User defined functions
######################################
# Replace up../../../../
#
up() {
local d=""
limit=$1
for ((i = 1; i <= limit; i++)); do
d=$d/..
done
d=$(echo $d | sed 's/^\///')
if [ -z "$d" ]; then
d=..
fi
cd $d
ll
}
# Create a new directory and enter it
#
function mkd() {
mkdir -p "$@" && cd "$_"
}
# Use Git’s colored diff when available
#
hash git &>/dev/null
if [ $? -eq 0 ]; then
function diff() {
git diff --no-index --color-words "$@"
}
fi
# Create a data URL from a file
#
function dataurl() {
local mimeType=$(file -b --mime-type "$1")
if [[ $mimeType == text/* ]]; then
mimeType="${mimeType};charset=utf-8"
fi
echo "data:${mimeType};base64,$(openssl base64 -in "$1" | tr -d '\n')"
}
# `tre` is a shorthand for `tree` with hidden files and color enabled, ignoring
# the `.git` directory, listing directories first. The output gets piped into
# `less` with options to preserve color and line numbers, unless the output is
# small enough for one screen.
#
function tre() {
tree -aC -I '.git|node_modules|bower_components' --dirsfirst "$@" | less -FRNX
}
function r_sync() {
rsync -Paurvh --stats --progress $1 $2
}
# `venv` is a function that will initialize a python virtualenv virtual envrionment with the name 'venv'
# The virtual environment will be activated and update pip. Basic directory structure will be set up.
# The venv function will suppress all output except the last line; git init.
function venv() {
python3.11 -m venv venv
source venv/bin/activate
pip install -U pip setuptools >/dev/null
git init &>/dev/null
git branch -M trunk
[[ -e ./README.md ]] && echo > README.md
[[ -e ./LICENSE ]] && echo > LICENSE
[[ -e ./CHANGELOG.md ]] && echo > CHANGELOG.md
cat <<EOT >> CHANGELOG.md
# CHANGELOG
Author: Hunter, Christerpher
All notable changes will be appended here.
This project, henceforth, will recongnize [semantic versioning](https://semver.org/).
[⭐.✴️.✳️] - YEAR MONTH DAY
Here we write upgrade and change notes.
⭐ MAJOR version when you make incompatible API changes,
✴️ MINOR version when you add functionality in a backwards compatible manner
✳️ PATCH version when you make backwards compatible bug fixes.
--------------------------------------
✳️[0.0.1] - 2023 JUNE 25
- Automatic initialization of the project structure
EOT
[[ -f ~/.gitignore_global ]] && cat /home/djhunter67/.gitignore_global > .gitignore
mkdir -p ./src
mkdir -p .github
mkdir -p .github/workflows
pushd .github
[[ -e pull_request_template ]] && echo >> pull_request_template.md
cat <<EOT >> pull_request_template.md
This PR...
## Changes
-
## Screenshots10
(prefer animated gif)
## Checklist
- [ ] synced trunk
- [ ] tested locally
- [ ] added new dependencies
- [ ] updated the docs
- [ ] added a test
# Fixes
EOT
popd
git add . &>/dev/null &&
git cm "init: initializing the project" &>/dev/null &&
tre -L 3 -I venv
}
source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme
# Lines configured by zsh-newuser-install
setopt beep extendedglob nomatch
source /home/djhunter67/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
unset ZSH_AUTOSUGGEST_USE_ASYNC
export GPG_TTY=$(tty)
export PATH=/home/djhunter67/.local/bin:/home/djhunter67/.local/bin:/home/djhunter67/bin:/home/djhunter67/.cargo/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/djhunter67/.cargo/bin:/usr/local/go/bin