Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

Try this:

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


: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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .