about summary refs log tree commit diff
path: root/mless
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-07-28 23:46:02 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-07-28 23:46:02 +0200
commit803665b9b2fbd4b131758ebefcb1eb77aa46d00b (patch)
treea1d1b6edbc7ff737bd85f9d0d6eae5b22074b128 /mless
parent430bb0d74c9157cdbd1e8ca5619b5c8241ec7fad (diff)
downloadmblaze-803665b9b2fbd4b131758ebefcb1eb77aa46d00b.tar.gz
mblaze-803665b9b2fbd4b131758ebefcb1eb77aa46d00b.tar.xz
mblaze-803665b9b2fbd4b131758ebefcb1eb77aa46d00b.zip
mless: experimental shortcuts
Compile mlesskey.example into ~/.mless to use them.
Diffstat (limited to 'mless')
-rwxr-xr-xmless20
1 files changed, 18 insertions, 2 deletions
diff --git a/mless b/mless
index 03f41a1..db0a728 100755
--- a/mless
+++ b/mless
@@ -71,5 +71,21 @@ fi
 
 nl="
 "
-LESSOPEN="|$0 --filter %s" exec less -Ps"mless %f?m (message %i of %m).." -R \
-	"+:e $(mseq -n .)$nl" //scan $(mseq -n :)
+while :; do
+	[ -f $HOME/.mless ] && export LESSKEY=$HOME/.mless
+	LESSOPEN="|$0 --filter %s" \
+		less -Ps"mless %f?m (message %i of %m).." -R \
+			"+:e $(mseq -n .)$nl" //scan $(mseq -n :)
+	case "$?" in
+	0|1) exit $?;;
+	78) # N go to next unsen message
+		mseq -C "$(mseq -r .: |
+			awk -F':2,' '$1 !~ /^</ && $2 !~ /S/ { print; exit }')";;
+	107) # k next thread
+		mseq -C "$(mseq .+1: | grep -m1 '^[^ <]')";;
+	100) # d mark read
+		mflag -S .
+		mseq -f | mseq -S
+		mseq -C +
+	esac
+done