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.

I am trying to figure out how to map the keys <shift><cr> to ignore smart indention for one carriage return in vim.

Is there an easy way to do this?

share|improve this question
    
Can you tell us a bit more about, the situation maybe there is another way, and what do you mean by "the keys + to ignore …", that + should act as toggle key or something else. –  epsilonhalbe Jun 28 '12 at 17:09
    
that should make more sense. sorry i'm veryyyyyy new to vim –  Derek Adair Jun 28 '12 at 17:51

2 Answers 2

Try this:

:imap <S-CR> <CR>0<C-D>

See

:help i_0_CTRL-D

That works when Vim is running in GUI mode. Whether it works in terminal mode depends on whether your terminal encodes Shift-Enter differently from Enter.

share|improve this answer

Mapping pastetoggle to <S-Enter> will probably do what you want. The paste option turns off several effect, autoindent just being one of them.

But if it's just autoindent you want, use this:

map <S-Enter> :set autoindent!<CR>

share|improve this answer
    
I'm sorry to say, but this is poorly worded (especially the first paragraph) and doesn't quite do what the OP wanted. –  Heptite Jun 28 '12 at 17:58
    
@Heptite I'm not convinced that the OP is properly expressing exactly what they want. So I gave a couple of options with links to more information so the OP could educate themselves. As for being poorly worded, it's clear to me, but if it's unclear to you, why not suggest an edit? –  embedded.kyle Jun 28 '12 at 18:36

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.