citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

lessr (401B)


      1 #!/usr/bin/env bash
      2 
      3 dir=$(dirname "$1")
      4 base=$(basename "$1")
      5 
      6 if [ "$base" == "" ]; then
      7 	exit 3
      8 fi
      9 
     10 export LESSHISTFILE="$dir/.$base.hst"
     11 touch $LESSHISTFILE || :
     12 
     13 # use a fallback dir if it's not writable
     14 if [ ! -w "$LESSHISTFILE" ]
     15 then
     16     dir="$HOME/var/marks"
     17     mkdir -p "$dir"
     18     export LESSHISTFILE="$dir/.$base.hst"
     19 fi
     20 
     21 # export LESS="-cix8JRM --save-marks"
     22 less "+''" --save-marks "$@"