From cf22927adfd3f215e08bd02367ed8b06b141d25a Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Wed, 9 Nov 2022 18:52:27 +0100 Subject: [PATCH] config: lots of tweaks --- .config/nvim/init/plug.vim | 1 + .config/shell/browse | 2 +- .config/shell/functions | 6 ++++-- .local/bin/scripts/git-get | 3 ++- .local/bin/scripts/git-rebranch | 6 +++--- .local/bin/scripts/update-e2b | 5 ++++- 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.config/nvim/init/plug.vim b/.config/nvim/init/plug.vim index e848d9e..d69801e 100644 --- a/.config/nvim/init/plug.vim +++ b/.config/nvim/init/plug.vim @@ -51,6 +51,7 @@ Plug 'mhinz/vim-signify' " VCS info on the left " Integrations "Plug 'airblade/vim-gitgutter' " Git info on the left and hunk bindings +" TODO disable for giant files Plug 'tpope/vim-fugitive' " Difftool usage Plug 'xeruf/vim-fossil' Plug 'austintraver/vim-jrnl' diff --git a/.config/shell/browse b/.config/shell/browse index a9e3180..ca44bb4 100644 --- a/.config/shell/browse +++ b/.config/shell/browse @@ -80,7 +80,7 @@ alias c=z # Listing for quick directory switcher based on zoxide and fzf alias zoxide-list='noglob zoxide query -sl' __zx_ls="ls --almost-all --color --human-readable --group-directories-first --file-type" -alias fzf-dir="fzf -0 -1 --tiebreak=index \ +alias fzf-dir="fzf -0 -1 --tiebreak=chunk,end,length \ --preview-window=30% --preview='$__zx_ls {}' \ --height=80% --reverse --keep-right" # fzf for zoxide - returns the selected path stripped of its score diff --git a/.config/shell/functions b/.config/shell/functions index f295b10..6ceac97 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -245,7 +245,7 @@ del() { u() { # Line below handy for users of netkeeper - timeout 1 curl -s https://github.com >/dev/null || echo "Suspending netkeeper" >&2 | echo sysupgrade | netkeeper 30 2>/dev/null + sudo nft list ruleset | grep -q outall && echo "Suspending netkeeper" >&2 | 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 @@ -335,11 +335,13 @@ alias omd="(echo '#+OPTIONS: tags:nil'; xclip -o -selection clipboard) | pandoc alias mdo="pandoc -f gfm-ascii_identifiers-gfm_auto_identifiers -t org-auto_identifiers --wrap preserve" alias mdox="xclip -o -selection clipboard | mdo | xclip -filter" +alias clr="diffr --colors refine-added:none:background:0x33,0x66,0x33:bold --colors added:none:background:0x33,0x44,0x33 --colors refine-removed:none:background:0x66,0x33,0x33:bold --colors removed:none:background:0x44,0x33,0x33 | less -F" + alias f="fossil" alias fs="fossil status" alias fc="fossil commit -v" fdf() { - fossil diff "$@" | diffr --colors refine-added:none:background:0x33,0x66,0x33:bold --colors added:none:background:0x33,0x44,0x33 --colors refine-removed:none:background:0x66,0x33,0x33:bold --colors removed:none:background:0x44,0x33,0x33 | less -F + fossil diff "$@" | clr } alias gdiff='git diff --word-diff=color --word-diff-regex=. --no-index' diff --git a/.local/bin/scripts/git-get b/.local/bin/scripts/git-get index 39e6528..2d7f64e 100755 --- a/.local/bin/scripts/git-get +++ b/.local/bin/scripts/git-get @@ -6,7 +6,8 @@ echo "Cloning $remote" test $1 = https && shift case $# in (1) dir=$(basename ${remote%.git});; - (3) test "$3" != "$(git config --get user.name)" && + (3) # TODO recognize shared prefix + test "$3" != "$(git config --get user.name)" && prefix=$(echo "$3" | sed "s|\(.\)\b.*$|\1|") && case "$2" in ("$prefix"*) ;; diff --git a/.local/bin/scripts/git-rebranch b/.local/bin/scripts/git-rebranch index 8ef3527..9dd2ce7 100755 --- a/.local/bin/scripts/git-rebranch +++ b/.local/bin/scripts/git-rebranch @@ -1,6 +1,6 @@ #!/bin/sh -# Recreates the current or given branch with the state from master or another given branch. +# Recreates the current or given branch with the state from main or another given branch. branch=${1:-$(git curbranch)} -test "$(git curbranch)" = "$branch" && git checkout ${2:-master} +test "$(git curbranch)" = "$branch" && git switch ${2:-main} git branch -D $branch -git checkout -b $branch +git switch -c $branch diff --git a/.local/bin/scripts/update-e2b b/.local/bin/scripts/update-e2b index b520d1d..9923bf1 100755 --- a/.local/bin/scripts/update-e2b +++ b/.local/bin/scripts/update-e2b @@ -2,7 +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 . "${MNT:-${XDG_RUNTIME_DIR}/mnt}" -maxdepth 3 -name _ISO -type d | grep .)" +if ! dir="$(find . "${MNT:-${XDG_RUNTIME_DIR}/mnt}" -maxdepth 3 -name _ISO -type d | grep .)" +then echo "Please mount your multiboot stick first!" + exit 1 +fi test $# -eq 0 || mv -vi "$@" "$dir/LINUX" find "$dir" -iname "*32-*.iso" -exec mv -vi {} {}def32 \; find "$dir" -iname "*.iso" -exec mv -vi {} {}def64 \;