-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
147 lines (118 loc) · 3.79 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
# Exec fastfetch
fastfetch
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
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
# Initialize autocompletion
zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
zstyle ':completion:*' menu select=long
zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
zstyle :compinstall filename '/home/felipefontoura/.zshrc'
autoload -Uz compinit
compinit
# History setup
setopt APPEND_HISTORY
setopt SHARE_HISTORY
HISTFILE=$HOME/.zhistory
SAVEHIST=1000
HISTSIZE=999
setopt HIST_EXPIRE_DUPS_FIRST
setopt EXTENDED_HISTORY
bindkey -v
# Autocompletion using arrow keys (based on history)
bindkey '\e[A' history-search-backward
bindkey '\e[B' history-search-forward
# Home, End, Insert and Delete keys
bindkey "^[[H" beginning-of-line
bindkey "^[[F" end-of-line
bindkey "^[[3~" delete-char
bindkey "^H" backward-delete-word
# No beep
setopt NO_BEEP
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source ~/.zsh/zsh-history-substring-search/zsh-history-substring-search.zsh
source /opt/asdf-vm/asdf.sh
source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# Export ENV
[[ ! -f ~/.env ]] || source ~/.env
# Git
alias g="git"
alias gcl="git clone"
alias gck="git checkout"
alias gst="git status"
alias gdf="git diff"
alias gad="git add"
alias gcm="git commit"
alias gpl="git pull"
alias gps="git push"
alias grb="git rebase"
# Rails
alias rce="bin/rails credentials:edit"
alias rcs="bin/rails credentials:show"
alias rgmi="bin/rails generate migration"
alias rdmi="bin/rails destroy migration"
alias rgmd="bin/rails generate model"
alias rdmd="bin/rails destroy model"
alias rgct="bin/rails generate controller"
alias rdct="bin/rails destroy controller"
alias rghp="bin/rails generate helper"
alias rdhp="bin/rails destroy helper"
alias rgjb="bin/rails generate job"
alias rdjb="bin/rails destroy job"
alias rgat="bin/rails generate authentication"
alias rdat="bin/rails destroy authentication"
alias rc="bin/rails console"
alias rr="bin/rails routes"
alias rt="bin/rails test"
alias rtm="bin/rails test:models"
alias rtc="bin/rails test:controllers"
alias rth="bin/rails test:helpers"
alias rts="bin/rails test:system"
alias rta="bin/rails test:all"
alias rdbst="bin/rails db:setup"
alias rdbcr="bin/rails db:create"
alias rdbmi="bin/rails db:migrate"
alias rdbrb="bin/rails db:rollback"
alias rdbsd="bin/rails db:seed"
alias fsd="bundle exec foreman start -f Procfile.dev"
alias fsp="bundle exec foreman start -f Procfile"
# Bundle
alias bi="bundle install"
alias be="bundle exec"
# Kamal
alias kamal='docker run -it --rm -v "${PWD}:/workdir" -v "${HOME}/.ssh/id_rsa:/root/.ssh/id_rsa" -v /var/run/docker.sock:/var/run/docker.sock -e KAMAL_REGISTRY_PASSWORD=$(env | grep "^KAMAL_" | cut -d '=' -f2) ghcr.io/basecamp/kamal:latest'
# Neovim
alias n="nvim"
alias n.="nvim ."
# File manager
alias rg="ranger"
alias th="thunar"
# Lazygit
alias lzg="lazygit"
# Lazydocker
alias lzd="lazydocker"
# Shell
alias ls="exa --icons"
alias cat="bat"
alias htop="btop"
#alias find='fd'
#alias grep='rg'
#alias ps='procs'
# Others
alias o="xdg-open"
d() {
cd ~/Development/"$1"
}
_d() {
local -a dirs
dirs=("${(@f)$(ls -d ~/Development/*(/) 2>/dev/null)}")
dirs=("${dirs[@]##*/}") # Extract only the folder names
compadd "$@" -- $dirs
}
compdef _d d