-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
150 lines (125 loc) · 4.03 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
143
144
145
146
147
148
149
150
# -- Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# use main_home to target only in your main user
# use $HOME to target per-user home
main_home="/home/paolo"
# -- zsh options
# https://zsh.sourceforge.io/Doc/Release/Options.html
setopt autocd # no need to write `cd` to change a directory
autoload -Uz compinit && compinit
# -- nice word jumping and deleting
autoload -U select-word-style
select-word-style bash
export WORDCHARS=''
bindkey "^[[1;5C" forward-word # ctrl + right
bindkey "^[[1;5D" backward-word # ctrl + left
bindkey "^H" backward-delete-word # ctrl + backspace
bindkey '^[[3;5~' delete-word # ctrl + delete
# -- Keep 1000 lines of history within the shell and save it to ~/.zsh_history:
HISTSIZE=100000
SAVEHIST=100000
HISTFILE=~/.zsh_history
# -- colors for less
export LESS='-S -R --use-color -Dd+r$Du+b'
# -- disable microsoft spyware for dotnet
export DOTNET_CLI_TELEMETRY_OPTOUT="1"
# -- fly.io cli
export FLYCTL_INSTALL="$main_home/.fly"
# -- some tools setup
export GOPATH="$main_home/.local/go"
export JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64"
export PNPM_HOME="$main_home/.config/local/share/pnpm"
export DENO_INSTALL="$main_home/.deno"
export BUN_INSTALL="$main_home/.bun"
export GITIN_LINESIZE=15
export GITIN_VIMKEYS=false
# gh: arpitbbhayani/py-prompts
#export PYTHONSTARTUP=/home/paolo/.py-prompts/themes/simple-colors.py
export WINEPREFIX=~/.wine32
# -- Manual aliases
alias ls='lsd --group-dirs=first'
alias ll='ls -lh'
alias lla='ls -lha'
alias la='ls -a'
alias cat='batcat --theme=TwoDark'
alias dots="/usr/bin/git --work-tree=$HOME --git-dir=$HOME/.dotfiles"
alias gitin='gitin status'
alias grep='grep --color=always'
alias gc='git commit -v'
alias gca='git commit -v --amend'
alias zshrc="source $main_home/.zshrc"
alias docker='export UID GID; docker'
# reverse path alias 'cd ..'
for i in {1..10}; do
dots_alias=$(printf '.%.0s' {0..$i})
cd_command="cd $(printf '../%.0s' {1..$i})"
alias $dots_alias=$cd_command
done
if which kitty >/dev/null 2>&1; then
alias ssh="kitty +kitten ssh"
alias icat="kitty +kitten icat"
fi
# -- utilities
cap () { tee /tmp/capture.out; }
ret () { cat /tmp/capture.out; }
gclone() {
git clone --depth=1 $1
cloned=$(find . -maxdepth 1 -printf "%T@ %p\n" | sort -nr | awk 'NR==1 { print $2 }')
cd $cloned
}
mkgo () { mkdir -p $1 && cd $1 }
startaws () {
autoload bashcompinit && bashcompinit
autoload -Uz compinit && compinit
complete -C '/usr/local/bin/aws_completer' aws
export AWS_PROFILE="probaar-aws-iam"
}
paths=(
/usr/local/bin
/usr/local/go/bin
/opt/flutter/bin
/opt/android-studio/bin
/opt/Android/Sdk/cmdline-tools/latest/bin
$GOPATH/bin
/snap/bin
$HOME/.local/bin
$main_home/.config/local/share/fnm
$main_home/.config/local/share/coursier/bin
$HOME/.local/bin
$PNPM_HOME
$main_home/.dotnet
$main_home/.scripts
$FLYCTL_INSTALL/bin
$DENO_INSTALL/bin
$BUN_INSTALL/bin
/opt/datagrip/bin/
)
for p in ${(Oa)paths}; do
PATH=:$PATH:
PATH=$p${PATH//:$p:/:}
PATH=${PATH%:}
done
# -- init environments
eval "`fnm env`"
. "$main_home/.cargo/env"
[ -s "$main_home/.bun/_bun" ] && source "$main_home/.bun/_bun"
export PYENV_ROOT="$main_home/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
# eval "$(pyenv init -)"
# Load pyenv-virtualenv automatically by adding the following to ~/.bashrc:
# eval "$(pyenv virtualenv-init -)"
# -- load plugins
. ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh
. ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
. ~/.zsh/zsh-completions/zsh-completions.plugin.zsh
. ~/.zsh/completion.zsh
. ~/.zsh/zsh-history.zsh
. ~/.zsh/sudo.plugin.zsh
. ~/.zsh/.fzf.zsh
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
. ~/.p10k.zsh
. ~/.config/powerlevel10k/powerlevel10k.zsh-theme
# bun completions
[ -s "/home/paolo/.bun/_bun" ] && source "/home/paolo/.bun/_bun"