From 35b07f8ccc236650ca4003220d22507d25523e6c Mon Sep 17 00:00:00 2001 From: Tobias Schmidl <5060861-schtobia@users.noreply.gitlab.com> Date: Mon, 7 Mar 2022 13:41:02 +0100 Subject: [PATCH 01/10] use binary prefixes on exa --- exa.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exa.zsh b/exa.zsh index 3f36d49..44a8b98 100644 --- a/exa.zsh +++ b/exa.zsh @@ -1,6 +1,6 @@ #! /bin/zsh -alias exa='exa -FHhg@ --git --time-style long-iso' +alias exa='exa -FHhg@ --git --binary --time-style long-iso' alias exal='exa -l' function exat() { [[ "$1" != <-> ]] && { echo "Usage: exat [path]"; exit 1 }; From 1a780bad643386d3f393021aced15a93e526d426 Mon Sep 17 00:00:00 2001 From: Tobias Schmidl <5060861-schtobia@users.noreply.gitlab.com> Date: Thu, 5 May 2022 21:21:11 +0200 Subject: [PATCH 02/10] Addded mdw function --- browser.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/browser.zsh b/browser.zsh index fbafbbf..de20b79 100644 --- a/browser.zsh +++ b/browser.zsh @@ -7,3 +7,4 @@ function google() { elinks -dump "https://www.google.de/search?q=$(escape "$@")" function wetter() { curl --tr-encoding -H "Accept-Language: ${LANG%_*}" "https://wttr.in/$*"; } function wetter2() { curl --tr-encoding -H "Accept-Language: ${LANG%_*}" "https://v2.wttr.in/$*"; } +function mdw() { pandoc "$@" | w3m -T text/html } From 980fa0ddb292044334f675044e469e79049ce471 Mon Sep 17 00:00:00 2001 From: Tobias Schmidl <5060861-schtobia@users.noreply.gitlab.com> Date: Mon, 23 May 2022 11:01:49 +0200 Subject: [PATCH 03/10] added fzf.zsh --- fzf.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 fzf.sh diff --git a/fzf.sh b/fzf.sh new file mode 100644 index 0000000..dc97ead --- /dev/null +++ b/fzf.sh @@ -0,0 +1,17 @@ +export FZF_COMPLETION_OPTS='--border --info=inline' + +# (EXPERIMENTAL) Advanced customization of fzf options via _fzf_comprun function +# - The first argument to the function is the name of the command. +# - You should make sure to pass the rest of the arguments to fzf. +_fzf_comprun() { + local command=$1 + shift + + case "$command" in + vim) fzf "$@" --preview 'batcat --color=always {}' ;; + cd) fzf "$@" --preview 'tree -C {} | head -200' ;; + export|unset) fzf "$@" --preview "eval 'echo \$'{}" ;; + ssh) fzf "$@" --preview 'dig {}' ;; + *) fzf "$@" ;; + esac +} From 1d99b9bdc7cc8c510eb00c07ad36b24e9787e0de Mon Sep 17 00:00:00 2001 From: Tobias Schmidl <5060861-schtobia@users.noreply.gitlab.com> Date: Tue, 7 Jun 2022 20:41:25 +0200 Subject: [PATCH 04/10] render the result of pandoc with x-www-browser --- browser.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser.zsh b/browser.zsh index de20b79..7a8f618 100644 --- a/browser.zsh +++ b/browser.zsh @@ -7,4 +7,4 @@ function google() { elinks -dump "https://www.google.de/search?q=$(escape "$@")" function wetter() { curl --tr-encoding -H "Accept-Language: ${LANG%_*}" "https://wttr.in/$*"; } function wetter2() { curl --tr-encoding -H "Accept-Language: ${LANG%_*}" "https://v2.wttr.in/$*"; } -function mdw() { pandoc "$@" | w3m -T text/html } +alias mdw=mdw.sh From 49e6788ecfe57a6914cdfe907dbb997a147ef91c Mon Sep 17 00:00:00 2001 From: Tobias Schmidl <5060861-schtobia@users.noreply.gitlab.com> Date: Thu, 8 Dec 2022 10:30:48 +0100 Subject: [PATCH 05/10] added less opt --- zinit.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/zinit.zsh b/zinit.zsh index 7336061..d8c40f2 100644 --- a/zinit.zsh +++ b/zinit.zsh @@ -1,5 +1,6 @@ [ -z "$EDITOR" ] && export EDITOR=sensible-editor +export LESS="-F -R" [ -r "$HOME/.config/user-dirs.dirs" -a \ -z "$XDG_DESKTOP_DIR" -a \ From 49ad34442f87db145ab94dea2077267b6c935187 Mon Sep 17 00:00:00 2001 From: Tobias Schmidl <5060861-schtobia@users.noreply.gitlab.com> Date: Tue, 24 Jan 2023 15:31:43 +0100 Subject: [PATCH 06/10] removed local-bin --- local-bin.zsh | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 local-bin.zsh diff --git a/local-bin.zsh b/local-bin.zsh deleted file mode 100644 index 1769729..0000000 --- a/local-bin.zsh +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/zsh -# Make sure we include this file only once -if [ -z "$ZSH_LOCAL_BIN_ALREADY_SET" ]; -then - export ZSH_LOCAL_BIN_ALREADY_SET=1 - # set PATH so it includes user's private bin if it exists - [ -d "$HOME/.local/bin" ] && PATH="$HOME/.local/bin:$PATH" - [ -d "$HOME/bin" ] && PATH="$HOME/bin:$PATH" -fi From ad58cbed866feae78fe4e14701e5142c246b801a Mon Sep 17 00:00:00 2001 From: Tobias Schmidl Date: Mon, 10 Jul 2023 11:56:29 +0200 Subject: [PATCH 07/10] added mktemp --- aliases.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aliases.zsh b/aliases.zsh index 9442e82..1420563 100644 --- a/aliases.zsh +++ b/aliases.zsh @@ -2,6 +2,8 @@ alias cdiff="colordiff" +alias mktemp='mktemp --suffix=.delme --tmpdir=$XDG_RUNTIME_DIR' + function clean-gpg () { [ -z "$(command -v gpg2)" ] && exit 1; for key in $(gpg2 -k | sed -rn 's/pub +[a-z0-9]+\/(0x[0-9A-Fa-f]+).*/\1/p'); From dea76cfaab1f8783859719fda7788699ca30e2a0 Mon Sep 17 00:00:00 2001 From: Tobias Schmidl Date: Mon, 10 Jul 2023 12:31:40 +0200 Subject: [PATCH 08/10] changes to fzf, batcat --- batcat.zsh | 9 +++++++++ fzf.sh | 17 ----------------- fzf.zsh | 18 ++++++++++++++++++ 3 files changed, 27 insertions(+), 17 deletions(-) create mode 100644 batcat.zsh delete mode 100644 fzf.sh create mode 100644 fzf.zsh diff --git a/batcat.zsh b/batcat.zsh new file mode 100644 index 0000000..2640bbb --- /dev/null +++ b/batcat.zsh @@ -0,0 +1,9 @@ +alias bathelp='bat --plain --language=help' +unalias help +help() { + "$@" --help 2>&1 | bathelp +} + +batdiff() { + git diff --name-only --relative --diff-filter=d | xargs bat --diff +} diff --git a/fzf.sh b/fzf.sh deleted file mode 100644 index dc97ead..0000000 --- a/fzf.sh +++ /dev/null @@ -1,17 +0,0 @@ -export FZF_COMPLETION_OPTS='--border --info=inline' - -# (EXPERIMENTAL) Advanced customization of fzf options via _fzf_comprun function -# - The first argument to the function is the name of the command. -# - You should make sure to pass the rest of the arguments to fzf. -_fzf_comprun() { - local command=$1 - shift - - case "$command" in - vim) fzf "$@" --preview 'batcat --color=always {}' ;; - cd) fzf "$@" --preview 'tree -C {} | head -200' ;; - export|unset) fzf "$@" --preview "eval 'echo \$'{}" ;; - ssh) fzf "$@" --preview 'dig {}' ;; - *) fzf "$@" ;; - esac -} diff --git a/fzf.zsh b/fzf.zsh new file mode 100644 index 0000000..9ff9b0f --- /dev/null +++ b/fzf.zsh @@ -0,0 +1,18 @@ +export FZF_COMPLETION_OPTS='--border --info=inline' +source /usr/share/doc/fzf/examples/completion.zsh +source /usr/share/doc/fzf/examples/key-bindings.zsh +# (EXPERIMENTAL) Advanced customization of fzf options via _fzf_comprun function +# - The first argument to the function is the name of the command. +# - You should make sure to pass the rest of the arguments to fzf. +_fzf_comprun() { + local command=$1 + shift + + case "$command" in + vim|nvim|nano) fzf "$@" --preview 'batcat --color=always {}' ;; + cd) fzf "$@" --preview 'tree -C {} | head -200' ;; + export|unset) fzf "$@" --preview "eval 'echo \$'{}" ;; + ssh) fzf "$@" --preview 'dig {}' ;; + *) fzf "$@" ;; + esac +} From e966123170588c281952f5185f9265593c35dd5f Mon Sep 17 00:00:00 2001 From: Tobias Schmidl Date: Wed, 12 Jul 2023 08:37:25 +0200 Subject: [PATCH 09/10] fzf.zsh: Bugfix for termux --- fzf.zsh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/fzf.zsh b/fzf.zsh index 9ff9b0f..a0ff03a 100644 --- a/fzf.zsh +++ b/fzf.zsh @@ -1,6 +1,14 @@ export FZF_COMPLETION_OPTS='--border --info=inline' -source /usr/share/doc/fzf/examples/completion.zsh -source /usr/share/doc/fzf/examples/key-bindings.zsh + +if [ -n "$TERMUX_VERSION" ] && [ -d "$PREFIX" ]; +then + source "$PREFIX/share/fzf/completion.zsh" + source "$PREFIX/share/fzf/key-bindings.zsh" +else + source /usr/share/doc/fzf/examples/completion.zsh + source /usr/share/doc/fzf/examples/key-bindings.zsh +fi + # (EXPERIMENTAL) Advanced customization of fzf options via _fzf_comprun function # - The first argument to the function is the name of the command. # - You should make sure to pass the rest of the arguments to fzf. From 05d2cbd709830b98081272c85908c8735a5c8548 Mon Sep 17 00:00:00 2001 From: Tobias Schmidl Date: Wed, 12 Jul 2023 08:47:40 +0200 Subject: [PATCH 10/10] Added shebangs, shellcheck configuration line --- aliases.zsh | 1 + batcat.zsh | 3 +++ browser.zsh | 1 + debfunctions.zsh | 5 ++++- exa.zsh | 1 + fzf.zsh | 3 +++ systemd.zsh | 4 +++- zinit.zsh | 4 ++++ 8 files changed, 20 insertions(+), 2 deletions(-) diff --git a/aliases.zsh b/aliases.zsh index 1420563..da3bf1a 100644 --- a/aliases.zsh +++ b/aliases.zsh @@ -1,4 +1,5 @@ #! /bin/zsh +# shellcheck shell=bash alias cdiff="colordiff" diff --git a/batcat.zsh b/batcat.zsh index 2640bbb..d44984d 100644 --- a/batcat.zsh +++ b/batcat.zsh @@ -1,3 +1,6 @@ +#! /bin/zsh +# shellcheck shell=bash + alias bathelp='bat --plain --language=help' unalias help help() { diff --git a/browser.zsh b/browser.zsh index 7a8f618..0e575da 100644 --- a/browser.zsh +++ b/browser.zsh @@ -1,4 +1,5 @@ #! /bin/zsh +# shellcheck shell=bash function escape() { perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$@"; } diff --git a/debfunctions.zsh b/debfunctions.zsh index 5e1fe43..dfb7522 100644 --- a/debfunctions.zsh +++ b/debfunctions.zsh @@ -1,2 +1,5 @@ -# this is ripped off serverfault https://serverfault.com/a/90401 +#! /bin/zsh +# shellcheck shell=bash + +# this is ripped off serverfault https://serverfault.com/a/90401 function debchangedconfigs () { dpkg-query -W -f='${Conffiles}\n' '*' | awk 'OFS=" "{print $2,$1}' | LANG=C md5sum -c 2>/dev/null | awk -F': ' '$2 !~ /OK$/{print $1}' | sort; } diff --git a/exa.zsh b/exa.zsh index 44a8b98..a6c1057 100644 --- a/exa.zsh +++ b/exa.zsh @@ -1,4 +1,5 @@ #! /bin/zsh +# shellcheck shell=bash alias exa='exa -FHhg@ --git --binary --time-style long-iso' alias exal='exa -l' diff --git a/fzf.zsh b/fzf.zsh index a0ff03a..b86b474 100644 --- a/fzf.zsh +++ b/fzf.zsh @@ -1,3 +1,6 @@ +#! /bin/zsh +# shellcheck shell=bash + export FZF_COMPLETION_OPTS='--border --info=inline' if [ -n "$TERMUX_VERSION" ] && [ -d "$PREFIX" ]; diff --git a/systemd.zsh b/systemd.zsh index c98ed9c..9941dcf 100644 --- a/systemd.zsh +++ b/systemd.zsh @@ -1,3 +1,6 @@ +#! /bin/zsh +# shellcheck shell=bash + user_commands=( list-units is-active status show help list-unit-files is-enabled list-jobs show-environment cat list-timers @@ -16,4 +19,3 @@ for c in $sudo_commands; do; alias sc-$c="sudo systemctl $c"; done alias sc-enable-now="sc-enable --now" alias sc-disable-now="sc-disable --now" alias sc-mask-now="sc-mask --now" - diff --git a/zinit.zsh b/zinit.zsh index d8c40f2..0c84e60 100644 --- a/zinit.zsh +++ b/zinit.zsh @@ -1,3 +1,6 @@ +#! /bin/zsh +# shellcheck shell=bash + [ -z "$EDITOR" ] && export EDITOR=sensible-editor export LESS="-F -R" @@ -11,6 +14,7 @@ export LESS="-F -R" -z "$XDG_MUSIC_DIR" -a \ -z "$XDG_PICTURES_DIR" -a \ -z "$XDG_VIDEOS_DIR" ] && . "$HOME/.config/user-dirs.dirs" + export MAILCHECK=1 which fortune >/dev/null && which cowsay > /dev/null && fortune -e debian house-harkonnen house-atreides pratchett | cowsay -f tux -W 76 -n