On Sun, 29 Jan 2012, Clark J. Wang wrote:

As recommended by other people I have 'inoremap jj <ESC>' defined in my vimrc and it works well for most of the time.

I would recommend something other than mapping jj to Esc (e.g. external to Vim, map CapsLock to Esc), but to each his own.


A few days ago when I copy-n-paste a lot of text into vim, the result was always wrong. It took me quite a while before I figured out that there was a substring "jj" included in the text to be pasted. For now I often :set paste before copying large text to avoid unexpected behavior.

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.

Not in the general case, no. Vim running under a terminal doesn't necessarily have a way to detect that you're copy-pasting (rather than typing).

One thing that makes this easier is the 'pastetoggle' option (short= 'pt'). It allows you to assign a key to put you in 'paste' mode (where lots of options are turned off).

See:

:help 'paste'
:help 'pastetoggle'

--
Best,
Ben

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

Reply via email to