On Thu, 11 Mar 2010, Charles Campbell wrote:
> Benjamin R. Haskell wrote:
>
> > My other question about tab-delimited files reminded me to ask about this,
> > too. I frequently want to vertically align text.
> >
> > E.g. the 'comment's in the following:
> >
> > create table blah (
> > id int primary key auto_increment comment 'autoid',
> > info text comment 'some text',
> > another_value varchar(255) comment 'another value'
> > );
> >
> > Or the '|'s and '\'s in this:
> >
> > filename is [table].[YYYYmmdd].[###].[type]
> > | | | \-- bz2 or xz
> > | | \-- per-day run identifier
> > | \-- date files generated
> > \-- replace underscores with hyphens
> >
> > Is there a built-in command to roughly: "pad with spaces until the cursor is
> > below the next non-whitespace character on the previous line"? Or a plugin?
> > Or will I be writing some vimscript? :-)
> >
> >
>
> 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.
--
Best,
Ben
--
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