From e159696ee61bcfdc4a14371de3d19b1958ff3e0f Mon Sep 17 00:00:00 2001 From: xerus2000 <27jf@pm.me> Date: Thu, 26 Nov 2020 20:32:26 +0100 Subject: [PATCH] config/shell: fixes & add jrnl aliases --- .config/jrnl/jrnl.yaml | 2 +- .config/shell/functions | 11 ++++++++++- .local/bin/b | 2 +- .local/bin/wh | 4 ---- 4 files changed, 12 insertions(+), 7 deletions(-) delete mode 100755 .local/bin/wh diff --git a/.config/jrnl/jrnl.yaml b/.config/jrnl/jrnl.yaml index f30eb43..dc73b65 100644 --- a/.config/jrnl/jrnl.yaml +++ b/.config/jrnl/jrnl.yaml @@ -15,5 +15,5 @@ journals: linewrap: 99 tagsymbols: '@' template: false -timeformat: '%Y-%m-%d %H:%M' +timeformat: '%Y-%m-%d %a %H:%M' version: v2.4.5 diff --git a/.config/shell/functions b/.config/shell/functions index 5842199..232d201 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -19,6 +19,15 @@ rd() { } rr() { mv "$@" /tmp } +alias j='jrnl' +alias jn='jrnl -to today | bat --style=plain --pager="less +G"' + +# like "which", but shows contents if it resolves to a file +wh() { + res=$(which "$@") + test -r "$res" && b --plain "$res" || echo "$res" +} + alias logoff="loginctl terminate-user $USER" # Some aliases @@ -86,7 +95,7 @@ t() { alias tw='timew' twsm() { timew summary $(date --date="Monday $1 week ago" -I) to tomorrow :ids ${@:2} } -alias twtest='( TIMEWARRIORDB=/tmp/timewarriordb && mv ${TIMEWARRIORDB} /tmp/twdb && mkdir -p ${TIMEWARRIORDB}/data && :> ${TIMEWARRIORDB}/timewarrior.cfg && $SHELL )' +alias twtest='( cp -r "$TIMEWARRIORDB" /tmp/tw-bak && TIMEWARRIORDB=/tmp/timewarriordb-test/$(date +%s) && mkdir -p "$TIMEWARRIORDB"/data && :> "$TIMEWARRIORDB"/timewarrior.cfg && $SHELL )' # Quick shortcuts alias c='clear' diff --git a/.local/bin/b b/.local/bin/b index 914686f..88733a6 100755 --- a/.local/bin/b +++ b/.local/bin/b @@ -6,5 +6,5 @@ file "$last" | grep -v --color=never directory case "$(file --dereference --mime "$last")" in *inode/directory*) ls -l --color=auto --human-readable --group-directories-first --file-type --dereference-command-line --all --reverse "$@";; *binary) ;; - *) $(test -r "$last" && echo "bat" || echo "sudo bat") --style header "$@";; + *) $(test -f "$last" -a ! -r "$last") bat --style header "$@";; esac diff --git a/.local/bin/wh b/.local/bin/wh deleted file mode 100755 index 905d46f..0000000 --- a/.local/bin/wh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# like "which", but shows contents if it resolves to a file -res=$(which "$@") -test -r "$res" && b --plain "$res" || echo "$res"