Want more features on Pastebin? Sign Up, it's FREE!
Guest

vimpager-filenames-with-spaces-fix.patch

By: hermes14 on Jul 6th, 2011  |  syntax: Diff  |  size: 1.35 KB  |  views: 48  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. --- vimpager-1.5.5      2011-07-06 15:09:07.939130138 +0200
  2. +++ vimpager-1.5.5.new  2011-07-06 15:12:49.482771954 +0200
  3. @@ -232,27 +232,27 @@
  4.  mkdir /tmp/vimpager_$$
  5.  
  6.  filename=${@:-stdin}
  7. -filename=`echo $filename | tr '/' '_'`
  8. -filename=/tmp/vimpager_${$}/$filename
  9. +filename="`echo $filename | tr '/' '_'`"
  10. +filename="/tmp/vimpager_${$}/$filename"
  11.  
  12.  case "$@" in
  13. -       *.gz) gunzip -c "$@" | sed -e 's/\[[^m]*m//g' -e 's/.//g' > $filename ;;
  14. -       *.Z) uncompress -c "$@" | sed -e 's/\[[^m]*m//g' -e 's/.//g' > $filename ;;
  15. -       *) sed -e 's/\[[^m]*m//g' -e 's/.//g' "$@" > $filename ;;
  16. +       *.gz) gunzip -c "$@" | sed -e 's/\[[^m]*m//g' -e 's/.//g' > "$filename" ;;
  17. +       *.Z) uncompress -c "$@" | sed -e 's/\[[^m]*m//g' -e 's/.//g' > "$filename" ;;
  18. +       *) sed -e 's/\[[^m]*m//g' -e 's/.//g' "$@" > "$filename" ;;
  19.  esac
  20.  
  21.  # if file is zero length, exit immediately
  22. -if [ ! -s $filename ]; then
  23. +if [ ! -s "$filename" ]; then
  24.         exit
  25.  fi
  26.  
  27.  # On cygwin it might be the win32 gvim, but windows paths work for cygwin
  28.  # vim just fine as well.
  29.  if [ -n "$cygwin" ]; then
  30. -       filename=`cygpath -w $filename`
  31. +       filename=`cygpath -w "$filename"`
  32.  fi
  33.  
  34. -less_vim -c "${extra_cmd:-echo}" $filename </dev/tty
  35. +less_vim -c "${extra_cmd:-echo}" "$filename" </dev/tty
  36.  
  37.  # terminal vim on OSX can screw up the terminal
  38.  # (but doesn't anymore for some reason...)
clone this paste RAW Paste Data