tabular icon indicating copy to clipboard operation
tabular copied to clipboard

On nearest tab border aligning

Open whalebot-helmsman opened this issue 11 years ago • 3 comments

It will be great if Tabular can align not only on fixed space count (after/before) but align on tab borders some kind of :Tab /=/ltrt

Before:

abc=cde abcdf=asd

Now:

abc = cde abcdf = asd

It will be great: abc = cde abcdf = asd

whalebot-helmsman avatar Aug 16 '12 11:08 whalebot-helmsman

Check out Markdown and use source blocks. Without them it's hard to tell quite what you mean to show with the alignment. I think this is what you meant your samples to look like. I'm not quite sure what feature you're requesting though. Did you want to be able to align along the sides of delimiters? That can be achieved currently with some crafty regexes, using \ze for example. I believe there are some examples in the Tabular documentation. If I understood your examples correctly, it looks like you don't want your delimiters aligned, which seems to go against the purpose of Tabular.

First:

abc=cde
abcdf=asd

Second:

abc    = cde
abcdf = asd

Third:

abc      =   cde
abcdf   =   asd

ajzafar avatar Aug 16 '12 18:08 ajzafar

Sorry for this, I align use non-mono type

Start from this:

abc = cde
abcd = cde

Now:

abc  = cde
abcd = cde

Delimiter(=) is placed 1-space after longest field

It would be great:

abc     =   cde
abcd    =   cde

Here delimiter is placed in next tab position(4x, if tab size equal 4 spaces) after longest field .

whalebot-helmsman avatar Aug 16 '12 19:08 whalebot-helmsman

+1. Before reading this issue I even came up with the same shortcut t instead of 0,1,2 ... for the padding specifier. In case, the idea wasn't understood right, let me visualize it differently.

Say, you have:

set tabstop = 4
set softtabstop = 4
set shiftwidth = 4
set expandtab

So the tabstops are (indicated by +):

+---+---+---+---+
abc = xyz
abcde = xyz
a = x

If you do :Tab /= you get

+---+---+---+---+
abc   = xyz
abcde = xyz
a     = x

In order to align the = to the next tabstop, we could have a new format specifier: :Tab /=/lt. t stands for tab.

+---+---+---+---+
abc     = xyz
abcde   = xyz
a       = x

mikehaertl avatar Aug 11 '13 14:08 mikehaertl