-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdot_zshrc
186 lines (158 loc) · 5.47 KB
/
dot_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
#==========================================
# Zsh Base Inits #
#=========================================
export BAT_THEME="Nord"
export ZSH="$HOME/.oh-my-zsh"
source $ZSH/oh-my-zsh.sh
export TERM="xterm-256color" # proper colors# Set name of the theme to
export EDITOR='nvim'
export PATH=$PATH:~/.local/share/nvim/mason/bin
export ZSH_DOTENV_PROMPT=false
export VIRTUAL_ENV_DISABLE_PROMPT=0
#THEME
ZSH_THEME="robbyrussell"
#==========================================
# Extras #
#=========================================
## -> External/Plugins
init_extras() {
echo "$HERE"
# source ~/.cache/wal/colors.sh
source ~/.oh-my-zsh/custom/plugins/zsh-autocomplete/zsh-autocomplete.plugin.zsh
source ~/.oh-my-zsh/plugins/aws/aws.plugin.zsh
plugins=(git nix-zsh-completions zsh-autosuggestions zsh-syntax-highlighting rye )
ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(bracketed-paste up-line-or-search down-line-or-search expand-or-complete accept-line push-line-or-edit)
alias astro4="NVIM_APPNAME=astronvim4 nvim"
## -> init External Scripts
# eval "$(pyenv init -)"
# eval "$(pyenv virtualenv-init -)"
eval "$(atuin init zsh)"
eval "$(starship init zsh)"
eval "$(zoxide init zsh)"
eval "$(thefuck --alias)"
}
#==========================================
# Functions #
#=========================================
function nnn () {
command nnn "$@"
if [ -f "$NNN_TMPFILE" ]; then
. "$NNN_TMPFILE"
fi
}
function ya() {
local tmp="$(mktemp -t "yazi-cwd.XXXXX")"
yazi "$@" --cwd-file="$tmp"
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
cd -- "$cwd"
fi
rm -f -- "$tmp"
}
# Api call helper
function api() {
if [ "$1" = "get" ]; then
curl -s "$2" | jless
elif [ "$1" = "post" ]; then
curl -s -X POST -d '{}' "$2" | jless
else
echo "Invalid operation. Use 'get' or 'post'."
fi
}
rm_confirm() {
local confirm
# If not, proceed with the standard confirmation
echo -n "Are you sure you wanna run 'rm -rf'? (yes/no): "
read confirm
if [ "$confirm" = "yes" ]; then
command rm "$@"
else
echo "Operation canceled."
fi
}
# Override git commit with a custom function
git_custom() {
if [[ $1 == "commit" ]]; then
sh ~/ZERO/SCRIPTS/git_commit.sh
elif [[ $1 == "user" ]]; then # Corrected the syntax here
sh ~/ZERO/SCRIPTS/git_user.sh
elif [[ $1 == "push" ]]; then
sh ~/ZERO/SCRIPTS/git_user.sh
# Call the original git command for other cases
command git "$@"
else
# Call the original git command for other cases
command git "$@"
fi
}
#==========================================
# Aliases/Exports #
#=========================================
## -> Aliases
alias src="source ~/.zshrc"
alias v="nvim"
alias home="cd ~"
alias n="nnn"
alias lss="ya"
alias matrix="unimatrix -c blue -u 'Linux'"
alias config="v ~/.zshrc"
alias ls='eza --color=always --icons --group-directories-first' # my preferred listing
alias la='eza -a --color=always --icons --group-directories-first' # all files and dirs
alias ll='eza -l --color=always --icons --group-directories-first' # long format
alias rm='rm_confirm'
alias apper='sh ~/ZERO/SCRIPTS/apper.sh'
alias git=git_custom
alias dots="chezmoi"
alias vida="cd $HOME/VIDA/"
alias work="cd $HOME/WORK/"
alias zero="cd $HOME/ZERO/"
alias cd="z"
alias net="gping www.google.com -c '#88C0D0,#B48EAD,#81A1C1,#8FBCBB'"
alias tree="tre"
alias gb="sh ~/ZERO/SCRIPTS/git_branch.sh"
alias gc="git commit"
alias fzf='fzf --color=16 --border=rounded --margin=1,3 --preview="bat {}"'
alias zf='nvim $(fzf --color=16 --border=rounded --margin=1,3 --preview="bat {}")'
## -> Exports
export NNN_FIFO=/tmp/nnn.fifo
export PATH=$PATH:/Users/zero/.spicetify e
export NNN_PLUG='p:previewimg;i:imgview;z:ipinfo'
export PYTHONPYCACHEPREFIX="${HOME}/.cache/Python"
export LDFLAGS="-L/opt/homebrew/opt/zlib/lib"
export CPPFLAGS="-I/opt/homebrew/opt/zlib/include"
export LDFLAGS="-L/opt/homebrew/opt/sqlite/lib"
export CPPFLAGS="-I/opt/homebrew/opt/sqlite/include"
export PATH="/opt/homebrew/opt/sqlite/bin:$PATH"
export NNN_TMPFILE="$HOME/.config/nnn/.lastd"
export EDITOR="$(which nvim)"
export VISUAL="$(which nvim)"
export MANPAGER="$(which nvim) +Man!"
export XDG_CONFIG_HOME="$HOME/.config"
# export PATH="$HOME/.pyenv/bin:$PATH"
export LIBTOOL="/opt/homebrew/bin/glibtool"
export LIBTOOLIZE="/opt/homebrew/bin/glibtoolize"
# Function to check terminal size
check_terminal_size() {
if [ "$(tput cols)" -gt 6 ] && [ "$(tput lines)" -gt 6 ]; then
execute_if_terminal_size_bigger
else
export STARSHIP_CONFIG=~/.config/starship_base.toml
eval "$(starship init zsh)"
fi
}
# Execute aliases and functions only if terminal size is bigger
execute_if_terminal_size_bigger() {
# Export aliases,exports and functions,extras
init_extras
}
check_terminal_size
export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
autoload -U compinit
compinit -i
export GOPATH="${HOME}/.go"
export GOROOT="$(brew --prefix golang)/libexec"
export PATH="$PATH:${GOPATH}/bin:${GOROOT}/bin:/usr/local/mysql/bin"
source "$HOME/.rye/env"
test -d "${GOPATH}" || mkdir "${GOPATH}"
test -d "${GOPATH}/src/github.com" || mkdir -p "${GOPATH}/src/github.com"