On 04/20/2011 04:12 PM, Adam Monsen wrote:
Anyone handy with editing help files? I'm wondering how to align a
title and tag, ala

SPONSOR VIM DEVELOPMENT                                         *sponsor*

where the title is left-aligned and the tag right-aligned, on the
same line.

While I don't know what other folks use, and I don't do it myself, this one-liner can be made into a :command! or mapped to make it pretty easy/straight-forward:

:%s/^\(.*\)\>\s*\(\*[^*]*\*\)$/\=printf('%s%*s', submatch(1), (&tw?&tw:80)-(strlen(submatch(1))), submatch(2))


It should be smart enough to adjust to your 'textwidth' setting, defaulting to 80 if it's unset (=0)

You may also have to tweak the search regexp so that the right things get captured, but it should handle most generic cases.

-tim




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