Version 10 (modified by retracile, 10 years ago) (diff) |
---|
Vim breakindent patch
So I wanted Vim to visually wrap long lines, but take the indentation of the line into account when it does so. Vim could not do that when I went looking in 2009, but as of June 25, 2014, Bram merged the breakindent feature.
To get this behaviour, use set breakindent. You can combine it with set showbreak=.. or set showbreak=\ \ to provide a little bit of additional indent to the wrapped portion of the lines.
For example, this shows vim with set breakindent showbreak=.., set linebreak, set foldmethod=indent foldcolumn=4 and set shiftwidth=4 tabstop=4 softtabstop=4 expandtab options with a visual highlight that wraps across lines:
Back in 2007 when Vim couldn't do this, Václav Šmilauer posted a patch for Vim to add this feature. I kept updating that patch as Fedora released updates for Vim until 2014 when Bram merged the feature. The patches below are those updates, but they are now only of historical interest.
for Vim 7.3.944 (from Fedora 17)
for Vim 7.3.682 (from Fedora 17)
for Fedora 14, 7.3.056-1.fc14
These older versions of the patch interact poorly with set linebreak:
Attachments (1)
-
vim-snapshot-1.png
(30.6 KB) -
added by retracile 14 years ago.
screenshot with indent folding, breakindent, and linebreak
Download all attachments as: .zip