Hi steve, ..

that still seems to open the editor , though it reads from the STDIN,
it still opens the editor, which was not exactly what I was looking
for .
I indeed found  a better tool, it is called "highlight", ..... A
source code formatter( can be found in the Fedora repos). the
following does the needful for me :
highlight <somefile> -M --style=vim.

anyway that was a nice hack,

thanks
Satish

On 2/17/09, steve <st...@lonetwin.net> wrote:
> Hi Satish,
>
> Satish Eerpini wrote:
>> Is it possible to 'cat' a file to the terminal in a particular color
>> scheme, say like the color scheme used by vim or something.
>> I mean instead of getting plain text when we run say :
>> cat foo.c
>> , can we obtain the output in a particular color scheme in the
>> terminal ? Is this possible ??
>
> Well, "cat" a tool for concatenating files. It does not know (or care) where
> it
> is cat-ing to (for that matter, it does not know or care, where it is
> cat-ing
> from either -- and still, or probably because of this, it is one of the most
> useful commands in the unix toolbox)
>
> OTOH, Pagers (like 'more' or 'less') are tools to view files on the
> terminal.
> That said, vim also behaves somewhat like a pager when invoked using the
> command
> 'view'. However, this does not do syntax highlighting, nor does it take
> input
> from stdin (ie: executing "cat /some/file | view" does not do what you
> expect)
>
> So, to view a file with syntax highlighting, you can use a vim trick.
> - Look for the file /usr/share/vim/vim*/macros/less.sh
> - create an alias for that script:
> $ alias vless='/usr/share/vim/vim<version>/macros/less.sh'
> (you may also save the alias in ~/.bashrc if you like)
> - now use vless as you would use less
> $ vless foo.c
> $ cat /some/file | some_filter | vless
>
> HTH
> regards,
> - steve
> --
> Linux Centric Marketplace: http://www.tuxcompatible.com
> _______________________________________________
> To unsubscribe, email ilugc-requ...@ae.iitm.ac.in with
> "unsubscribe <password> <address>"
> in the subject or body of the message.
> http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
>


-- 
http://satish.playdrupal.com
_______________________________________________
To unsubscribe, email ilugc-requ...@ae.iitm.ac.in with 
"unsubscribe <password> <address>"
in the subject or body of the message.  
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc

Reply via email to