Monday, December 28, 2009

Re: Align plugin - white space separators

Chris Jones wrote:
> On Sat, Dec 26, 2009 at 11:20:09PM EST, Charles E Campbell Jr wrote:
>
>> Chris Jones wrote:
>>
>>> Prettifying a color scheme, which looks like so:
>>>
>>> ------------------------------------------------------------------------
>>> 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
>>> ------------------------------------------------------------------------
>>>
>>> I wanted to end up with this:
>>>
>>> ------------------------------------------------------------------------
>>> 15 hi ErrorMsg ctermfg=9 cterm=none ctermfg=red
>>> 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
>>> ------------------------------------------------------------------------
>>>
>>> I gave the Align plugin a shot and eventually did the following:
>>>
>>> 15,18s/\ \ \+/@/g
>>> 15,18s/\ /@/g
>>> 15,18Align @
>>> 15,18s/@/\ /g
>>>
>>> Is there a more 'standard' way to do this?
>>>
>>>
>> :help alignmap-tsp
>>
>> might help.
>>
>
> I had already read this, and experimented with it.
>
> I selected the text via a Ctrl-V and issued a: ":Align \tsp" and nothing
> happened.
>

That's odd -- because it works for me, with your example as given
below. 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).

> Since I had tried many other things to get the plugin to align on white
> spaces before I found alignmap-tsp, I did it again just to make sure and
> saw the same result: the buffer is not modified.
>
> I read (again) the intro at :h align-maps, sourced AlignMaps.vim to be
> on the safe side, repeated the experience a couple of times, once with a
> different test file containing:
>
> ------------------------------------------------------------------------
> a b c d
> a b c d
> a b c d
> ------------------------------------------------------------------------
>
> .. and still nothing happens.
>
> I'm running Vim 7.1 on a debian lenny system and the plugin was
> installed like so:
>
> # vim-addons -v -w install align
>
> In other words, it's the version of the plugin that ships with Vim,
> installed by root, system-wide.
>
>
Well, align/alignmaps doesn't come with vim, although it appears that
debian lenny adds it in on their own. That install procedure is also
not the standard way to install align/alignmaps, its a debian-lenny
"thing", and so I'm not familiar with it (I use fedora, myself). 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

Regards,
Chip Campbell


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

No comments:

Post a Comment