Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Step 1 in vim:

:map o iinsert<CR>some<CR>lines<ESC>

In a normal setup such as debian, pressing o now will insert this as desired:

insert
some
lines

But in vim on cygwin, the <CR> does not parse correctly, so pressing o will insert this:

insert<CR>some<CR>lines<ESC>

How can I make this kind of mapping work correctly in cygwin?

(Note: the output of :verbose map is identical on debian and cygwin)

share|improve this question
    
might need a line feed also –  soandos Aug 26 '11 at 1:23
    
... it now appears to be solved by running :se cpoptions=aABceFs first. Does anyone know why, or what this is all about? –  krubo Aug 26 '11 at 1:31
add comment

1 Answer 1

You probably need to either ":set nocompatible" first, or create a ~/.vimrc (having a vimrc automatically does the equivalent of :set nocompatible).

The reason you want to be in nocompatible mode is because that tells Vim to enable large amounts of its enhanced feature set which is not strictly compatible with the original vi's behavior.

This also answers your question about ":se cpoptions=aABceFs"—you are removing the '<' character from that option, which, when present, disables the recognition of <...> codes in mappings, etc.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.