Last active
July 10, 2024 20:23
-
-
Save ormaaj/91bf239d37da1732bde1256de825b0c2 to your computer and use it in GitHub Desktop.
aliases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\unset -v aliasrestore | |
aliasrestore=$(\alias -p) aliasrestore+=${aliasrestore:+$'\n\\'unset -v aliasrestore} | |
\unalias -a | |
function setupGlobalAliases { | |
alias -- \ | |
'--=-- ' \ | |
'l-=local -' \ | |
'fn=function ' \ | |
'exec=exec ' \ | |
'nameref=typeset -n' \ | |
"integer=typeset -${KSH_VERSION+l}i" \ | |
'command=command ' \ | |
'nohup=nohup ' | |
# eval alias "$(compgen -A keyword -A builtin | sed -Ee $'s|.*|@&=\'& \' @@&=&|;$q;s|$| \\\\|')" | |
} | |
function lindaMeHarder { | |
typeset -- x IFS=' ' | |
typeset -A interactiveAliases | |
typeset -a lsopts=(--color=always --time-style '+%F %T' --group-directories-first --dereference-command-line-symlink-to-dir --quoting-style=shell-escape-always -h) | |
typeset -a ezaopt=(--color=always --time-style '+%F %T' --group-directories-first --hyperlink -@HMlhgi) | |
typeset -a treeopt=(-augphDC --metafirst) | |
typeset -a lsdefs=( | |
ls ls "" "${lsopts[*]@Q}" | |
lsl ls -l "${lsopts[*]@Q}" | |
lal ls -al "${lsopts[*]@Q}" | |
lol eza "" "${ezaopt[*]@Q}" | |
lzl eza -aa "${ezaopt[*]@Q}" | |
ltl eza -Ta "${ezaopt[*]@Q}" | |
tree tree "" "${treeopt[*]@Q}" | |
) | |
set -- "${!lsdefs[@]}" | |
set -- "${@:1:$#/4}" | |
x=0 | |
for x do | |
set -- "${lsdefs[@]:x*=4:2}" ${lsdefs[x+2]:+"${lsdefs[x+2]}"} "${lsdefs[x+3]}" | |
interactiveAliases+=([$1]=${*:2}) | |
done | |
unset -v IFS | |
for x in emaint emerge; do | |
printf -v 'interactiveAliases[$x]' '%q ' ionice -c 3 -- nice -n +5 -- schedtool -Be | |
interactiveAliases+=([$x]+=$x) | |
done | |
if x=$(type -P nvim); then | |
printf -v 'interactiveAliases[vim]' %q "$x" | |
fi | |
interactiveAliases+=( | |
[bashfds]='lsfd -Q "fd >= 0" -o +flags -p "$BASHPID"' | |
[sdo]='\sudo -EC 1024' | |
[cp]='cp --reflink=auto --sparse=always' | |
[ff]=$'execlineb -Pc \'background -d { s6-setsid -b -- nosig -I HUP --null-io -- getpid -E p foreground { renice --priority 1 $p } firefox }\'' | |
[whois]='whois -H' | |
[eapi]='okular --unique -- "$(equery -q f -f doc app-doc/pms:live | \grep --color=never -E "pms.pdf\$")" >/dev/null 2>&1 &' | |
[pdev]='PATH=$(readlink -qne ~ormaaj/doc/programs/portage/bin):${PATH##+(:)} PYTHONPATH=$(readlink -qne ~ormaaj/doc/programs/portage/lib):${PYTHONPATH##+(:)} ' | |
[gdb]='gdb -q' | |
[grep]='grep --color=auto' | |
[info]='info --vi-keys' | |
[pst]='getpid -E p ps -wHN --ppid 2 -p 2,\${p} -o user,sid,pid,pgid,tpgid,tty,command' | |
[dmesg]='dmesg -L=always' | |
[findmnt]='findmnt -o +propagation' | |
[ltup]='losetup -Pv --direct-io=on --find --show' | |
[ltupl]='losetup -lav --output-all' | |
[pedit]='nvim /etc/portage/{@(make.conf?(*(.+(?)).include)|bashrc?([[:digit:]])|repos.conf),package.{use/use,accept_keywords/keywords,unmask/unmask,mask/mask}}' | |
[ipup]='sysctl --system; ip addr add "${2}/24" dev "$1"; ip link set "$1" up; ip route add default via 192.168.0.1; ip -c -s -r -h addr show dev "$1"' | |
) | |
typeset -A fd | |
shopt -s expand_aliases | |
for x in "${!interactiveAliases[@]}"; do | |
alias -- "${x}=${interactiveAliases[$x]}" | |
done | |
} | |
${aliasrestore+'eval'} ${BASH_VERSION+${aliasrestore+'--'}} ${aliasrestore+"$aliasrestore"} | |
# vim: set ft=bash fenc=utf-8 ff=unix ts=4 noet : |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment