-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
140 lines (115 loc) · 3.73 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
# keys
bindkey -e
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
bindkey "''${key[Up]}" up-line-or-search
# show git stash icon
zstyle :prompt:pure:git:stash show yes
# highlight current tab selection
autoload -U compinit && compinit
zstyle ':completion:*' menu select
setopt autocd
setopt menucomplete
# history
setopt sharehistory
setopt hist_ignore_dups
setopt hist_find_no_dups
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
# antidote
antidote_path=/home/benlubas/.antidote
# homebrew - I'm not using this on NixOS
# eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
alias screen_cap="ffmpeg -select_region 1 -show_region 1 \
-framerate 30 -f x11grab -i :0.0 \
-pix_fmt +yuv420p -vf scale='-2:1080' \
-movflags +faststart \
-preset slower -y ~/Videos/screen_cap.mp4"
alias copy="xclip -r -selection clipboard"
alias paste="xclip -selection clipboard -o"
# this only works b/c I've chowned the etc/nixos folder
alias conf="nvim /etc/nixos/configuration.nix"
alias rebuild="nixos-rebuild switch --use-remote-sudo"
elif [[ "$OSTYPE" == "darwin"* ]]; then
# antidote
antidote_path=/opt/homebrew/Cellar/antidote/1.9.0/share/antidote
# homebrew
eval "$(/opt/homebrew/bin/brew shellenv)"
# allow the magick rock to find ImageMagick
export DYLD_LIBRARY_PATH=/opt/homebrew/lib/:$DYLD_LIBRARY_PATH
else
echo "[.zshrc] unknown OS - please add this OS to the ~/.zshrc file"
exit 1
fi
zsh_plugins=$HOME/.zsh_plugins
source ${antidote_path}/antidote.zsh
antidote load
source ${zsh_plugins}.zsh
if [ -f $HOME/.zshsecrets ]; then
source $HOME/.zshsecrets
fi
if [ -f $HOME/.zshwork ]; then
source $HOME/.zshwork
fi
# bob
export PATH=$HOME/.local/share/bob/nvim-bin:$PATH
# fnm
export PATH=$HOME/.fnm:$PATH
eval "$(fnm env --use-on-cd)"
# rust-analyzer
export PATH=$HOME/.local/bin:$PATH
export PATH=$HOME/.cargo/bin:$PATH
# personal scripts
export PATH=$HOME/github/.dotfiles/bin:$PATH
source $HOME/github/.dotfiles/zsh_extras.sh
export EDITOR="nvim"
export GIT_EDITOR="MD_MODE=1 nvim"
export COLOR_THEME="carbonfox"
# to use bat with man pages
export MANROFFOPT="-c"
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
# have to set this on macOS otherwise it looks in some random mac-specific folder
export JJ_CONFIG=${XDG_CONFIG_HOME:-"$HOME/.config"}/jj/config.toml
# ==== Aliases ==== #
alias v=nvim
alias kvm="ssh [email protected]"
alias kvnvim="nvim oil-ssh://[email protected]//home/benlubas/README.md"
# Git Aliases
alias gh="MD_MODE=1 gh" # pass this to nvim so that I can set a few custom config options
alias gs="git status"
alias gd="git diff"
alias ga="git add"
alias gd="git diff"
alias gdm="git diff --merge-base main"
alias gc="git checkout"
alias gcm="git checkout main"
alias gcb="git checkout -b"
alias gl="git log --oneline --decorate --graph"
alias gcam="git commit -am"
alias amend="git commit --amend"
alias pull="git pull"
alias push="git push"
# JJ Aliases
alias js="jj status"
alias jd="jj diff"
alias jl="jj log"
alias je="jj edit"
alias jab="jj abandon"
alias ls="ls --color"
alias l="ls -lah"
alias testit="cargo test --workspace --test tests --" # quick cargo tests in typst repo
# grep only the files that changed on this branch from main, useful for making sure you're not forgetting anything
grg() {
branch=$(git branch --show-current)
rg --no-messages "$@" $(git diff --name-only $branch $(git merge-base $branch main) | tr '\n' ' ')
}
syncnotes() {
pushd ~/notes
git add * && (git diff-index --quiet HEAD || git commit -am "sync") && git pull && git push && popd && echo "notes synced" || echo "notes sync failed"
}
alias mx=tmux-sessionizer
alias tx=tmux-sessions
# direnv
eval "$(direnv hook zsh)"