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

Is there an option in VIM to auto-intend (like in Espresso) lines which are too long to be displayed in the current window so that they get an automatic line break?

This is how it looks like in Espresso:

Espresso auto-indent

share|improve this question
up vote 1 down vote accepted

You want your wrapped lines to not go completely to the left but instead respect indentation, right?

I don't think there is a way to do that. Sorry.

share|improve this answer
That's just what I meant. Is there really no way to enable a behavior like that in VIM? – wowpatrick Dec 4 '11 at 13:42
I'm using Vim fulltime since 1 year only. There are people around here with a lot more experience than me so don't consider my "no" as definitive. However I don't see anything in the docs that would help you do that. Beside actually formating your code in an old-school but sane way: 80 columns max. – romainl Dec 4 '11 at 20:10
Thanks! Then I guess I'll just have to live with that! – wowpatrick Dec 5 '11 at 14:17

In Normal mode, type

:set wrap

so that long lines are wrapped. This doesn't add a '\n' newline, or any indent, it just moves it to a new screen line.


:set textwidth=78

to reformat an entire document to fit within a certain line width. (It does this automatically for new lines typed, and you can also use gqap to format a single paragraph.

share|improve this answer
+1 Because it is a really good tip for someone who may come to this question and looking just for this command. But it's not what I meant. – wowpatrick Dec 5 '11 at 14:16

You must log in to answer this question.

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