Sunday, February 14, 2016

Re: problem with a map

On 14/02/2016 11:25 a.m., Sam Burk wrote:
> On Feb 14, Cesar Romani wrote:
>> I'm using vim 7.4.1317 on Windows 7.
>>
>> I often use the following command:
>> :g/^\d\+\.$/normal O jVjjJ
>>
>> and I'd like to use it in a map. How can do it?
>>
>> I tried with:
>> map ,p :g/^\d\+\.$/normal O jVjjJ
>>
>> but it doesn't work.
>>
>> I also noted that
>> exe "g/^\\d\\+\\.$/normal O\<Esc>jVjjJ"
>> works, but not when it is inside a map, as in:
>> map ,p exe "g/^\\d\\+\\.$/normal O\<Esc>jVjjJ"
>
> I only see a couple things wrong with your mapping.
>
> 1. I'm assuming you want an escape ( ) after the O.
> 2. You need to put <cr> at the end of your mapping unless you want to
> press enter every time you fire the mapping.
>
> That should get it working.

I already put an escape after the O, but it didn't show up in the email
message. Using <Escape> and <cr> it'd be
map ,p :g/^\d\+\.$/normal O<Escape>jVjjJ<cr>

It works, but only for the last line, not for all lines which contain
the pattern ^\d\+\.$
That's strange!

--
Cesar

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment