If there are lines in a file that are too long to be displayed on the screen, we can use the
command
:set wrap
Now long lines are split into chunks visible on the screen. Usually the code is structured and indenting is used for readability, sometimes it’s part of the syntax (Python).
If a line is wrapped into two (or more) lines, only the first line has right indenting
and the other lines begin at the beginning of a row.
If you use the command
:set nowrap
the line is visible only partially.
Could this behavior be changed via vimscript so that all of the wrapped lines have the same indent level?
You are right, unfortunately there is no such feature in Vim 7.3 yet, if you fancy a patch you can find a link to it below.
However there are 2 things that might help you improve readability for long code lines:
Line numbering is used by most people editing and debugging code. A long line will have no numbers on it’s wrappings clearly disambiguating code’s indentation from wrapped line.
A fixed marker to display on all wrappings (i.e.
">\ "). It only supports a static marker string, not based on the line’s indentation.You can combine these options and if you want the marker to be displayed in-line with line numbers you can:
Patch: If you really need this feature you can try this patch:
the option is supposed to be:
It would be nice indeed if someone would pick it up in the source base.