-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc-mac
144 lines (123 loc) · 3.41 KB
/
zshrc-mac
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
# Created by Zap installer
if [ -f "$HOME/.local/share/zap/zap.zsh" ]; then
source "$HOME/.local/share/zap/zap.zsh"
else
zsh <(curl -s https://raw.githubusercontent.com/zap-zsh/zap/master/install.zsh) --branch release-v1
curl -s https://raw.githubusercontent.com/reaper8055/devpod/main/zshrc > $HOME/.zshrc
builtin source $HOME/.zshrc
fi
# tmux backspace fix
bindkey "^H" backward-delete-char
bindkey "^?" backward-delete-char
# default editor
export EDITOR=nvim
# Plugins
plug "hlissner/zsh-autopair"
plug "zsh-users/zsh-autosuggestions"
plug "zsh-users/zsh-syntax-highlighting"
plug "jeffreytse/zsh-vi-mode"
plug "zap-zsh/supercharge"
plug "zap-zsh/exa" # this plugin needs to be after zap-zsh/supercharge as per https://github.com/zap-zsh/exa/issues/3
plug "Aloxaf/fzf-tab"
plug "zap-zsh/fzf"
# Aliases
alias n="nvim"
alias .="builtin source $HOME/.zshrc"
alias zshrc="nvim $HOME/.zshrc"
alias kc="nvim $HOME/.config/kitty/kitty.conf"
alias wez="nvim $HOME/.config/wezterm/wezterm.lua"
alias tc="nvim $HOME/.config/tmux/tmux.conf"
alias git-remote-url="git remote set-url origin"
alias nix-search="nix-env -qaP"
alias c2c="pbcopy <"
alias path="echo $PATH | sed -e 's/:/\n/g'"
alias temp='sudo powermetrics --samplers smc | grep -i "CPU die temperature"'
alias grep="grep --color=always"
# alias tmux="tmux -u"
function update-zshrc() {
curl -s https://raw.githubusercontent.com/reaper8055/devpod/main/zshrc-mac > $HOME/.zshrc
builtin source $HOME/.zshrc
}
function install-starship() {
curl -sS https://starship.rs/install.sh | sh
}
function install-nix() {
sh <(curl -L https://nixos.org/nix/install) --daemon
}
function zap-init() {
zsh <(curl -s https://raw.githubusercontent.com/zap-zsh/zap/master/install.zsh) \
--branch release-v1
}
function gen-nix-shell() {
cat > shell.nix <<EOF
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
mkShell {
buildInputs = [
go
zsh
gotools
gopls
go-outline
gocode
gopkgs
gocode-gomod
godef
golint
fnm
nodejs
yarn
rnix-lsp
fd
golangci-lint
];
shellHook = ''
export GIT_CONFIG_NOSYSTEM=true
export GIT_CONFIG_SYSTEM="$HOME/Projects/configs/github/github_global"
export GIT_CONFIG_GLOBAL="$HOME/Projects/configs/github/github_global"
'';
}
EOF
}
function gen-envrc() {
cat > .envrc <<EOF
use nix shell.nix
EOF
}
function nix-init() {
gen-nix-shell
gen-envrc
direnv allow
}
function gogh() {
bash -c "$(wget -qO- https://git.io/vQgMr)"
}
function autosuggestions_init() {
[ -f "$HOME/.local/share/zap/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" ] && \
source "$HOME/.local/share/zap/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh"
}
function autopair_init() {
[ -f "$HOME/.local/share/zap/plugins/zsh-autopair/autopair.zsh" ] && \
source "$HOME/.local/share/zap/plugins/zsh-autopair/autopair.zsh"
}
zvm_after_init_commands+=(
autopair_init
autosuggestions_init
)
# starship.rs
export STARSHIP_CONFIG="$HOME/.config/starship/starship.toml"
eval "$(starship init zsh)"
# direnv hook
eval "$(direnv hook zsh)"
# fzf
export FZF_DEFAULT_OPTS=$FZF_DEFAULT_OPTS'
--color=dark
--color=hl:#5fff87,fg:-1,bg:-1,fg+:-1,bg+:-1,hl+:#ffaf5f
--color=info:#af87ff,prompt:#5fff87,pointer:#ff87d7,marker:#ff87d7,spinner:#ff87d7
--border'
# fzf-tab config
zstyle ':fzf-tab:*' fzf-min-height 10
# fnm
export PATH="$HOME/Library/Application\ Support/fnm:$PATH"
eval "`fnm env`"
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh