about summary refs log tree commit diff
path: root/mless
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-07-20 15:43:53 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-07-20 15:43:53 +0200
commit4d7afac785b786f2cde96fc062fe1f9c988b534a (patch)
tree1f684b08570a8d08c620481eb0e44a9bd5877561 /mless
parentf3c4a50d538dda17dd83ba40313189ccb8f4d305 (diff)
downloadmblaze-4d7afac785b786f2cde96fc062fe1f9c988b534a.tar.gz
mblaze-4d7afac785b786f2cde96fc062fe1f9c988b534a.tar.xz
mblaze-4d7afac785b786f2cde96fc062fe1f9c988b534a.zip
add mprev/mnext to call mless with appropriate offset
Diffstat (limited to 'mless')
-rwxr-xr-xmless7
1 files changed, 6 insertions, 1 deletions
diff --git a/mless b/mless
index 0643460..a6f6079 100755
--- a/mless
+++ b/mless
@@ -26,7 +26,12 @@ if ! [ -t 1 ]; then
 	exec mseq "$@"
 fi
 
+case "$0" in
+	*next*) d=1;;
+	*prev*) d=-1;;
+	*) d=0;;
+esac
 curcmd=$(mseq -n "$@" |
-	awk -v cur=$(mseq -n .) '$1 == cur {print "+" FNR ":x"; quit}')
+	awk -v cur=$(mseq -n .) -v d=$d '$1 == cur {print "+" FNR+d ":x"; quit}')
 
 LESSOPEN="|$0 --filter %s" exec less -R $curcmd $(mseq -n "$@")