Skip to content

Commit 0967527

Browse files
committed
update
1 parent 82edd94 commit 0967527

File tree

17 files changed

+1144
-57
lines changed

17 files changed

+1144
-57
lines changed

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "dotbot"]
2+
path = dotbot
3+
url = https://github.com/anishathalye/dotbot
4+
ignore = dirty

backup/.zshrc

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

0 commit comments

Comments
 (0)