Re: How to insert a newline in a map value?
- Tim Chase wrote:
>>> imap <F4> <BLOCKQUOTE>\r<PRE><CODE>Vim is supposed to set 'nocompatible' if it finds a user vimrc
>>> imap <F4> <BLOCKQUOTE><CR><PRE><CODE>
>>> doesn't insert a newline at the \r or <CR> position.
>> Try this:
>> imap <F4> <BLOCKQUOTE>^V<ENTER><PRE><CODE>
>> Where ^V is a literal, typed control-v and <ENTER> is you hitting the
>> enter key. For more details see :help c_CTRL-V for details on why
>> this works.
> Strange that the Hiroshi's second one didn't work for him, as it worked
> just fine for me. Chris's use of ^V^M worked fine for me as well.
> The only thing I found that triggered a strange behavior was having the
> 'nocp' option set. With a vimrc file *only* containing the above <CR>
> mapping, I simply got the text "<F4>" in my document in insert mode.
> however, if my vimrc file consisted of these *two* lines
> set nocp
> imap <F4> <BLOCKQUOTE><CR><PRE><CODE>
> then it worked just fine. That's in Win32 gvim v6.1, but YMMV.
(~/.vimrc, ~/_vimrc, or [on Windows] $VIM/_vimrc but not $VIM/vimrc).
The behaviour of <> in mappings (and menus) depends on the presence or
absence of the < flag in 'cpoptions' (q.v.).
BTW, Tim, don't you think it might be time to upgrade? 6.2 has come and
gone with hundreds of bug fixes, and 6.3.090 is available since today.
Just my 0,02€ of course.