D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Syntax highlighting cat (vim?)

 

Simon Waters wrote:
> Neil Williams wrote:
>> On Mon, 2008-11-10 at 12:50 +0000, Simon Williams wrote:
>>> Does anyone know if there is such a thing as a cat command which does 
>>> syntax highlighting?
> 
>> vim will expect to write the file out, so you need to use :q! to exit.
> 
> Or...
> 
> cat chess/chess/src/main.c |  source-highlight --src-lang=c --out-format=esc
> 
> Although to be honest "esc" isn't that useful an output format,
> source-highlight does a load of other languages and output formats.
> 
> Simon, why were you after this? Source highlighting is useful for
> editing and documentation, but it seems pretty pointless as just part of
>  cat'ing a file.
> 
> I'm thinking "view" is maybe what you are looking for, starts vim in
> read-only mode, but maybe there is something else you are trying to do.

If I'm reading lots of smallish files I just want to dump them on the 
screen (and use my terminal's scrolling to read them if they are too 
large). I've got so used to vim's syntax highlighting that it's 
currently not worth it unless I get it highlighted. A quick test using 
ls --color=always shows that grep, head and tail will work with colors 
for quick viewing purposes.

Maybe this just shows that I should know vim better and be doing it all 
inside that.

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html