From b711a5f921edaa8c02191113da97d5bb8578c624 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Fri, 25 Mar 2022 09:14:30 +0100 Subject: [PATCH] config: a few script updates --- .config/nvim/init/plug.vim | 1 + .config/shell/functions | 9 +++++++-- .local/bin/scripts/git-origin | 7 ++++--- .local/bin/scripts/git-upstream | 4 ++++ .local/bin/scripts/help | 2 -- .local/bin/scripts/update-e2b | 6 +++--- README.org | 2 ++ 7 files changed, 21 insertions(+), 10 deletions(-) diff --git a/.config/nvim/init/plug.vim b/.config/nvim/init/plug.vim index 76ce1f9..e81a30e 100644 --- a/.config/nvim/init/plug.vim +++ b/.config/nvim/init/plug.vim @@ -18,6 +18,7 @@ Plug 'tpope/vim-surround' " edit surroundings - cs, ds, ys Plug 'bkad/CamelCaseMotion' " move through camel case words " commands Plug 'inkarkat/vim-ReplaceWithRegister' " gr to replace with register +Plug 'Konfekt/vim-sentence-chopper' " gw for sembr Plug 'tpope/vim-commentary' " gc to comment out (gcap for paragraph) Plug 'junegunn/vim-easy-align' " gaip*= - align in paragraph all equal signs xmap ga (EasyAlign) diff --git a/.config/shell/functions b/.config/shell/functions index 7d47e55..d76a3a9 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -46,10 +46,15 @@ unalias rd 2>/dev/null # System help {{{1 -alias h='help' compdef help=man alias info='info --vi-keys' +h() { + help "$@" + # TODO resolve aliases in 'h' alias + # TODO call 'wh' on scripts instead +} + xtrace() { set -x "$@" @@ -131,7 +136,7 @@ alias twtest='( cp -r "$TIMEWARRIORDB" /tmp/tw-bak && TIMEWARRIORDB=/tmp/timewar alias syslog='less +F /var/log/syslog' alias sc='sudo systemctl' -alias sce='sudo systemctl enable --now' +alias sce='sudo systemctl enable --now' # TODO or show log alias scd='sudo systemctl disable --now' scs() { ( diff --git a/.local/bin/scripts/git-origin b/.local/bin/scripts/git-origin index 5ddc47f..1c7d946 100755 --- a/.local/bin/scripts/git-origin +++ b/.local/bin/scripts/git-origin @@ -1,11 +1,12 @@ #!/bin/sh -e # set repo as origin and set all branches upstream to a corresponding remote branch, if available +remote="${4:-origin}" git remote $(case "$(git remote)" in - (*origin*) echo set-url;; + (*"$remote"*) echo set-url;; (*) echo add;; -esac) origin "$(git-repo "$@")" +esac) "$remote" "$(git-repo "$@")" git remote -v && git fetch git branch --format='%(refname:short)' | while read branch -do test $(git branch -a | grep origin/$branch | wc -l) -gt 0 && git branch -u origin/$branch $branch +do test $(git branch -a | grep $remote/$branch | wc -l) -gt 0 && git branch -u $remote/$branch $branch done diff --git a/.local/bin/scripts/git-upstream b/.local/bin/scripts/git-upstream index 274e3bc..2272b55 100755 --- a/.local/bin/scripts/git-upstream +++ b/.local/bin/scripts/git-upstream @@ -1,5 +1,9 @@ #!/bin/sh # set given repository as upstream or add as a new remote +# ARGS: +# - user/org +# - repo +# - remote name if test "$3" then name="$3" diff --git a/.local/bin/scripts/help b/.local/bin/scripts/help index 0878582..d3eb94b 100755 --- a/.local/bin/scripts/help +++ b/.local/bin/scripts/help @@ -4,8 +4,6 @@ # optdepends: highlight(dotfiles) paginate="${PAGER:-less} +Gg" test "$1" = "-d" && browse=1 && shift -# TODO resolve aliases in 'h' alias -# TODO call 'wh' on scripts instead case $1 in (zsh|zmv) # https://unix.stackexchange.com/questions/19290/zmv-for-zsh-dry-runs-and-man-pages for last; do true; done diff --git a/.local/bin/scripts/update-e2b b/.local/bin/scripts/update-e2b index 35bf59b..e515ca8 100755 --- a/.local/bin/scripts/update-e2b +++ b/.local/bin/scripts/update-e2b @@ -2,10 +2,10 @@ # Update an Easy2Boot USB Stick after adding ISOs # Call with Linux ISOs to be copied as args # Need to be around E2B mountpoint if it is not the default -dir="$(find -maxdepth 2 -name E2B -type d | grep . || echo "${MNT:-${XDG_RUNTIME_DIR}/mnt}/E2B")" -test $# -eq 0 || mv -vi "$@" "$dir/_ISO/LINUX" +dir="$(find . "${MNT:-${XDG_RUNTIME_DIR}/mnt}" -maxdepth 3 -name _ISO -type d | grep .)" +test $# -eq 0 || mv -vi "$@" "$dir/LINUX" find "$dir" -name "*32-*.iso" -exec mv -vi {} {}def32 \; find "$dir" -name "*.iso" -exec mv -vi {} {}def64 \; -drive=$(mount | grep "$dir" | cut -d' ' -f1) +drive=$(mount | grep "$(basename "$dir")" | cut -d' ' -f1) sudo umount $drive sudo udefrag $drive diff --git a/README.org b/README.org index 30e136f..9607d21 100644 --- a/README.org +++ b/README.org @@ -40,6 +40,7 @@ and configuration for ~less~ and ~fzf~. - utilities :: youtube-dl dos2unix - powertools :: hexedit hexyl [[https://lftp.yar.ru/][lftp]] glances zsh-doc pacman-contrib - multitools :: ffmpeg imagemagick pandoc +- documents :: pdftk java-commons-lang - music :: mpd mpc ncmpc vlc phonon-qt5-vlc mpdris2 : mkdir -p ~/.local/state/mpd && systemctl --user enable --now mpd mpDris2 #+begin_src sh YAY for AUR @@ -71,6 +72,7 @@ makepkg -si - health :: stretchly-xeruf-git redshift acpilight light : scu enable --now redshift -> https://www.reddit.com/r/linuxquestions/comments/pm1bxn/setting_brightness_on_amd_ryzen_7_5800h_with +- games :: opendungeons 0ad mindustry-bin minetest sauerbraten teeworlds *** Desktop - xorg :: xorg-xserver xorg-xkill xorg-setxkbmap xorg-xinit xterm xclip xprintidle light - wayland :: sway azote dex