commit b8fcad10af82a7345d4a661c2b0012ca1ba295e6
parent 7d75f34bd089e794485ba3784490dec50f0a3ba5
Author: William Casarin <jb55@jb55.com>
Date: Fri, 13 Nov 2020 09:05:47 -0800
fuzz: many fixes and updates
Diffstat:
7 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/bin/fuzz-compress-hist b/bin/fuzz-compress-hist
@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+touch $HOME/.fuzzhist
+tac $HOME/.fuzzhist | awk '!visited[$0]++' | tac > $HOME/.fuzzhist.2
+mv $HOME/.fuzzhist.2 $HOME/.fuzzhist
diff --git a/bin/fuzz-get-hist b/bin/fuzz-get-hist
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -e
+fuzz-compress-hist
+cmd=$(<$HOME/.fuzzhist $FUZZER --tac)
+echo echo -n \\r $cmd
diff --git a/bin/fuzz-notmuch-inbox b/bin/fuzz-notmuch-inbox
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+set -e
+
+res=$(notmuch-inbox | $FUZZER +m)
+
+thread=$(awk '{print $1}' <<<"$res")
+
+echo notmuch show --format=mbox $thread \| less
diff --git a/bin/fuzz-run-hist b/bin/fuzz-run-hist
@@ -1,6 +1,5 @@
#!/usr/bin/env bash
-touch $HOME/.fuzzhist
-tac $HOME/.fuzzhist | awk '!visited[$0]++' | tac > $HOME/.fuzzhist.2
-mv $HOME/.fuzzhist.2 $HOME/.fuzzhist
-cmd=$(<$HOME/.fuzzhist $FUZZER --tac) &&
+set -e
+fuzz-compress-hist
+cmd=$(<$HOME/.fuzzhist $FUZZER --tac)
echo $cmd
diff --git a/bin/notmuch-inbox b/bin/notmuch-inbox
@@ -0,0 +1,2 @@
+#!/usr/bin/env bash
+exec notmuch search "$@" tag:inbox and not tag:filed
diff --git a/bin/search-files b/bin/search-files
@@ -1,9 +1,12 @@
#!/usr/bin/env bash
set -e
-export INITIAL_QUERY="${INITIAL_QUERY:-$@}"
+INITIAL_QUERY=""
+if [ -n "$1" ]; then
+ INITIAL_QUERY="${@: -1}"
+fi
export RG_PREFIX="rg --column --line-number --no-heading --color=always --smart-case "
-export FZF_DEFAULT_COMMAND="$RG_PREFIX '$INITIAL_QUERY'"
-res=$(fzf --bind "change:reload:$RG_PREFIX {q} || true" --exit-0 --ansi --phony --query "$INITIAL_QUERY")
+export FZF_DEFAULT_COMMAND="$RG_PREFIX $@"
+res=$(fzf --bind "change:reload:$RG_PREFIX {q} || true" --ansi --phony --query "$INITIAL_QUERY")
file=$(readlink -f $(cut -d: -f1 <<<"$res"))
line=$(cut -d: -f2 <<<"$res")
diff --git a/dotfiles/commands b/dotfiles/commands
@@ -10,5 +10,7 @@ Sr systemd restart fuzz-systemd-restart
Ss systemd start fuzz-systemd-start
SS systemd stop fuzz-systemd-stop
h run fuzz hist fuzz-run-hist
+H get fuzz hist fuzz-get-hist
tj tag jump fuzz-tag-jump
gb git branches echo git-bvr
+n notmuch inbox fuzz-notmuch-inbox