Formatting and more opportunity for user customizability
This commit is contained in:
parent
10179cd257
commit
373efd64d2
1 changed files with 68 additions and 48 deletions
116
.zshrc
116
.zshrc
|
@ -6,7 +6,7 @@
|
|||
### Basic shell configuration >>>
|
||||
### Environment variables >>>
|
||||
{
|
||||
# [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/envrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/envrc"
|
||||
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/envrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/envrc"
|
||||
# Intelligently set $EDITOR
|
||||
if command -v nvim > /dev/null;then
|
||||
export EDITOR=nvim
|
||||
|
@ -33,7 +33,7 @@
|
|||
# <<<
|
||||
### Aliases >>>
|
||||
{
|
||||
# [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc"
|
||||
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc"
|
||||
## Short hand programs (ex: sc = shellcheck) >>>
|
||||
# use nvim rather than vim if the command exists
|
||||
[ -x "$(command -v nvim)" ] && alias vim="nvim" vimdiff="nvim -d"
|
||||
|
@ -49,12 +49,11 @@
|
|||
rd='rmdir' \
|
||||
|
||||
# <<<
|
||||
|
||||
## Program improvements (ex: ls = ls -h) >>>
|
||||
alias df='df -h' # Human-readable sizes
|
||||
alias free='free -m' # Show sizes in MB
|
||||
alias df='df -h' # Human-readable sizes
|
||||
alias free='free -m' # Show sizes in MB
|
||||
alias tm='tmux new -As0' # open a new session called 0, but if there is already a session called 0, connect to it
|
||||
alias bc="bc -ql" # Make bc usable for fast math
|
||||
alias bc="bc -ql" # Make bc usable for fast math
|
||||
|
||||
# Colors
|
||||
alias \
|
||||
|
@ -65,7 +64,6 @@
|
|||
pacman="pacman --color=auto" \
|
||||
paru="paru --color=auto" \
|
||||
# <<<
|
||||
|
||||
## Mini short-hand scripts (ex: la = ls -a) >>>
|
||||
# dotfile management
|
||||
alias dot='git --git-dir="/home/blake/git/dotfiles" --work-tree="$HOME"'
|
||||
|
@ -88,21 +86,22 @@
|
|||
# Graphical
|
||||
alias \
|
||||
restart-gnome='killall -SIGQUIT gnome-shell' \
|
||||
guh='guake --hide' \
|
||||
gus='guake --show' \
|
||||
lsx='ls /tmp/.X11-unix | tr "X" ":"' \
|
||||
|
||||
# tar is a dumb program...
|
||||
alias \
|
||||
tarc='tar -c --use-compress-program=pigz -f' \
|
||||
tarx='echo -e "Please use the ext script (https://github.com/LukeSmithxyz/voidrice/blob/master/.local/bin/ext)\nor look here for more information: https://www.cyberciti.biz/faq/tar-extract-linux"' \
|
||||
|
||||
tarx=ext \
|
||||
|
||||
# Docker
|
||||
alias \
|
||||
logs='docker-compose logs --tail=200 -f' \
|
||||
dupd='docker-compose up -d' \
|
||||
ddwn='docker-compose down' \
|
||||
occ='docker exec -it -u www-data nextcloud php occ' \
|
||||
|
||||
# lists all open ports, along with some other info
|
||||
alias ls-ports='netstat -tulpn'
|
||||
|
||||
# backs up list of packages
|
||||
alias packback='comm -23 <(paru -Qqett | sort) <(paru -Qqg base -g base-devel | sort | uniq) > ~/pkglist.txt'
|
||||
|
@ -118,13 +117,35 @@
|
|||
lla='ls -lah' \
|
||||
|
||||
# find pretty much any file, quickly
|
||||
alias fds='fd --hidden -E /run'
|
||||
alias fds='fd --hidden --exclude /run'
|
||||
# <<<
|
||||
}
|
||||
# <<<
|
||||
### Functions >>>
|
||||
{
|
||||
# [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/fnrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/fnrc"
|
||||
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/fnrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/fnrc"
|
||||
|
||||
# Simple extraction script. Taken from manjaro's .bashrc
|
||||
ex() {
|
||||
if [ -f $1 ] ; then
|
||||
case $1 in
|
||||
*.tar.bz2) tar xjf $1 ;;
|
||||
*.tar.gz) tar xzf $1 ;;
|
||||
*.bz2) bunzip2 $1 ;;
|
||||
*.rar) unrar x $1 ;;
|
||||
*.gz) gunzip $1 ;;
|
||||
*.tar) tar xf $1 ;;
|
||||
*.tbz2) tar xjf $1 ;;
|
||||
*.tgz) tar xzf $1 ;;
|
||||
*.zip) unzip $1 ;;
|
||||
*.Z) uncompress $1;;
|
||||
*.7z) 7z x $1 ;;
|
||||
*) echo "'$1' cannot be extracted via ex()" ;;
|
||||
esac
|
||||
else
|
||||
echo "'$1' is not a valid file"
|
||||
fi
|
||||
}
|
||||
|
||||
sitepath() {
|
||||
# usage: sitepath <path to file>
|
||||
|
@ -144,9 +165,36 @@
|
|||
exit $ERROR_CODE
|
||||
}
|
||||
|
||||
# prcolors and prcolors256: print all colors >>>
|
||||
# Taken from base16shell
|
||||
prcolors1() {
|
||||
# prcolors(): Display all colors in a few different ways >>>
|
||||
# TODO: change this to make it not just a few scripts smashed together
|
||||
prcolors() {
|
||||
# Taken from manjaro's bashrc >>>
|
||||
local fgc bgc vals seq0
|
||||
|
||||
printf "Color escapes are %s\n" '\e[${value};...;${value}m'
|
||||
printf "Values 30..37 are \e[33mforeground colors\e[m\n"
|
||||
printf "Values 40..47 are \e[43mbackground colors\e[m\n"
|
||||
printf "Value 1 gives a \e[1mbold-faced look\e[m\n\n"
|
||||
|
||||
# foreground colors
|
||||
for fgc in {30..37}; do
|
||||
# background colors
|
||||
for bgc in {40..47}; do
|
||||
fgc=${fgc#37} # white
|
||||
bgc=${bgc#40} # black
|
||||
|
||||
vals="${fgc:+$fgc;}${bgc}"
|
||||
vals=${vals%%;}
|
||||
|
||||
seq0="${vals:+\e[${vals}m}"
|
||||
printf " %-9s" "${seq0:-(default)}"
|
||||
printf " ${seq0}TEXT\e[m"
|
||||
printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m"
|
||||
done
|
||||
echo; echo
|
||||
done
|
||||
# <<<
|
||||
# from base16shell >>>
|
||||
ansi_mappings=(
|
||||
Black Red
|
||||
Green Yellow
|
||||
|
@ -185,41 +233,13 @@
|
|||
if [ $# -eq 1 ]; then
|
||||
printf "To restore current theme, source ~/.base16_theme or reopen your terminal\n"
|
||||
fi
|
||||
}
|
||||
|
||||
# Taken from manjaro's bashrc
|
||||
prcolors2() {
|
||||
local fgc bgc vals seq0
|
||||
|
||||
printf "Color escapes are %s\n" '\e[${value};...;${value}m'
|
||||
printf "Values 30..37 are \e[33mforeground colors\e[m\n"
|
||||
printf "Values 40..47 are \e[43mbackground colors\e[m\n"
|
||||
printf "Value 1 gives a \e[1mbold-faced look\e[m\n\n"
|
||||
|
||||
# foreground colors
|
||||
for fgc in {30..37}; do
|
||||
# background colors
|
||||
for bgc in {40..47}; do
|
||||
fgc=${fgc#37} # white
|
||||
bgc=${bgc#40} # black
|
||||
|
||||
vals="${fgc:+$fgc;}${bgc}"
|
||||
vals=${vals%%;}
|
||||
|
||||
seq0="${vals:+\e[${vals}m}"
|
||||
printf " %-9s" "${seq0:-(default)}"
|
||||
printf " ${seq0}TEXT\e[m"
|
||||
printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m"
|
||||
done
|
||||
echo; echo
|
||||
done
|
||||
}
|
||||
|
||||
# Similar to above, but does 256-bit colors. Taken from this: https://github.com/romkatv/powerlevel10k#set-colors-through-Powerlevel10k-configuration-parameters
|
||||
prcolors256() {
|
||||
# <<<
|
||||
# Similar to above, but does 256-bit colors. >>>
|
||||
# Taken from this: https://github.com/romkatv/powerlevel10k#set-colors-through-Powerlevel10k-configuration-parameters
|
||||
for i in {0..255}; do
|
||||
print -Pn "%K{$i} %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'\n'}
|
||||
done
|
||||
# <<<
|
||||
}
|
||||
# <<<
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue