1

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

2 Answers 2

1

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.

2
  • That's just what I meant. Is there really no way to enable a behavior like that in VIM?
    – wowpatrick
    Dec 4, 2011 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, 2011 at 20:10
1

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.

1
  • +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, 2011 at 14:16

You must log in to answer this question.

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