Archived
0
0
Fork 0
This repository has been archived on 2024-02-06. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/.zshrc

144 lines
3.8 KiB
Bash
Raw Normal View History

2021-12-28 05:04:49 +00:00
# Set path
2022-01-21 08:22:02 +00:00
export PATH=$HOME/.local/bin:$HOME/.dotnet/tools:$HOME/.yarn/bin:$HOME/bin:/usr/local/bin:/var/lib/flatpak/exports/bin:$PATH
2021-12-28 05:04:49 +00:00
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# omz configs
2022-01-09 05:28:34 +00:00
# ZSH_THEME="powerlevel10k/powerlevel10k"
2021-12-28 05:04:49 +00:00
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# CASE_SENSITIVE="true"
HYPHEN_INSENSITIVE="true"
# DISABLE_AUTO_UPDATE="true"
# DISABLE_UPDATE_PROMPT="true"
export UPDATE_ZSH_DAYS=7
# DISABLE_MAGIC_FUNCTIONS="true"
# DISABLE_LS_COLORS="true"
# DISABLE_AUTO_TITLE="true"
ENABLE_CORRECTION="true"
COMPLETION_WAITING_DOTS="true"
# Plugins
2022-01-12 01:39:42 +00:00
plugins=(zsh-completions zsh-history-substring-search zsh-autosuggestions bgnotify colored-man-pages nvm rust docker docker-compose dotnet zsh-syntax-highlighting)
2021-12-28 05:04:49 +00:00
# Plugin Configs
export NVM_AUTOLOAD=1
export COMMAND_NOT_FOUND_INSTALL_PROMPT=1
export ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern cursor root line)
source $ZSH/oh-my-zsh.sh
# You may need to manually set your language environment
export LANG=en_US.UTF-8
# Preferred editor
export EDITOR='nvim'
# Compilation flags
export MAKEFLAGS="-j16"
# Aliases
alias nano="nvim"
alias vi="nvim"
alias vim="nvim"
alias ls="exa -laFghHUum@ --sort name --group-directories-first --git --icons "
alias tree="exa -laFghHUumRT@ --sort name --group-directories-first --git --icons"
alias rr="curl -s -L http://bit.ly/10hA8iC | bash"
alias cat="bat"
alias parrot="curl parrot.live"
alias neofetch="neofetch | lolcat"
alias grep="batgrep"
alias man="batman"
alias gitdiff="batdiff"
# Prevent dotnet from tracking me
export DOTNET_CLI_TELEMETRY_OPTOUT=true
# Load Compinit
autoload -Uz compinit
compinit
# Command not found
function command_not_found_handler {
local pkgs cmd="$1"
pkgs=(${(f)"$(pkgfile -b -v -- "$cmd" 2>/dev/null)"})
if [[ -n "$pkgs" ]]; then
printf 'The application %s is not installed. It may be found in the following packages:\n' "$cmd"
printf ' %s\n' $pkgs[@]
setopt shwordsplit
pkg_array=($pkgs[@])
pkgname="${${(@s:/:)pkg_array}[2]}"
printf 'Do you want to Install package %s? (y/N) ' $pkgname
if read -q "choice? "; then
echo
echo "Executing command: pacman -S $pkgname"
sudo pacman -S $pkgname
else
echo " "
fi
else
printf 'zsh: command not found: %s\n' "$cmd"
fi 1>&2
return 127
}
# Git logs
gitlog() {
setterm -linewrap off
git --no-pager log --all --color=always --graph --abbrev-commit --decorate \
--format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' | \
sed -E \
-e 's/\|(\x1b\[[0-9;]*m)+\\(\x1b\[[0-9;]*m)+ /├\1─╮\2/' \
-e 's/(\x1b\[[0-9;]+m)\|\x1b\[m\1\/\x1b\[m /\1├─╯\x1b\[m/' \
-e 's/\|(\x1b\[[0-9;]*m)+\\(\x1b\[[0-9;]*m)+/├\1╮\2/' \
-e 's/(\x1b\[[0-9;]+m)\|\x1b\[m\1\/\x1b\[m/\1├╯\x1b\[m/' \
-e 's/╮(\x1b\[[0-9;]*m)+\\/╮\1╰╮/' \
-e 's/╯(\x1b\[[0-9;]*m)+\//╯\1╭╯/' \
-e 's/(\||\\)\x1b\[m (\x1b\[[0-9;]*m)/╰╮\2/' \
-e 's/(\x1b\[[0-9;]*m)\\/\1╮/g' \
-e 's/(\x1b\[[0-9;]*m)\//\1╯/g' \
-e 's/^\*|(\x1b\[m )\*/\1⎬/g' \
-e 's/(\x1b\[[0-9;]*m)\|/\1│/g' | command less -r +'/[^/]HEAD'
setterm -linewrap on
}
# Enable Discord RPC in WSL
if uname -r | grep 'Microsoft' ; then
nvim() {
pidof sudo > /dev/null
if [ $? -ne 0 ]; then
sudo socat UNIX-LISTEN:/var/run/discord-ipc-0,fork,group=discord,umask=007 EXEC:"npiperelay.exe -ep -s //./pipe/discord-ipc-0",nofork &
fi
command nvim "$@"
while true; do
pidof nvim >/dev/null
if [ $? -ne 0 ]; then
sudo killall -9 socat
sudo killall -9 npiperelay.exe
sudo rm -rfv /var/run/discord-ipc-0
break
fi
done
}
fi
2021-12-28 05:04:49 +00:00
# Load nvm
source /usr/share/nvm/init-nvm.sh
2022-06-23 09:07:52 +00:00
# Make GPG work in WSL
export GPG_TTY=$(tty)
# Enable fuck
eval $(thefuck --alias)
2022-01-09 05:28:34 +00:00
# Set starship Prompt
eval "$(starship init zsh)"
2021-12-28 05:04:49 +00:00
# Neofetch cuz its cool
neofetch | lolcat