Sunday, January 29, 2012

Re: [vim] Problem with `inoremap jj '

On Mon, Jan 30, 2012 at 15:28, Jane Smith <phunky83@gmail.com> wrote:
On 30 Jan 2012, at 07:18, Benjamin R. Haskell wrote:

> On Sun, 29 Jan 2012, Clark J. Wang wrote:
>
>> On Monday, January 30, 2012 2:24:55 PM UTC+8, Markus Osterhoff wrote:
>>>
>>> * Clark J. Wang <dear...@gmail.com> [120130 07:01]:
>>>> So I wonder if the `jj' mapping can be ignored when doing copy-n-paste and only work when I'm typing from a keyboard.
>>> :set paste
>>> do your paste
>>> :set nopaste

I am not sure if this is possible or the syntax you would use but could you use a mapping to the effect of:

map <c-v>  set paste<c-v>set nopaste

You need something to stop the infinite loop and you may want to restrict it to insert mode. I think this makes the above mapping into something like:

inoremap <c-v>  set paste<c-v>set nopaste

This should not work I think since vim's <c-v> is not the same as the OS (e.g. Windows)'s <c-v>.

But I am not sure so please check before you use. You also need to be in command mode for the 'set' 's. This might be possible using something like 'normal:' so again if someone better at these things than me could refine or reject this then that would be great.

Good Luck

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

No comments:

Post a Comment