Benjamin R. Haskell wrote:
On Thu, 11 Mar 2010, Charles Campbell wrote:

[snip]
Look into Align.vim;  \tsp  does whitespace based alignment

      http://mysite.verizon.net/astronaut/vim/index.html#ALIGN     (beta)
      http://vim.sourceforge.net/scripts/script.php?script_id=1195 (stable)

Interesting. This seems to get me partway there. It's later in the process than I'd like. Though it looks like it will help in my situation after something is altered (and I have to align something again).

Essentially, my goal is to enter my example texts as in the following, (where '^' indicates the cursor position after using the probably-nonexistent something to 'tab' over to the next alignment position -- newlines without '<CR>' are for clarity)

" stops on non-whitespace:
create table blah (
   id int primary key auto_increment comment 'autoid',<CR>
   info text      ^   ^              ^
                                     comment 'some text',<CR>
   another_value varchar(255)        ^
                                     comment 'another value'<CR>
);

" stops on: '[' and non-whitespace
"       or: non-whitespace or after '.'
filename is [table].[YYYYmmdd].[###].[type]<CR>
         ^  ^
                     |      ^
                                 |         ^
                                                    |    ^
                                                                      \-- bz2 or 
xz<CR>
             ^
                         |       ^
                                 |          ^
                                                    \-- per-day run 
identifier<CR>
             ^
                         |       ^
                                 \-- date files generated<CR>
             ^
                         \-- replace underscores with hyphens<CR>

I think I'll likely roll my own tool for this. Something that will take a set of patterns, find the cursor positions on the previous line where they match, and allow traversal left or right, w/ or w/o insertion of spaces.

I'll report back when(/if) I get to this.

You might be able to bend AutoAlign to your purpose, too.

AutoAlign typically allows one to auto-align on =s as one types.

   a=1
   bbb=2
   z=4

becomes, as one types: (the following looks correct in monospaced fonts)

   a   = 1
   bbb = 2
   z   = 4

You can get AutoAlign from:

http://vim.sourceforge.net/scripts/script.php?script_id=884
 -or-
http://mysite.verizon.net/astronaut/vim/index.html#AUTOALIGN (most up-to-date)

Its a ftplugin, so it does auto-align in a language-oriented way. In particular, each filetype's AutoAlign.vim specifies

b:autoalign_reqdpat  (a pattern to recognize what is to be aligned)
b:autoalign_notpat   (a pattern that signifies a line not to be aligned)
b:autoalign_trigger  (a character that triggers the autoalign plugin)

Regards,
Chip Campbell

--
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

Reply via email to