Yakov Lerner wrote:
> On 4/4/07, ben lieb <[EMAIL PROTECTED]> wrote:
>> The following map is used to do add span tags to highlighted text
>> in-line. My problem is that it only works sometimes, and I don't know
>> why.
>>
>> :map ,bb c<CR><CR><ESC>kpI<span><ESC>A</span><ESC>kJJ
>>
>> The map works by cutting the highlighted text, putting it on its own
>> line, adding the tag to the front and the end of the line, and then
>> joining the lines.
>>
>> Any thoughts on why this only works sometimes? I can't isolate what
>> conditions bring it about.
>
> Can be several things.
>
> 1. To cancel possible influence of keyboard timeouts, map
> the same rhs to the single-key combination -- like <F10>.
> When ,bb dopesn't work, try <f10>. If <f10> works, it's related to
> timeouts.
>
> 2. Change to vnoremap instead of map. This cancels possibble
> effects or remapping of some chars in the rhs. I think you want to use
> it in the visual mode, right ? Then use vnoremap.
>
> 3. When it doesn';t work, what exactly happens ? Is it totally ignored,
> or works half-way ?
>
> 4. When it doesn't work, do ':map ,bb' to check whether it's still
> defined and is rhs correct.
>
> Yakov
>
>
>
When it doesn't work it, it re-highlights the first half of the
sentence, and then does nothing.

The reason I 'enter' twice, and then join the lines twice, is to be able
to get the text I want surrounded on a line by itself, then at the tags
the the front and back, and then join the lines together again.

The map is in my vimrc file. An odd thing is that when it doesn't work,
I can re-enter it on the command line, and then it will work.

Reply via email to