Tuesday, December 29, 2009

Re: Align plugin - white space separators

On Mon, Dec 28, 2009 at 10:35:01AM EST, Charles Campbell wrote:
> Chris Jones wrote:

[..]

> > I selected the text via a Ctrl-V and issued a: ":Align \tsp" and
> > nothing happened.

------------------------------------------------------------------------
15 hi ErrorMsg ctermfg=9 cterm=none ctermfg=red etc...
16 hi Visual ctermbg=61 cterm=none ctermfg=bg
17 hi VisualNOS ctermbg=61 cterm=none ctermfg=bg
18 hi Underlined ctermfg=fg ctermbg=bg term=underline
------------------------------------------------------------------------

Actually, when I indent a few lines such as l. 15 and l. 17 above, the
plugin realigns them, so to speak.

------------------------------------------------------------------------
15 hi ErrorMsg ctermfg=9 cterm=none ctermfg=red etc...
16 hi Visual ctermbg=61 cterm=none ctermfg=bg
17 hi VisualNOS ctermbg=61 cterm=none ctermfg=bg
18 hi Underlined ctermfg=fg ctermbg=bg term=underline
------------------------------------------------------------------------

So it looks like it's doing something but it's limited to aligning the
each line's leading white space?

Or am I misunderstanding what the plugin does or can do when the
separator is white space?

If you take line 15 above for instance, there are seven spaces after
ErrorMSg, while line 16 has fourteen between Visual and ctermbg=61.

What's the plugin supposed to do?

The right thing to do as I see it would be to collapse all contiguous
spaces so that there is only one space separating fields, and then
expand them so that field1, field2, field3, etc. on each line starts in
the same column.

But then that's because that's what _I_ want the plugin to do for me in
this particular case.. :-)

> That's odd -- because it works for me, with your example as given
> below.

Never underestimate the creative powers of the User.

> Now, although the Align command itself works with visually selected
> blocks, the maps don't work with ctrl-v selected blocks (ie. such
> visual blocks are treated as visually selected line ranges, like "V").
> One way to get the maps to work with visual blocks is with vis.vim;
> you can get vis.vim from:

> http://vim.sourceforge.net/scripts/script.php?script_id=1195 (stable)
> http://mysite.verizon.net/astronaut/vim/index.html#VIS (cutting edge)

> With it, use ctrl-v to select the visual block and then :B \tsp (for
> example).

Yes, but I'm not using any kind of selection - I'm using the syntax as
defined in the help file:

:[range]Align \tsp
:[range]Align \Tsp
:[Range]Align \tsq ... etc.

[..]

> So to determine why the alignmaps aren't working will take some
> investigation (are plugin/AlignMapsPlugin.vim, autoload/AlignMaps.vim,
> etc in the proper places, what is the result of :verbose map \tsp?
> etc), or perhaps you could simply get the latest version

> (http://mysite.verizon.net/astronaut/vim/index.html#ALIGN)

> and install it:
>
> vim align.vba.gz
> :so %
> :q

Had done that just in case, but it gets me a screenful of messages where
all the <leader>xx's installed by the plugin are already mapped. I had
removed the 'lenny' version, and started a fresh instance of Vim, so I
don't know.

Anyway the version from your web site does exactly the same, just
removes leading blanks on every line that happens to have them.

The more I think about it, it's probably me misunderstanding what the
plugin should be doing when spaces are used as separators.

Thanks,

CJ

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment