help with a key mapping

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

help with a key mapping

John Calixto
Hey folks,

I'm having trouble with the following key mapping:

nmap <F1> yy p :s/./=/g<CR> /`<CR>

It basically just underlines a line with '='.  It works most of the
time...  However, it does not seem to work for a one-line document.

Here are my steps to reproduce this problem:

1) :enew
2) :nmap <F1> yy p :s/./=/g<CR> /`<CR>
3) i
4) My Document Title
5) <esc>
6) <F1>

You'll notice that it looks like nothing happens.  However, if you just
insert a line above or below the text you want underline (in this case
"My Document Title"), it works!  Also, I tried the sequence of commands
outside of a key-mapping and they work as expected.

Basically, what I'm trying to achieve is to "underline" the text in the
current line.

Any suggestions?

Thanks,

John

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 
Reply | Threaded
Open this post in threaded view
|

Re: help with a key mapping

John Calixto
OK list,

Thanks to somebody out there that answered me directly, I have the
solution (and a better one at that!) to my problem:

nmap <F1> yypVr=

John

--- John Calixto <[hidden email]> wrote:

> Hey folks,
>
> I'm having trouble with the following key mapping:
>
> nmap <F1> yy p :s/./=/g<CR> /`<CR>
>
> It basically just underlines a line with '='.  It works most of the
> time...  However, it does not seem to work for a one-line document.
>
> Here are my steps to reproduce this problem:
>
> 1) :enew
> 2) :nmap <F1> yy p :s/./=/g<CR> /`<CR>
> 3) i
> 4) My Document Title
> 5) <esc>
> 6) <F1>
>
> You'll notice that it looks like nothing happens.  However, if you
> just
> insert a line above or below the text you want underline (in this
> case
> "My Document Title"), it works!  Also, I tried the sequence of
> commands
> outside of a key-mapping and they work as expected.
>
> Basically, what I'm trying to achieve is to "underline" the text in
> the
> current line.
>
> Any suggestions?
>
> Thanks,
>
> John
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com 
>



               
__________________________________
Yahoo! Mail for Mobile
Take Yahoo! Mail with you! Check email on your mobile phone.
http://mobile.yahoo.com/learn/mail