|
|
@@ -1,5 +1,9 @@ |
|
|
# -*- mode: sh -*- |
|
|
|
|
|
ranger() { |
|
|
$ESHELL && elisp '(deer)' || env ranger |
|
|
} |
|
|
|
|
|
sysinfo() { |
|
|
clear |
|
|
ufetch |
|
@@ -90,7 +94,7 @@ gitupdate() { |
|
|
# Change to root of git repo |
|
|
groot() { |
|
|
if git status &> /dev/null; then |
|
|
cd $(git rev-parse --show-toplevel) |
|
|
cd $(git rev-parse --show-toplevel) |
|
|
else |
|
|
echo "Error: Not a git repository" |
|
|
return 128 |
|
@@ -107,18 +111,18 @@ note() { |
|
|
nq() { |
|
|
local CACHE="$HOME/.cache/nq-cache" |
|
|
if ! ( [ -e $CACHE ] && [ $(stat -c %Y $CACHE) -gt $(( $(date +%s) - 3600 )) ] ); then |
|
|
echo "update cache" && nix-env -qa --json > "$CACHE" |
|
|
echo "update cache" && nix-env -qa --json > "$CACHE" |
|
|
fi |
|
|
jq -r 'to_entries | .[] | .key + "|" + .value.meta.description' < "$CACHE" | |
|
|
{ |
|
|
if [ $# -gt 0 ]; then |
|
|
# double grep because coloring breaks column's char count |
|
|
# $* so that we include spaces (could do .* instead?) |
|
|
grep -i "$*" | column -t -s "|" | grep -i "$*" |
|
|
else |
|
|
column -t -s "|" |
|
|
fi |
|
|
} |
|
|
{ |
|
|
if [ $# -gt 0 ]; then |
|
|
# double grep because coloring breaks column's char count |
|
|
# $* so that we include spaces (could do .* instead?) |
|
|
grep -i "$*" | column -t -s "|" | grep -i "$*" |
|
|
else |
|
|
column -t -s "|" |
|
|
fi |
|
|
} |
|
|
} |
|
|
|
|
|
dec2hex() { |
|
@@ -131,39 +135,43 @@ hex2dec() { |
|
|
|
|
|
extract() { # Handy Extract Program |
|
|
if [ -f $1 ] ; then |
|
|
case $1 in |
|
|
*.tar.bz2) tar xvjf $1 ;; |
|
|
*.tar.gz) tar xvzf $1 ;; |
|
|
*.bz2) bunzip2 $1 ;; |
|
|
*.rar) unrar x $1 ;; |
|
|
*.gz) gunzip $1 ;; |
|
|
*.tar) tar xvf $1 ;; |
|
|
*.tbz2) tar xvjf $1 ;; |
|
|
*.tgz) tar xvzf $1 ;; |
|
|
*.zip) unzip $1 ;; |
|
|
*.Z) uncompress $1 ;; |
|
|
*.7z) 7z x $1 ;; |
|
|
*) echo "'$1' cannot be extracted via >extract<" ;; |
|
|
esac |
|
|
case $1 in |
|
|
*.tar.bz2) tar xvjf $1 ;; |
|
|
*.tar.gz) tar xvzf $1 ;; |
|
|
*.bz2) bunzip2 $1 ;; |
|
|
*.rar) unrar x $1 ;; |
|
|
*.gz) gunzip $1 ;; |
|
|
*.tar) tar xvf $1 ;; |
|
|
*.tbz2) tar xvjf $1 ;; |
|
|
*.tgz) tar xvzf $1 ;; |
|
|
*.zip) unzip $1 ;; |
|
|
*.Z) uncompress $1 ;; |
|
|
*.7z) 7z x $1 ;; |
|
|
*) echo "'$1' cannot be extracted via >extract<" ;; |
|
|
esac |
|
|
else |
|
|
echo "'$1' is not a valid file!" |
|
|
fi |
|
|
} |
|
|
|
|
|
# manpages with colors |
|
|
man() { |
|
|
settitle "$* - manual" |
|
|
# removing standout means find highlights stay inverted.. |
|
|
#LESS_TERMCAP_so=$(printf '\e[38;5;246m') \ |
|
|
|
|
|
env LESS_TERMCAP_mb=$(printf '\e[01;31m') \ |
|
|
LESS_TERMCAP_md=$(printf '\e[01;38;5;74m') \ |
|
|
LESS_TERMCAP_me=$(printf '\e[0m') \ |
|
|
LESS_TERMCAP_se=$(printf '\e[0m') \ |
|
|
LESS_TERMCAP_ue=$(printf '\e[0m') \ |
|
|
LESS_TERMCAP_us=$(printf '\e[04;38;5;146m') \ |
|
|
man "$@" |
|
|
defaulttitle |
|
|
if $ESHELL; then |
|
|
elisp "(woman \"$*\")" |
|
|
else |
|
|
settitle "$* - manual" |
|
|
# removing standout means find highlights stay inverted.. |
|
|
#LESS_TERMCAP_so=$(printf '\e[38;5;246m') \ |
|
|
|
|
|
env LESS_TERMCAP_mb=$(printf '\e[01;31m') \ |
|
|
LESS_TERMCAP_md=$(printf '\e[01;38;5;74m') \ |
|
|
LESS_TERMCAP_me=$(printf '\e[0m') \ |
|
|
LESS_TERMCAP_se=$(printf '\e[0m') \ |
|
|
LESS_TERMCAP_ue=$(printf '\e[0m') \ |
|
|
LESS_TERMCAP_us=$(printf '\e[04;38;5;146m') \ |
|
|
man "$@" |
|
|
defaulttitle |
|
|
fi |
|
|
} |
|
|
|
|
|
page() { |
|
|