Word Wrap in Vim (preserving indentation)
Posted
by sixtyfootersdude
on Stack Overflow
See other posts from Stack Overflow
or by sixtyfootersdude
Published on 2010-05-13T15:45:40Z
Indexed on
2010/05/13
23:44 UTC
Read the original article
Hit count: 157
I was just looking at this post which describes how to wrap entire words in vim. The accepted solution was this:
:set formatoptions=l
:set lbr
Which takes this text (tabs are shown as \t):
*Inside of window *Outside of window
|---------------------------------------|
|\t\tthis is a like of text that will wr|ap here
|\t\tcan you see the wrap |
| |
|---------------------------------------|
This accomplishes a behavior like this (tabs are shown as \t):
*Inside of window *Outside of window
|---------------------------------------|
|\t\tthis is a like of text that will |
|wrap here |
|\t\tcan you see the wrap |
| |
|---------------------------------------|
I would however like to redefine this function. I would like the wrapped line to have the same number of tabs in front of it that the line above has plus one. Ie:
*Inside of window *Outside of window
|---------------------------------------|
|\t\tthis is a like of text that will |
|\t\t\twrap here |
|\t\tcan you see the wrap |
| |
|---------------------------------------|
Any ideas?
© Stack Overflow or respective owner