config/shell: function adjustments

This commit is contained in:
xeruf 2022-10-13 21:56:23 +02:00
parent 80626489e2
commit 0988225c09
4 changed files with 24 additions and 14 deletions

View File

@ -1,5 +1,7 @@
# Utilities for file system navigation
alias watchdir='watch -c -n 1 exa -l --icons'
# Useful when the current directory was recreated
alias recd='cd $PWD'
# [c]hange [d]irectory [e]xisting - cd into the first existing directory

View File

@ -244,11 +244,15 @@ del() {
}
u() {
if test "$(stat /etc/pacman.d/mirrorlist --printf=%y | cut -d'-' -f1-2)" != "$(date +%Y-%m)"
then command -v pacman-mirrors >/dev/null &&
sudo pacman-mirrors --geoip ||
sudo touch /etc/pacman.d/mirrorlist
if command -v pacman >/dev/null; then
# Line below handy for users of netkeeper
ping example.com -c 1 -w 2 >/dev/null && sudo nft list ruleset | grep -1 outall | grep -q 'meta hour' || echo sysupgrade | netkeeper 30 2>/dev/null
if command -v pacman >/dev/null; then
if test "$(stat /etc/pacman.d/mirrorlist --printf=%y | cut -d'-' -f1-2)" != "$(date +%Y-%m)"
then
if command -v pacman-mirrors >/dev/null
then sudo pacman-mirrors --geoip
else sudo touch /etc/pacman.d/mirrorlist
fi
sudo pacman -Syy --needed base gnupg archlinux-keyring
sudo pacman-key --populate
sudo pacman-key --refresh-keys
@ -373,7 +377,12 @@ dic() {
}
#fzf --tiebreak=length --bind='alt-bspace:clear-query'
alias dict="rlwrap rdictcc --directory $DICT"
alias dict_update="dict -i $DICT/dict.txt"
dict_update() {
local dictfile="$DICT/dict.txt"
test $# -gt 0 && mv -v $1 "$dictfile"
echo "Reading in $dictfile..."
unbuffer rdictcc --directory $DICT -i "$dictfile" | rewrite
}
npm-reinstall() {
rm -rf $TMPDIR/react-*

View File

@ -2,14 +2,6 @@
command -v notify-send >/dev/null &&
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(echo "$history[$HISTCMD]" | sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
xo() {
while test $# -gt 0; do
xdg-open "$1"
shift
done
}
if which jrnl >/dev/null; then
alias j='jrnl'
jn() { jrnl -to today "$@" | less +G; }

7
.local/bin/scripts/xo Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
# xdg-open all given files
# TODO handle .desktop-files with gtk-launch/dex/kioclient exec, add selector from xdg-mime-file
while test $# -gt 0; do
xdg-open "$1"
shift
done