vim

Fork of vim, an acceptable text editor
git clone git://git.laack.co/vim.git
Log | Files | Refs | README | LICENSE

less.sh (434B)


      1 #!/bin/sh
      2 # Shell script to start Vim with less.vim.
      3 # Read stdin if no arguments were given and stdin was redirected.
      4 
      5 if [ $# -eq 0 ] && [ -t 0 ]; then
      6   echo "$(basename "$0"): No input." 1>&2
      7   exit
      8 fi
      9 
     10 if [ -t 1 ]; then
     11   [ $# -eq 0 ] && set -- "-"
     12   [ "$*" != "-" ] && set -- -- "$@"
     13   exec vim --cmd 'let no_plugin_maps=1' -c 'runtime! macros/less.vim' --not-a-term "$@"
     14 else  # Output is not a terminal.
     15   exec cat -- "$@"
     16 fi