summaryrefslogtreecommitdiffstats
path: root/runtime/macros/less.sh
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/macros/less.sh')
-rwxr-xr-xruntime/macros/less.sh15
1 files changed, 12 insertions, 3 deletions
diff --git a/runtime/macros/less.sh b/runtime/macros/less.sh
index 256936b5e3..484c714ce6 100755
--- a/runtime/macros/less.sh
+++ b/runtime/macros/less.sh
@@ -2,8 +2,17 @@
# Shell script to start Vim with less.vim.
# Read stdin if no arguments were given.
-if test $# = 0; then
- vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' -
+if test -t 1; then
+ if test $# = 0; then
+ 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' "$@"
+ fi
else
- vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' "$@"
+ # Output is not a terminal, cat arguments or stdin
+ if test $# = 0; then
+ cat
+ else
+ cat "$@"
+ fi
fi