| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | #!/bin/sh
 | 
					
						
							|  |  |  | # Shell script to start Vim with less.vim. | 
					
						
							| 
									
										
										
										
											2012-05-18 13:46:39 +02:00
										 |  |  | # Read stdin if no arguments were given and stdin was redirected. | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-24 20:39:31 +00:00
										 |  |  | if test -t 1; then | 
					
						
							| 
									
										
										
										
											2012-05-18 13:46:39 +02:00
										 |  |  |   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' - | 
					
						
							| 
									
										
										
										
											2008-06-24 20:39:31 +00:00
										 |  |  |   else | 
					
						
							| 
									
										
										
										
											2012-05-18 13:46:39 +02:00
										 |  |  |     vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' "$@" | 
					
						
							| 
									
										
										
										
											2008-06-24 20:39:31 +00:00
										 |  |  |   fi | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | else | 
					
						
							| 
									
										
										
										
											2008-06-24 20:39:31 +00:00
										 |  |  |   # Output is not a terminal, cat arguments or stdin | 
					
						
							|  |  |  |   if test $# = 0; then | 
					
						
							| 
									
										
										
										
											2012-05-18 13:46:39 +02:00
										 |  |  |     if test -t 0; then | 
					
						
							|  |  |  |       echo "Missing filename" 1>&2 | 
					
						
							|  |  |  |       exit | 
					
						
							|  |  |  |     fi | 
					
						
							| 
									
										
										
										
											2008-06-24 20:39:31 +00:00
										 |  |  |     cat | 
					
						
							|  |  |  |   else | 
					
						
							|  |  |  |     cat "$@" | 
					
						
							|  |  |  |   fi | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | fi |