various additions from sim laptop

This commit is contained in:
Alexander Gehrke 2025-05-08 13:55:52 +02:00 committed by Alexander Roso
parent 912a3282c5
commit 21e41141ef
13 changed files with 645 additions and 28 deletions

View file

@ -20,6 +20,8 @@ alias d="dragon-drop -a -x -T"
if ! command -v fd >/dev/null; then
if command -v fdfind >/dev/null; then
alias fd="fdfind"
autoload -Uz _fd
compdef _fd fdfind
else
fd() {
if [[ "$1" =~ "^-" ]]; then
@ -145,7 +147,6 @@ send-subvolume() { btrfs property set $1 ro true; btrfs send -v $1 | pv | nc -c
#################################################################################
# filename manipulation
##############################################################################{{{
alias cleanspaces="renamexm -s/\ /_/g -R"
# prefix all given files with first argument to this function
prefix() {
@ -280,17 +281,8 @@ alias -s log=vimpager
# various small scripts
##############################################################################{{{
urlencode() {
local input
setopt extendedglob
if [ -n "$1" ]; then
input="$*"
else
input=$(</dev/stdin)
fi
# by jkramer, source: http://stackoverflow.com/a/187853/928769
echo "${${(j: :)input}//(#b)(?)/%$[[##16]##${match[1]}]}"
}
alias urldecode="python3 -c 'import sys; from urllib import parse; print(parse.unquote_plus(sys.stdin.read().strip()))'"
alias urlencode="python3 -c 'import sys; from urllib import parse; print(parse.quote_plus(sys.stdin.read().strip()))'"
#}}}
@ -392,3 +384,11 @@ fi
duplicates() {
sort | uniq -c | grep -v '^\s*1'
}
alias rg="RIPGREP_CONFIG_PATH=$XDG_CONFIG_HOME/ripgreprc rg"
if exists gron; then
jgrep() {
gron | grep "$@" | gron -u
}
fi