-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzshrc_update
77 lines (66 loc) · 1.93 KB
/
zshrc_update
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
# Somewhat unsafely check for .bashrc and collect any PATH mods from it
if [ -f "$HOME/.bashrc" ]; then
grep 'export PATH=' "$HOME/.bashrc" | while read -r line; do
case "$line" in
export\ PATH=*) eval "$line" ;;
*) ;;
esac
done
fi
# History
setopt histignorealldups sharehistory
HISTSIZE=SAVEHIST=10000
HISTFILE=$HOME/.zsh_history
# Theme
ZSH_THEME="robbyrussell"
# Paths
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src
export ZSH="$HOME/.oh-my-zsh"
# Plugins
plugins=(
fzf
git
history-substring-search
ohmyzsh-full-autoupdate
zsh-autosuggestions
zsh-completions
zsh-vi-mode
)
# Source Oh-My-Zsh
source $ZSH/oh-my-zsh.sh
# User Configuration
export EDITOR='nvim'
# Aliases
alias b="cd .."
alias bb="cd ../.."
alias bbb="cd ../../.."
alias bbbb="cd ../../../.."
alias bbbbb="cd ../../../../.."
alias bbbbbb="cd ../../../../../.."
alias lzd="lazydocker"
alias pnuke="perl -e 'for(<*>){unlink}'"
alias so="source $HOME/.zshrc"
# Functions
function count_pdbs() { find -type f -name "*.pdb*" | wc -l; }
function fetch() { wget http://www.rcsb.org/pdb/files/$1.pdb.gz || wget ftp://ftp.wwpdb.org/pub/pdb/data/structures/all/pdb/pdb$1.ent.gz; }
function gh_auth() { BROWSER=false gh auth login --web }
function mcd() { mkdir -p $1; cd $1; }
function swap() {
local TMPFILE=tmp.$$
mv "$1" $TMPFILE
mv "$2" "$1"
mv $TMPFILE "$2"
}
function fetch_aws_batch_logs() {
local log_stream_name=$1
local cmd="aws logs get-log-events --log-group-name /aws/batch/job --log-stream-name ${log_stream_name} --start-from-head --output text"
local response=$(eval "$cmd") || return 1
while :; do
if [[ $(wc -l <<< "$response") -eq 1 ]]; then
break
fi
tail -n +2 <<< "$response"
local meta=($(head -n 1 <<< "$response"))
response=$(eval "$cmd --next-token ${meta[1]}") || return 1
done
}