103 lines
3.6 KiB
Bash
Executable File
103 lines
3.6 KiB
Bash
Executable File
# Variables
|
|
export VISUAL="${EDITOR}"
|
|
export EDITOR='nvim'
|
|
export TERMINAL='alacritty'
|
|
export BROWSER='brave'
|
|
export HISTORY_IGNORE="(ls|dir|cd|pwd|exit|sudo reboot|history|cd -|cd ..)"
|
|
|
|
if [ -d "$HOME/.local/bin" ] ;
|
|
then PATH="$HOME/.local/bin:$PATH"
|
|
fi
|
|
|
|
# Load Engine
|
|
autoload -Uz compinit
|
|
|
|
for dump in ~/.config/zsh/zcompdump(N.mh+24); do
|
|
compinit -d ~/.config/zsh/zcompdump
|
|
done
|
|
|
|
compinit -C -d ~/.config/zsh/zcompdump
|
|
|
|
autoload -Uz add-zsh-hook
|
|
autoload -Uz vcs_info
|
|
precmd () { vcs_info }
|
|
_comp_options+=(globdots)
|
|
|
|
zstyle ':completion:*' verbose true
|
|
zstyle ':completion:*:*:*:*:*' menu select
|
|
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} 'ma=48;5;197;1'
|
|
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
|
zstyle ':completion:*:warnings' format "%B%F{red}No matches for:%f %F{magenta}%d%b"
|
|
zstyle ':completion:*:descriptions' format '%F{yellow}[-- %d --]%f'
|
|
zstyle ':vcs_info:*' formats ' %B%s-[%F{magenta}%f %F{yellow}%b%f]-'
|
|
|
|
# Waiting Dots
|
|
expand-or-complete-with-dots() {
|
|
echo -n "\e[31m…\e[0m"
|
|
zle expand-or-complete
|
|
zle redisplay
|
|
}
|
|
zle -N expand-or-complete-with-dots
|
|
bindkey "^I" expand-or-complete-with-dots
|
|
|
|
# History
|
|
HISTFILE=~/.config/zsh/zhistory
|
|
HISTSIZE=5000
|
|
SAVEHIST=5000
|
|
|
|
# Zsh Cool Options
|
|
setopt AUTOCD # change directory just by typing its name
|
|
setopt PROMPT_SUBST # enable command substitution in prompt
|
|
setopt MENU_COMPLETE # Automatically highlight first element of completion menu
|
|
setopt LIST_PACKED # The completion menu takes less space.
|
|
setopt AUTO_LIST # Automatically list choices on ambiguous completion.
|
|
setopt HIST_IGNORE_DUPS # Do not write events to history that are duplicates of previous events
|
|
setopt HIST_FIND_NO_DUPS # When searching history don't display results already cycled through twice
|
|
setopt COMPLETE_IN_WORD # Complete from both ends of a word.
|
|
|
|
# The Prompt
|
|
PS1='%B%F{magenta}%n%f%b %B%F{red}%~%f%b${vcs_info_msg_0_}'$'\n''%(?.%B%F{green}$.%F{red}$)%f%b '
|
|
|
|
# Plugins
|
|
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
|
|
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
|
source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh
|
|
|
|
bindkey '^[[A' history-substring-search-up
|
|
bindkey '^[[B' history-substring-search-down
|
|
|
|
# Change Terminal Titles
|
|
function xterm_title_precmd () {
|
|
print -Pn -- '\e]2;%n@%m %~\a'
|
|
[[ "$TERM" == 'screen'* ]] && print -Pn -- '\e_\005{g}%n\005{-}@\005{m}%m\005{-} \005{B}%~\005{-}\e\\'
|
|
}
|
|
|
|
function xterm_title_preexec () {
|
|
print -Pn -- '\e]2;%n@%m %~ %# ' && print -n -- "${(q)1}\a"
|
|
[[ "$TERM" == 'screen'* ]] && { print -Pn -- '\e_\005{g}%n\005{-}@\005{m}%m\005{-} \005{B}%~\005{-} %# ' && print -n -- "${(q)1}\e\\"; }
|
|
}
|
|
|
|
if [[ "$TERM" == (kitty*|alacritty*|termite*|gnome*|konsole*|kterm*|putty*|rxvt*|screen*|tmux*|xterm*) ]]; then
|
|
add-zsh-hook -Uz precmd xterm_title_precmd
|
|
add-zsh-hook -Uz preexec xterm_title_preexec
|
|
fi
|
|
|
|
# Alias
|
|
alias mirrors="sudo reflector --verbose --latest 5 --country 'United States' --age 6 --sort rate --save /etc/pacman.d/mirrorlist"
|
|
|
|
alias grub-update="sudo grub-mkconfig -o /boot/grub/grub.cfg"
|
|
alias maintenance="yay -Sc && sudo pacman -Scc"
|
|
alias purge="sudo pacman -Rns $(pacman -Qtdq) ; sudo fstrim -av"
|
|
alias update="yay -Syu --nocombinedupgrade"
|
|
|
|
alias vm-on="sudo systemctl start libvirtd.service"
|
|
alias vm-off="sudo systemctl stop libvirtd.service"
|
|
|
|
alias music="ncmpcpp"
|
|
|
|
alias ls='lsd -a --group-directories-first'
|
|
alias dir='lsd -a --group-directories-first'
|
|
alias ll='lsd -la --group-directories-first'
|
|
|
|
# Autostart
|
|
$HOME/.local/bin/colorscript -r |