Re: No way to color-region(s) of text -- highlighter mode.
- Mohsin wrote:
> I want to use a highlighter mode on my text file, example:Vim regexps allow you to specify line and/or column numbers. Example, to
> :color_region bold line1 col1 line2 col2
> :color_region bold 5 5 6 6
> :color_region underline 5 5 6 6
> I couldn't do this in vim. Vim only has syntax coloring with regexps.
> Emacs has functions to apply properties to text blocks, and I was hoping
> vim has something comparable.
match a block defined by lines 55 to 77, virtual columns 15 to 37, and
highlight it in bold-underlined text:
:highlight User1 term=bold,underline cterm=bold,underline
:match User1 /^\%55l\_.*\%77l$\&\%>14v.*\%<39v/
(these are two commands, each on one line). The pattern means "(from the
beginning of line 55, anythyng including line breaks, up to the end of
line 77) *and* (from after virtual comumn 14, anything but line breaks,
as much as possible, followed by a zero-length match before column 39)".
I _think_ this is the correct phrasing but you should test it. The
"after column" and "before column" matchings are used to avoid problems
if the exact columns in question are, let's say, halfway a tab. IIUC,
the rightmost column that can be included in "a zero-length match before
column 39" is column 37.
- On 8/7/06, Mikolaj Machowski <mikmach@...> wrote:
> Dnia poniedziałek, 7 sierpnia 2006 15:46, Charles E Campbell Jr napisał:[Vince Negri's conceal patch]
> This works only on character wise collapsing and also isn't perfect.Well, the point is that you, as a user using this feature, has to be
> When doing line wise concealing you will never now (with exception of
> :se number) if there are hidden lines.
aware of this. It's the same with "rm -rf /", if you know what you're
doing, it's fine, but if not it's a disaster. The conceal patch is a
lot safer, however, as you'd be able to control the concealment,
whereas "rm -rf /" is a bit more volatile.