Skip to content

Commit 0eb8a4d

Browse files
committed
added some new pacakages for zsh and edited zshrc based on garuda
1 parent 8b8c06d commit 0eb8a4d

File tree

3 files changed

+497
-11
lines changed

3 files changed

+497
-11
lines changed

airootfs/etc/skel/.zshrc

Lines changed: 245 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
2-
# Initialization code that may require console input (password prompts, [y/n]
3-
# confirmations, etc.) must go above this block; everything else may go below.
1+
# If not running interactively, don't do anything
2+
[[ $- != *i* ]] && return
3+
4+
alias ls='ls --color=auto'
5+
PS1='[\u@\h \W]\$ '
6+
47

58
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
69
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
@@ -37,6 +40,243 @@ alias remove="sudo pacman -R"
3740
alias autoremove="sudo pacman -Rns"
3841

3942
# keyboard ctrl+arrow key issue solved
40-
bindkey '^[[1;5C' forward-word # Ctrl+Right arrow
41-
bindkey '^[[1;5D' backward-word # Ctrl+Left arrow
43+
#bindkey '^[[1;5C' forward-word # Ctrl+Right arrow
44+
#bindkey '^[[1;5D' backward-word # Ctrl+Left arrow
45+
46+
## Path section
47+
# Set $PATH if ~/.local/bin exist
48+
if [ -d "$HOME/.local/bin" ]; then
49+
export PATH=$HOME/.local/bin:$PATH
50+
fi
51+
52+
#eval "$(starship init zsh)"
53+
#function set_win_title(){
54+
# echo -ne "\033]0; $USER@$HOST:${PWD/$HOME/~} \007"
55+
#}
56+
precmd_functions+=(set_win_title)
57+
58+
59+
60+
61+
62+
# Use history substring search
63+
#source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh
64+
65+
# Use fzf
66+
source /usr/share/fzf/key-bindings.zsh
67+
source /usr/share/fzf/completion.zsh
68+
69+
# Arch Linux command-not-found support, you must have package pkgfile installed
70+
# https://wiki.archlinux.org/index.php/Pkgfile#.22Command_not_found.22_hook
71+
[[ -e /usr/share/doc/pkgfile/command-not-found.zsh ]] && source /usr/share/doc/pkgfile/command-not-found.zsh
72+
73+
# Advanced command-not-found hook
74+
[[ -e /usr/share/doc/find-the-command/ftc.zsh ]] && source /usr/share/doc/find-the-command/ftc.zsh
75+
76+
77+
## Options section
78+
setopt correct # Auto correct mistakes
79+
setopt extendedglob # Extended globbing. Allows using regular expressions with *
80+
setopt nocaseglob # Case insensitive globbing
81+
setopt rcexpandparam # Array expension with parameters
82+
setopt nocheckjobs # Don't warn about running processes when exiting
83+
setopt numericglobsort # Sort filenames numerically when it makes sense
84+
setopt nobeep # No beep
85+
setopt appendhistory # Immediately append history instead of overwriting
86+
setopt histignorealldups # If a new command is a duplicate, remove the older one
87+
setopt autocd # if only directory path is entered, cd there.
88+
setopt auto_pushd
89+
setopt pushd_ignore_dups
90+
setopt pushdminus
91+
92+
# Completion.
93+
autoload -Uz compinit
94+
compinit
95+
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' # Case insensitive tab completion
96+
zstyle ':completion:*' rehash true # automatically find new executables in path
97+
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" # Colored completion (different colors for dirs/files/etc)
98+
zstyle ':completion:*' completer _expand _complete _ignored _approximate
99+
zstyle ':completion:*' menu select
100+
zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
101+
zstyle ':completion:*:descriptions' format '%U%F{cyan}%d%f%u'
102+
103+
# Speed up completions
104+
zstyle ':completion:*' accept-exact '*(N)'
105+
zstyle ':completion:*' use-cache on
106+
zstyle ':completion:*' cache-path ~/.cache/zcache
107+
108+
# automatically load bash completion functions
109+
autoload -U +X bashcompinit && bashcompinit
110+
111+
#HISTFILE=~/.zhistory
112+
#HISTSIZE=50000
113+
#SAVEHIST=10000
114+
115+
116+
## Keys
117+
# Use emacs key bindings
118+
bindkey -e
119+
120+
# [PageUp] - Up a line of history
121+
if [[ -n "${terminfo[kpp]}" ]]; then
122+
bindkey -M emacs "${terminfo[kpp]}" up-line-or-history
123+
bindkey -M viins "${terminfo[kpp]}" up-line-or-history
124+
bindkey -M vicmd "${terminfo[kpp]}" up-line-or-history
125+
fi
126+
# [PageDown] - Down a line of history
127+
if [[ -n "${terminfo[knp]}" ]]; then
128+
bindkey -M emacs "${terminfo[knp]}" down-line-or-history
129+
bindkey -M viins "${terminfo[knp]}" down-line-or-history
130+
bindkey -M vicmd "${terminfo[knp]}" down-line-or-history
131+
fi
132+
133+
# Start typing + [Up-Arrow] - fuzzy find history forward
134+
if [[ -n "${terminfo[kcuu1]}" ]]; then
135+
autoload -U up-line-or-beginning-search
136+
zle -N up-line-or-beginning-search
137+
138+
bindkey -M emacs "${terminfo[kcuu1]}" up-line-or-beginning-search
139+
bindkey -M viins "${terminfo[kcuu1]}" up-line-or-beginning-search
140+
bindkey -M vicmd "${terminfo[kcuu1]}" up-line-or-beginning-search
141+
fi
142+
# Start typing + [Down-Arrow] - fuzzy find history backward
143+
if [[ -n "${terminfo[kcud1]}" ]]; then
144+
autoload -U down-line-or-beginning-search
145+
zle -N down-line-or-beginning-search
146+
147+
bindkey -M emacs "${terminfo[kcud1]}" down-line-or-beginning-search
148+
bindkey -M viins "${terminfo[kcud1]}" down-line-or-beginning-search
149+
bindkey -M vicmd "${terminfo[kcud1]}" down-line-or-beginning-search
150+
fi
151+
152+
# [Home] - Go to beginning of line
153+
if [[ -n "${terminfo[khome]}" ]]; then
154+
bindkey -M emacs "${terminfo[khome]}" beginning-of-line
155+
bindkey -M viins "${terminfo[khome]}" beginning-of-line
156+
bindkey -M vicmd "${terminfo[khome]}" beginning-of-line
157+
fi
158+
# [End] - Go to end of line
159+
if [[ -n "${terminfo[kend]}" ]]; then
160+
bindkey -M emacs "${terminfo[kend]}" end-of-line
161+
bindkey -M viins "${terminfo[kend]}" end-of-line
162+
bindkey -M vicmd "${terminfo[kend]}" end-of-line
163+
fi
164+
165+
# [Shift-Tab] - move through the completion menu backwards
166+
if [[ -n "${terminfo[kcbt]}" ]]; then
167+
bindkey -M emacs "${terminfo[kcbt]}" reverse-menu-complete
168+
bindkey -M viins "${terminfo[kcbt]}" reverse-menu-complete
169+
bindkey -M vicmd "${terminfo[kcbt]}" reverse-menu-complete
170+
fi
171+
172+
# [Backspace] - delete backward
173+
bindkey -M emacs '^?' backward-delete-char
174+
bindkey -M viins '^?' backward-delete-char
175+
bindkey -M vicmd '^?' backward-delete-char
176+
# [Delete] - delete forward
177+
if [[ -n "${terminfo[kdch1]}" ]]; then
178+
bindkey -M emacs "${terminfo[kdch1]}" delete-char
179+
bindkey -M viins "${terminfo[kdch1]}" delete-char
180+
bindkey -M vicmd "${terminfo[kdch1]}" delete-char
181+
else
182+
bindkey -M emacs "^[[3~" delete-char
183+
bindkey -M viins "^[[3~" delete-char
184+
bindkey -M vicmd "^[[3~" delete-char
185+
186+
bindkey -M emacs "^[3;5~" delete-char
187+
bindkey -M viins "^[3;5~" delete-char
188+
bindkey -M vicmd "^[3;5~" delete-char
189+
fi
190+
191+
typeset -g -A key
192+
if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
193+
autoload -Uz add-zle-hook-widget
194+
function zle_application_mode_start { echoti smkx }
195+
function zle_application_mode_stop { echoti rmkx }
196+
add-zle-hook-widget -Uz zle-line-init zle_application_mode_start
197+
add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop
198+
fi
199+
200+
# Control Left - go back a word
201+
key[Control-Left]="${terminfo[kLFT5]}"
202+
if [[ -n "${key[Control-Left]}" ]]; then
203+
bindkey -M emacs "${key[Control-Left]}" backward-word
204+
bindkey -M viins "${key[Control-Left]}" backward-word
205+
bindkey -M vicmd "${key[Control-Left]}" backward-word
206+
fi
207+
208+
# Control Left - go forward a word
209+
key[Control-Right]="${terminfo[kRIT5]}"
210+
if [[ -n "${key[Control-Right]}" ]]; then
211+
bindkey -M emacs "${key[Control-Right]}" forward-word
212+
bindkey -M viins "${key[Control-Right]}" forward-word
213+
bindkey -M vicmd "${key[Control-Right]}" forward-word
214+
fi
215+
216+
# Alt Left - go back a word
217+
key[Alt-Left]="${terminfo[kLFT3]}"
218+
if [[ -n "${key[Alt-Left]}" ]]; then
219+
bindkey -M emacs "${key[Alt-Left]}" backward-word
220+
bindkey -M viins "${key[Alt-Left]}" backward-word
221+
bindkey -M vicmd "${key[Alt-Left]}" backward-word
222+
fi
223+
224+
# Control Right - go forward a word
225+
key[Alt-Right]="${terminfo[kRIT3]}"
226+
if [[ -n "${key[Alt-Right]}" ]]; then
227+
bindkey -M emacs "${key[Alt-Right]}" forward-word
228+
bindkey -M viins "${key[Alt-Right]}" forward-word
229+
bindkey -M vicmd "${key[Alt-Right]}" forward-word
230+
fi
231+
232+
## Useful aliases
233+
alias grubup="sudo update-grub"
234+
alias fixpacman="sudo rm /var/lib/pacman/db.lck"
235+
alias tarnow='tar -acf '
236+
alias untar='tar -zxvf '
237+
alias wget='wget -c '
238+
alias rmpkg="sudo pacman -Rdd"
239+
alias psmem='ps auxf | sort -nr -k 4'
240+
alias psmem10='ps auxf | sort -nr -k 4 | head -10'
241+
alias ..='cd ..'
242+
alias ...='cd ../..'
243+
alias ....='cd ../../..'
244+
alias .....='cd ../../../..'
245+
alias ......='cd ../../../../..'
246+
alias dir='dir --color=auto'
247+
alias vdir='vdir --color=auto'
248+
alias grep='grep --color=auto'
249+
alias fgrep='grep -F --color=auto'
250+
alias egrep='grep -E --color=auto'
251+
alias hw='hwinfo --short' # Hardware Info
252+
alias big="expac -H M '%m\t%n' | sort -h | nl" # Sort installed packages according to size in MB (expac must be installed)
253+
alias gitpkg='pacman -Q | grep -i "\-git" | wc -l' # List amount of -git packages
254+
255+
# Get fastest mirrors
256+
alias mirror="sudo reflector -f 30 -l 30 --number 10 --verbose --save /etc/pacman.d/mirrorlist"
257+
alias mirrord="sudo reflector --latest 50 --number 20 --sort delay --save /etc/pacman.d/mirrorlist"
258+
alias mirrors="sudo reflector --latest 50 --number 20 --sort score --save /etc/pacman.d/mirrorlist"
259+
alias mirrora="sudo reflector --latest 50 --number 20 --sort age --save /etc/pacman.d/mirrorlist"
260+
261+
# Help people new to Arch
262+
alias apt-get='man pacman'
263+
alias apt='man pacman'
264+
alias helpme='cht.sh --shell'
265+
alias pacdiff='sudo -H DIFFPROG=meld pacdiff'
266+
alias please='sudo'
267+
alias tb='nc termbin.com 9999'
268+
alias upd="/usr/bin/update"
269+
270+
# Replace yay with paru if installed
271+
[ ! -x /usr/bin/yay ] && [ -x /usr/bin/paru ] && alias yay='paru'
272+
273+
# Load Mcfly
274+
#export MCFLY_FUZZY=true
275+
#export MCFLY_RESULTS=20
276+
#export MCFLY_INTERFACE_VIEW=BOTTOM
277+
#export MCFLY_RESULTS_SORT=LAST_RUN
278+
#eval "$(mcfly init zsh)"
279+
280+
## Run neofetch
281+
#neofetch
42282

0 commit comments

Comments
 (0)