Thank you all for the help.
I'm using John Beckett's solution now. But I'm interested in learning
how to script Vim with Ruby, and I could use some help with this half-
complete solution.
I wrote the following Ruby Vim script:
function! Headline(char)
ruby << EOF
header_length = $curbuf[ $curbuf.line_number - 1 ].length
$curbuf.append $curbuf.line_number - 1, VIM::evaluate("a:char") *
header_length
EOF
endfunction
:call Headline('-')
will underline the current line with dash characters.
My question is, what's the easiest way to map this function -- which
takes a parameter -- to a key or key sequence?
Many thanks.
On Oct 25, 6:56 pm, "John Beckett" <[EMAIL PROTECTED]> wrote:
> Daniel Choi wrote:
> > I use Markdown for a lot of things, and it would be
> > convenient to be able to type things like this:
>
> > Header
> > ======
>
> That was discussed here a while ago and I think it was Andy who came up with:
>
> nnoremap <F5> yyp<c-v>$r=
>
> The results of the discussion were put in a
> tip:http://vim.wikia.com/wiki/Underline_using_dashes_automatically
>
> There was a reason for preferring <c-v> rather than v. Something to do with
> handling
> a line containing tabs?
>
> John
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---