Created
April 24, 2012 22:08
-
-
Save k-takata/2484229 to your computer and use it in GitHub Desktop.
less.sh.patch and less.vim.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r 04c692d60494 runtime/macros/less.sh | |
--- a/runtime/macros/less.sh Fri Apr 20 19:47:05 2012 +0200 | |
+++ b/runtime/macros/less.sh Wed Apr 25 07:02:19 2012 +0900 | |
@@ -1,16 +1,24 @@ | |
#!/bin/sh | |
# Shell script to start Vim with less.vim. | |
-# Read stdin if no arguments were given. | |
+# Read stdin if no arguments were given and stdin was redirected. | |
if test -t 1; then | |
- if test $# = 0; then | |
- vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' - | |
+ if test $# = 0; then | |
+ if test -t 0; then | |
+ echo "Missing filename" 1>&2 | |
+ exit | |
+ fi | |
+ vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' - | |
else | |
- vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' "$@" | |
+ vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' "$@" | |
fi | |
else | |
# Output is not a terminal, cat arguments or stdin | |
if test $# = 0; then | |
+ if test -t 0; then | |
+ echo "Missing filename" 1>&2 | |
+ exit | |
+ fi | |
cat | |
else | |
cat "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r 04c692d60494 runtime/macros/less.vim | |
--- a/runtime/macros/less.vim Fri Apr 20 19:47:05 2012 +0200 | |
+++ b/runtime/macros/less.vim Wed Apr 25 07:02:19 2012 +0900 | |
@@ -92,7 +92,8 @@ | |
fun! s:NextPage() | |
if line(".") == line("$") | |
if argidx() + 1 >= argc() | |
- quit | |
+ " Don't quit at the end of the last file | |
+ return | |
endif | |
next | |
1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment