Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Suffix alias for README files



On 20 Apr 2011 at 11:23:07, Sebastian Stark wrote:
> 
> Am 19.04.2011 um 15:59 schrieb Anthony R Fletcher:
> 
> > I can use suffix aliases to display various .txt files. So
> > 
> > 	alias -s txt=less
> > 	./x.txt
> > 
> > actually runs
> > 
> > 	less ./x.txt
> > 
> > Can I do a similar thing for README files? So the "command"
> > 
> > 	/some/path/README
> > 
> > will really run the command 
> > 
> > 	less /some/path/README
> 
> It doesn't really answer your question, but are you aware of nullcmd redirection?
> 
>   <x.txt
> 
> or
> 
>   </some/path/README
> 
> will call whatever pager or viewer is set in $READNULLCMD. In the first case it's even less characters to type :)
> 
> 
> Sebastian

Thanks for the reply. Yes, I am aware of the nullcmd redirection and it
doesn't quite fit with the way I wanted to be lazy.

The use case is to have run something like 
	find . -name README
identify an interesting README file, triple click it with the mouse to
copy it (with trailing newline) and paste it into the current shell.

So I have to type "less " or "<" before I paste. The reality is I forget
and then use the history to repeat the now pasted line and add the
leading command.

So I wondered if you could do "the right thing" with files like x.txt
was there a way for README files?

			Anthony.


-- 
Anthony R Fletcher        
  Room 2033, Building 12A,        http://dcb.cit.nih.gov/~arif
  National Institutes of Health,  arif@xxxxxxxxxxxx
  12A South Drive, Bethesda,      Phone: (+1) 301 402 1741.
  MD 20892-5624, USA.



Messages sorted by: Reverse Date, Date, Thread, Author