config/shell: various tweaks
This commit is contained in:
parent
634b39ed9c
commit
b7227a1ab5
|
@ -31,7 +31,7 @@ cd() {
|
|||
dir=$(fd --no-ignore --glob "$1*" "$DATA" --maxdepth 2 --type d --max-results 1)
|
||||
test -n "$dir" && cd "$dir"
|
||||
else
|
||||
builtin cd $1 &&
|
||||
builtin cd "$1" &&
|
||||
command ls --literal --file-type --color=always --format=vertical -U -w $COLUMNS |
|
||||
#pr -4 -l1 -W $COLUMNS -S" " |
|
||||
head -3
|
||||
|
@ -61,7 +61,9 @@ d() {
|
|||
# First find out whether there is an obvious match
|
||||
# (score at least ten times above runner-up and score above 20)
|
||||
# If not select with fzf, using locate to find extra options
|
||||
cd "$(if test -n "$query" && expr "$(echo "$query" | head -1 | cut -d' ' -f1)" \> 20 \& $(echo "$query" | sed 'N;s|/.* \([0-9]\)|> 10 * \1|;q' | sed 's| */.*||') >/dev/null #2>&1
|
||||
cd "$(if test -n "$query" &&
|
||||
expr "$(echo "$query" | head -1 | cut -d' ' -f1)" \> 20 \& \
|
||||
$(echo "$query" | sed 'N;s|/.* \([0-9]\)|> 10 * \1|;q' | sed 's| */.*||') >/dev/null #2>&1
|
||||
then echo "$query" | head -1
|
||||
else test -n "$query" && echo "$query"; locz "$@"
|
||||
fi | zfz)"
|
||||
|
|
|
@ -26,17 +26,12 @@ which lsb_release >/dev/null && export DIST=$(lsb_release --id | cut -d' ' -f2)
|
|||
|
||||
unalias rd 2>/dev/null
|
||||
|
||||
# System helpers {{{1
|
||||
# System help {{{1
|
||||
|
||||
alias h='help'
|
||||
compdef help=man
|
||||
alias info='info --vi-keys'
|
||||
|
||||
alias v=edit
|
||||
|
||||
alias println='printf "\n"'
|
||||
alias dedup='awk '"'"'!a[$0]++'"'"
|
||||
|
||||
# Shows source code for command, resolving nested aliases
|
||||
wh() {
|
||||
res=$(which "$@")
|
||||
|
@ -157,16 +152,21 @@ alias jcj='jcl -o json-pretty -u'
|
|||
|
||||
# Applications {{{1
|
||||
|
||||
alias u='topgrade'
|
||||
# Shorthands
|
||||
alias v='edit'
|
||||
alias u='topgrade --only emacs --yes; topgrade --disable emacs'
|
||||
alias st='synct'
|
||||
alias expr='noglob expr'
|
||||
|
||||
alias lst='( last; last -f /var/log/wtmp.1 ) | grep -v "pts/" | tac | less +G'
|
||||
alias lar='last | tac'
|
||||
|
||||
alias calc='rlwrap -a bc -l'
|
||||
# Shortcuts
|
||||
alias logoff="loginctl terminate-user $USER"
|
||||
blues() { bluedevil-sendfile $(echo "$@" | xargs -n 1 realpath | xargs -n 1 echo -n " --files") }
|
||||
alias calc='rlwrap -a bc -l'
|
||||
|
||||
# Process
|
||||
alias println='printf "\n"'
|
||||
alias dedup='awk '"'"'!a[$0]++'"'"
|
||||
alias lar='last | tac'
|
||||
alias lst='( last; last -f /var/log/wtmp.1 ) | grep -v "pts/" | tac | less +G'
|
||||
|
||||
# Remote
|
||||
alias delta="sc restart openvpn-client@deltaPeak.service"
|
||||
|
@ -318,7 +318,7 @@ mvln() {
|
|||
# Move into an xdg dir (default XDG_DATA_HOME) and create a symlink
|
||||
mvx() {
|
||||
mvln "$1" "${2:-$XDG_DATA_HOME}/${1#.}"
|
||||
yadm add "$1" ".config/$1"
|
||||
yadm add "$1" ".config/$1" 2>/dev/null
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
# Send given files via bluetooth
|
||||
bluedevil-sendfile $(echo "$@" | xargs -n 1 realpath | xargs -n 1 echo -n " --files")
|
|
@ -9,7 +9,7 @@ case $1 in
|
|||
info --vi-keys $(test $last != zsh && echo --index-search=$last) zsh || LESS="$LESS +/^ *$last *\\[" man zshall;;
|
||||
(vlc) unbuffer vlc --full-help "${@:2}" | $paginate;;
|
||||
(gh|chordpro) $@ --help | $paginate;;
|
||||
(caddy) $1 help ${@:2} | $paginate;;
|
||||
(caddy|stretchly) $1 help ${@:2} | $paginate;;
|
||||
(*) man "$@" || { info "$1" -w | grep -v "manpages" && pinfo "$@"; } || { "$@" --help || "$@" -help; } 2>&1 | ${PAGER:-less} || which "$@";;
|
||||
esac
|
||||
docs="/usr/share/doc/$1"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
# Install pre-commit, ignoring globally set core.hooksPath
|
||||
git config --unset core.hooksPath
|
||||
git config --unset-all core.hooksPath
|
||||
GIT_CONFIG_GLOBAL=/dev/null pre-commit install
|
||||
GIT_CONFIG_GLOBAL=/dev/null pre-commit install -t pre-push
|
||||
git config --add core.hooksPath .git/hooks
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh -e
|
||||
# Move roam files into subfolders
|
||||
cd $DATA/2-standards/notes
|
||||
cd $DATA/2-standards/box
|
||||
find . -mindepth 1 -type d -printf '%f\n' |
|
||||
while read dir; do
|
||||
grep -l --directories=skip "#+filetags: :$dir" * |
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#!/bin/sh
|
||||
while true
|
||||
do case $1 in
|
||||
(-o) out=$2; shift 2;;
|
||||
(-q) quality=$2; shift 2;;
|
||||
(-o) out="$2"; shift 2;;
|
||||
(-q) quality="$2"; shift 2;;
|
||||
(*) break;;
|
||||
esac
|
||||
done
|
||||
magick '$@' -strip -interlace Plane -define jpeg:dct-method=float -sampling-factor 4:2:0 -gaussian-blur 0.05 -quality "${quality:-85}" "$out"
|
||||
test $# -eq 0 && echo "Usage: $0 [-q quality (default 85)] [-o outfile] <images...>" && exit 1
|
||||
magick "$@" -strip -interlace Plane -define jpeg:dct-method=float -sampling-factor 4:2:0 -gaussian-blur 0.05 -quality "${quality:-85}" "$out"
|
||||
|
||||
|
|
Loading…
Reference in New Issue