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