= 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. Apparently, Vim can't do that, but back in 2007 Václav Šmilauer [http://www.mail-archive.com/vim-dev@vim.org/msg04076.html posted a patch] for Vim to add that feature. I have been updating that patch as Fedora releases updates for Vim. Václav has also updated it. To get this behaviour, rebuild vim with this patch, then `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: [[Image(vim-snapshot-1.png)]] [attachment:blog:2013/06/01/20.00:vim-7.3.944-fc17-breakindent.patch for Vim 7.3.944 (from Fedora 17)] [attachment:blog:2012/12/21/17.30:vim-7.3.682-breakindent.patch for Vim 7.3.682 (from Fedora 17)] [attachment:blog:2011/08/23/21.30:vim-7.3.285-breakindent.patch for Vim 7.3.285 (from Hg)] [attachment:blog:2011/02/19/09.30:breakindent-20101112-vim7.3.diff for Fedora 14, 7.3.056-1.fc14] These older versions of the patch interact poorly with `set linebreak`: [attachment:blog:2010/11/22/23.00:vim-7.3-breakindent.patch Fedora 13, 7.3.055-1.fc13] [attachment:blog:2009/12/22/16.00:vim-7.2-breakindent.patch Fedora 11, 7.2.315-1.fc11] [attachment:blog:2009/11/20/12.00:vim-7.2-breakindent.patch Fedora 11, 7.2.148-1.fc11]