Macro / Function to draw a set of characters below the line above

13 views
Skip to first unread message

Keith Christian

unread,
Nov 11, 2012, 5:21:24 PM11/11/12
to vim...@googlegroups.com
Hello, Vim Users,

I'm writing a fair amount of documentation in Asciidoc these days.
When entering a major section's title, a row of equal signs, tlides,
dashes, or carets equal to the length of the line of text above (or
within two or three of the exact length) must be entered so that the
line is recognized as a section title.


Example:


This is a section title, and the row of equal signs below it must be
of the same length as this text
====================================================================================================


I'm looking for a function to do this to reduce the tedium. Would
like to bind this new function to a key so it's quick to execute, say,
Ctrl-F1 or some such.

Ideas appreciated.

Keith

Dominique Pellé

unread,
Nov 11, 2012, 5:25:05 PM11/11/12
to vim...@googlegroups.com
Hi Keith

See this tip:

http://vim.wikia.com/wiki/VimTip750

-- Dominique

Chris Lott

unread,
Nov 11, 2012, 7:54:51 PM11/11/12
to vim...@googlegroups.com
On Sun, Nov 11, 2012 at 1:21 PM, Keith Christian
<keith1c...@gmail.com> wrote:
> Example:
>
>
> This is a section title, and the row of equal signs below it must be
> of the same length as this text
> ====================================================================================================
>
>
> I'm looking for a function to do this to reduce the tedium. Would
> like to bind this new function to a key so it's quick to execute, say,
> Ctrl-F1 or some such.

You could also check out SnipMate -- there are snippets for Markdown
and Pandoc that do exactly this for top level (=) and second level (-)
"headers."

c
--
Chris Lott <ch...@chrislott.org>

Keith Christian

unread,
Nov 12, 2012, 10:08:49 AM11/12/12
to vim...@googlegroups.com
Ok Dominique, Chris:

Thanks, I think those references will do the job.

Appreciate the feedback.

Keith
Reply all
Reply to author
Forward
0 new messages