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.

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
add comment

2 Answers 2

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
1  
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
add comment

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.

Or,

:set textwidth=78
gggqG

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
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.