Tuesday, December 29, 2009

Re: Align plugin - white space separators

Sorry about the html, folks -- but to show alignment properly, the email can't be using variable width fonts...

Chris Jones wrote:
------------------------------------------------------------------------
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    -----------------------------------------------------------------------
This is what I got after using \tsp:
   -----------------------------------------------------------------------
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?   

Hardly.  The fields, as shown above, are aligned with spaces appropriately intercalated.  Initial whitespace is another issue; there are three options for dealing with it (see :help alignctrl-w, alignctrl-W, and alignctrl-I).
 Or am I misunderstanding what the plugin does or can do when the separator is white space?   

I suspect that you have some option set that I don't (or possibly vice versa) that's interfering.  Perhaps you could try having the following in a file called "simple.vimrc":

set nocp
syn on
filetype plugin on

and using   vim -u simple.vimrc yourtestfile

and \tsp with it.  This will still load all your current plugins, one of which may somehow be interfering with Align.


 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.  [..]   

From an earlier note you'd said that you selected lines using ctrl-v.  That's visual block selection; the alignmaps will treat that the same as "V" (visual line selection).  It results in a range of lines.
   
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.   

Something in your setup is definitely odd.  All of the vim script portions of the various Align files are protected against double-loading; ie. for autoload/Align.vim, at the beginning is:

if exists("g:loaded_Align") || &cp
 finish
endif

This snippet essentially says that "if the autoload/Align.vim has already been loaded, don't load it again".  Your home directory is normally loaded first, so it should have prevented the systemwide lenny version from interfering.
 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.   
Again, what does

  :verbose map \tsp?

show (that question mark needs to be there)? 

Regards,
Chip Campbell

No comments: