Friday, August 31, 2012

Re: Colourising command line

On Thursday, 30 August 2012 16:05:40 UTC+1, Ben Fritz wrote:
> I alluded to it without making it explicit, but while you can make Vim do pretty much anything by modifying the source, I think you'll have better luck using regular syntax highlighting commands to accomplish what you want in the command-line window instead of the command-line itself. The command-line window is a special buffer but you can give it filetype and syntax just like any other buffer. I think by default it gets the normal "vim" filetype and syntax applied, but you could readily change this. You could then use whatever syntax file you come up with to highlight vim scripts in files as well as when typed as commands.
>
> Doing it with a syntax file applied to the command-window, you get the added bonus of being able to share your work with others who don't want to apply your patch to Vim, and additionally you don't risk the need to update your patch with every new upstream version of Vim.

Thank you for this new information.

I'm in line with your own thinking, though would prefer to engineer a solution which can be applied to the command line as well. That's what I primarily use - partly because it's quicker than the additional typing involved with entering and exiting command mode, and partly because one-liners are more common than multiline commands, e.g. common application of search and replace.

It's probably best for me to not comment further until I know more about what's possible without source code modification from my own investigation, but if what you say is true - that syntax highlighting can be applied to the command window but not the command line - then my natural impulse is to modify Vim's source code to add syntax highlighting to the command line. This would be a generic modification that should receive no complaint from other developers or users since it in no way affects default behaviour of the editor, and it would allow creation of syntax highlighting rules which could be shared by both command line and command window.

Cheers,

David

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: