-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
142 lines (118 loc) · 4.86 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
# Reconstructing my .zshrc file after I deleted it by accident. ... oops.
# 2023-04-29: Adding basic environmental variables & zsh utilities
# 2023-04-30: Tweaks to prompts
# 2023-05-07: Changes based on settuping up Arch (btw) on the home pc.
# 2023-09-05: Learned about dirstack and fixing history
# 2023-09-08: Remembering I installed things like fd
# 2023-09-23: Switching to helix, darkmode/lightmode aliases
# 2023-11-30: Email at the command line in 2023
# 2023-12-07: Ransacking Oh My Zsh
##### Dark Mode / Light Mode #####
#### Command-line changes ####
## fast-theme XDG:catppuccin-foo##
# A-E-S-T-H-E-T-I-C
export EDITOR=hx
export HOMEBREW_INSTALL_BADGE='☕☕☕'
export RPROMPT='%F{green}%h%f | %F{magenta}%T%f'
export PROMPT='%F{blue}%~>%f'
# find, fd, fzf
export FZF_COMPLETION_TRIGGER='??'
export FZF_DEFAULT_COMMAND='fd --type f --strip-cwd-prefix --hidden --follow --exclude .git'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_DEFAULT_OPTS=" \
--reverse \
--border=double \
--info=inline \
--padding=1 \
--height=12 \
--prompt=: \
--pointer=—"
## fzf catppuccin: macchiato first, latte second
export FZF_DEFAULT_OPTS=" \
--color=bg+:#363a4f,bg:#24273a,spinner:#f4dbd6,hl:#ed8796 \
--color=fg:#cad3f5,header:#ed8796,info:#c6a0f6,pointer:#f4dbd6 \
--color=marker:#f4dbd6,fg+:#cad3f5,prompt:#c6a0f6,hl+:#ed8796"
#export FZF_DEFAULT_OPTS=" \
#--color=bg+:#ccd0da,bg:#eff1f5,spinner:#dc8a78,hl:#d20f39 \
#--color=fg:#4c4f69,header:#d20f39,info:#8839ef,pointer:#dc8a78 \
#--color=marker:#dc8a78,fg+:#4c4f69,prompt:#8839ef,hl+:#d20f39"
fh() {
eval $( ([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s --tac | sed 's/ *[0-9]* *//')
}
# Herstory
HISTSIZE=1000000
SAVEHIST=1000000
setopt HIST_EXPIRE_DUPS_FIRST # minimize dups on stack
setopt SHARE_HISTORY # persist history (persistory)
setopt HIST_IGNORE_DUPS # do not record if dup of prior
setopt APPEND_HISTORY # append history instead of replace ...
setopt INC_APPEND_HISTORY # append history right now seriously
setopt HIST_IGNORE_SPACE # sometimes secret things go into commands and you don't want them saved
# Directory stack to navigate
DIRSTACKSIZE=8
setopt AUTOPUSHD # cd into pushd
setopt PUSHDIGNOREDUPS # no dups on the stack
setopt PUSHDMINUS # invert +/-
setopt PUSHDSILENT # don't print stack every time
setopt PUSHDTOHOME # go to ~ with argumentless pushd
alias dh='dirs -v' # set dh to become a 'directory history' command
# Setting some basic options
setopt AUTO_CD # cd without cd
setopt NOTIFY # notify when jobs finish
# Plugins
source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh
source /opt/homebrew/share/zsh-fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
# Basic custom path stuff
export PATH="${HOME}/bin:${PATH}"
export PATH="/opt/homebrew/opt/postgresql@12/bin:$PATH"
export PATH="/opt/homebrew/bin/python3:$PATH"
# Common aliases cobbled from old reddit posts and github repos
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias cat='bat --paging=never'
alias l='ls'
alias ls='ls --color'
alias la='ls -AFGhloyu'
alias mkdir='mkdir -pv'
alias lsd='ls -lGd */'
alias sudo='sudo '
alias weather-forecast='curl -s "wttr.in/{Springdale,Oxford},%20Ohio?1mFnq"'
alias weather='curl -s "wttr.in/{Springdale,Oxford},%20Ohio?m&format=4"'
alias pip='pip3'
alias python='python3'
alias password='LC_ALL=C tr -dc "[:alnum:]" < /dev/urandom | head -c 20 | pbcopy'
# Various useful things I've hacked together
alias {lightmode,darkmode}="hx ~/.zshrc ~/.config/alacritty/alacritty.toml ~/.config/sketchybar/sketchybarrc ~/.config/helix/config.toml ~/.config/bat/config"
## going to simplify / overhaul this
## cf. bat docs? `alias cat="bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo default || echo GitHub)"`
### TODO Prepare for breaking changes
alias emx='himalaya --account=personal && himalaya'
alias email='himalaya'
### TODO The above aliases need to change for 1.0.0 release
cargo_update() {
for pkg in $(cargo install --list | awk '/:$/ { print $1; }'); do
cargo install $pkg
done
}
# Directly stolen from oh-my-zsh
alias g='git'
alias ga='git add'
alias gaa='git add --all'
alias gapa='git add --patch'
alias gau='git add --update'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gcs='git commit -S'
alias gcl='git clone --recurse-submodules'
alias gf='git fetch'
alias gfa='git fetch --all --prune'
alias gl='git pull'
alias gp='git push'
alias gpd='git push --dry-run'
# Things added by other things
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh