Permalink
Browse files

woman, deer, awk

  • Loading branch information...
neeasade committed Jul 1, 2018
1 parent 7c0775a commit ada23052f0b5a21ab7066f53c2f51638b7bad15b
Showing with 52 additions and 40 deletions.
  1. +4 −0 .editorconfig
  2. +1 −1 bin/bin/mpv
  3. +45 −37 shell/.sh.d/functions
  4. +2 −2 wm/.wm/panel/lemons/mpd
@@ -7,3 +7,7 @@ insert_final_newline = true
[*.sh]
indent_size = 2
indent_style = space
[shell/.sh.d/*]
indent_size = 2
indent_style = space
@@ -1,7 +1,7 @@
#!/usr/bin/env sh
# always run mpv w/ socket
mpv="$(type -a mpv | tail -n 1 | sed 's/.* //')"
mpv="$(type -a mpv | awk 'END{print $3}')"
# todo: account for multiple instances here
mpc pause >/dev/null
@@ -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() {
@@ -20,11 +20,11 @@ else
title="Stopped"
fi
icon music
if [ "$title" = "Stopped" ]; then
icon music
echo Stopped
else
icon music
$playing && icon pause
$paused && icon play
echo "$title" | cut -c 1-$maxWinNameLen

0 comments on commit ada2305

Please sign in to comment.