commit 2337f8d7be72b371755d15058228c0ecdb15fc76
parent 60be64854416257459f78b32db82c2d99d67eb93
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Tue, 7 Jul 2020 10:00:50 +0200
Show last command as first suggestion
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/.local/bin/search b/.local/bin/search
@@ -2,10 +2,11 @@
histfile="$HOME/.cache/searchhist"
if [ $# -lt 1 ]; then
- targets="$(cat "$HOME"/doc/gopherbookmarks; \
+ targets="$(
+ tail -1 "$histfile";
+ cat "$HOME"/doc/gopherbookmarks;
grep 'href="htt' "$HOME"/doc/bookmark.html |
- sed 's/<\/.*>//g' |
- sed 's/.*<a href="//;s/">/ /;s/<\/a>//';
+ sed 's,</.*>,,g; s,.*<a href=",,; s,">, ,; s,</a>,,';
cat "$HOME"/doc/bookmark.txt;
dmenu_path)"
@@ -21,7 +22,7 @@ fi
if [ "$c" = "r" ]; then
c="$(tail -1 "$histfile")"
else
- printf '%s' "$c" > "$histfile"
+ printf '%s\n' "$c" > "$histfile"
fi
regexmatch() {