config/shell: update utils

This commit is contained in:
xeruf 2021-09-18 21:58:30 +02:00
parent 40357fedc8
commit 466f820a99
5 changed files with 25 additions and 15 deletions

View File

@ -10,10 +10,11 @@ alias -g L="--color=always | ${PAGER:-less}"
fi
alias h='help'
compdef help=which
compdef help=man
alias info='info --vi-keys'
d() {
test "$1" != "-" -a ! -d "$1" -a $# -eq 1 || { cd "$@" && return }
local query="$(zf "$@")"
# First find out whether there is an obvious match
# (score at least ten times above runner-up and score above 20)
@ -24,7 +25,8 @@ d() {
fi | zfz)"
}
di() {
cd "$( ( zf "$@"; locz "$@" ) | zfz)"
test "$1" != "-" -a ! -d "$1" -a $# -eq 1 && local dir=$({ zf "$@"; locz "$@" } | zfz)
cd "${dir:-1}"
}
alias c=z
alias v=edit
@ -118,7 +120,8 @@ edshell() {
alias l="ls -l --almost-all --human-readable --group-directories-first --file-type"
cd() {
test "$1" != "-" -a ! -d "$1" -a $# -eq 1 && dir=$(f --glob "$1*" "$DATA" --maxdepth 2 --type d --max-results 1) &&
test "$1" != "-" -a ! -d "$1" -a $# -eq 1 &&
dir=$(f --glob "$1*" "$DATA" --maxdepth 2 --type d --max-results 1) &&
test -n "$dir" && cd "$dir" && return
builtin cd $1 &&
command ls --file-type --group-directories-first --color=always --format=vertical -w $COLUMNS | head -3
@ -163,7 +166,7 @@ xo() {
done
}
alias sqli='rlwrap sqlite3 -column -header -cmd .tables'
loci() { locate --ignore-case --basename --existing "$@" | command grep --extended-regexp --ignore-case --color=always $(echo "$|$@" | sed 's/ /|/g') | less -F }
loci() { locate --all --ignore-case --basename --existing "$@" | command grep --extended-regexp --ignore-case --color=always $(echo "$|$@" | sed 's/ /|/g') | less -F }
alias loc='noglob loci'
alias uloc='noglob sudo updatedb && loci'
alias syslog='less +F /var/log/syslog'
@ -179,8 +182,8 @@ alias gdiff='git diff --word-diff=color --word-diff-regex=. --no-index'
alias sc='sudo systemctl'
alias sce='sudo systemctl enable --now'
scs() {
systemctl --user status "$1" "*$1*"
sudo systemctl status "$1" "*$1*"
systemctl --user status "$1" "*$1*" ||
sudo systemctl status "$1" "*$1*"
}
alias scu='systemctl --user'
alias scue='systemctl --user enable --now'
@ -211,6 +214,7 @@ hex() { hexyl "$@" | "${PAGER:-less}" }
# Applications
alias dict="rdictcc -d $XDG_DATA_HOME/dictcc" #"(builtin cd $XDG_DATA_HOME/dictcc && rlwrap perl dictcc-helper.pl)"
alias startMinecraftServer='curl https://ipinfo.io/ip | xclip -sel clip && cd ~/daten/games/sharedgames/minecraft/server && java -jar forge-1.12.2-14.23.5.2768-universal.jar -mx 8G'
alias delta="sc start openvpn-client@deltaPeak.service"
test -d $HOME/.dropbox && dropbox_path="$(cat $HOME/.dropbox/info.json | grep -Po '"'"path"'"\s*:\s*"\K([^"]*)')"

View File

@ -1,3 +1,3 @@
#!/bin/sh
# Start single all-in-one dragon-drag-and-drop with args or pwd
$(command which dragon 2>/dev/null || echo dragon-drag-and-drop) -x -a ${@:-.}
$(command which dragon 2>/dev/null || echo dragon-drag-and-drop) -x -a "${@:-.}"

9
.local/bin/scripts/m Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh -e
# Creates the last arg as directory (or its parent if not ending in a slash)
# and moves the preceding arguments into it.
# Automatically elevates if missing permissions.
for last; do true; done
! test -e "$1" && echo "$1 does not exist" && exit 1
checkaccess -w "$last" || elevate=sudo
$elevate mkdir -p $(case "$last" in (*/) echo "$last";; (*) dirname "$last";; esac)
$elevate mv -n "$@"

View File

@ -1,5 +0,0 @@
#!/bin/sh
# Creates the last arg as directory (or its parent if not ending in a slash) and moves everything else into it
for last; do true; done
mkdir -p $(case "$last" in (*/) echo "$last";; (*) dirname "$last";; esac)
mv -n "$@"

View File

@ -5,11 +5,11 @@ with the intention to move to Awesome soon.
If you are looking to snag some of my handy tools,
focus on [[.local/bin/scripts]] and [[.config/shell]].
Among daily use are ~b~, ~edbin~, ~edconf~, ~edit~, ~yas~, ~walli~
Among daily use are ~b~, ~edbin~, ~edconf~, ~edit~, ~help~, [[.config/shell/arch][~yas~]]
and [[https://github.com/ajeetdsouza/zoxide][zoxide]]-based ~d~ / ~di~
which in turn use ~zfz~, ~zf~ & ~locz~.
~ex~, ~help~, ~moul~, ~mvk~, ~rpl~, ~s~, ~sd~, ~tl~ are also commonly used conveniences.
~ex~, ~m~, ~moul~, ~rpl~, ~s~, ~sd~, ~tl~, ~walli~ are also commonly used conveniences.
** Root
I am trying to keep my home clean,
but some files unfortunately cannot be moved.
@ -23,4 +23,6 @@ and configuration for ~less~ and ~fzf~.
- ideavim, vifm, nvim :: vi-related tools
- git, yadm :: version control
** .local
- [[.local/bin/scripts][scripts]] :: lots of useful scripts, most have a short documentation header - including many essential git scripts
- [[.local/bin/scripts][scripts]] :: lots of useful scripts,
most have a short documentation header -
including many essential git scripts