Posts in category vim

Better line wrapping in Vim, FINAL iteration

Back in 2009, I went looking for a way to make Vim's line wrapping be indentation aware. Stock Vim did not support such an option, but I found a patch by Vaclav Smilauer from 2007 which I was able to update and over the years, keep it updated.

Then on June 25, 2014, Bram accepted the breakindent work into Vim as patch 7.4.338. Many thanks to Christian Brabandt for getting the breakindent patch over the finish line. There were a number of followup patches for breakindent, including 7.4.345, 7.4.346, maybe 7.4.352, maybe 7.4.353 and 7.4.354.

Fedora has not yet pulled those changes into Fedora 20 or Fedora 21, but they'll come in time. update: Fedora 20 updated to 7.4.417 near the end of August.

Better line wrapping in Vim, 8th iteration

Here is the breakindent patch updated for Vim 7.4.16 from Fedora 19: vim-7.4.16-fc19-breakindent.patch

Update: This also applies cleanly to Fedora 19's vim-7.4.027-2.

Better line wrapping in Vim, 7th iteration

Here is the breakindent patch updated for Vim 7.3.944 from Fedora 17: vim-7.3.944-fc17-breakindent.patch

Better line wrapping in Vim, 6th iteration

Here is the breakindent patch updated for Vim 7.3.682 from Fedora 17: vim-7.3.682-breakindent.patch

Better line wrapping in Vim, 5th iteration

While the 4th iteration of the breakindent patch is still applicable for Fedora 15's version of Vim, that wasn't good enough for Taylor Hedberg. Apparently he lives a bit closer to the tip of Vim development, where that version of the patch causes a compile failure. Thanks to his efforts, I present the 5th iteration of the breakindent patch. This patch is against vim 7.3.285 from the Mercurial repo.

Thank you, Taylor!

Better line wrapping in Vim, 4th iteration

Earlier this month, an email appeared in my inbox from none other than Václav Šmilauer, the original author of the Vim breakindent patch. He had attached an improved breakindent patch for Vim 7.3 which addressed the interactions between breakindent and linebreak. It applies cleanly to vim 7.3.056-1.fc14 in Fedora14.

Thank you, Václav!

Václav also expressed a desire for the patch to make it upstream, so I think that's the next goal for this.

Better line wrapping in Vim, 3rd iteration

Fedora 13 updated vim recently, so I updated the breakindent patch, available here. I have also created a VimBreakIndent wiki page for this project to keep the updates consolidated.

Better line wrapping in Vim, 2nd iteration

Fedora updated the version of Vim in Fedora 11, and I had to update the better line wrapping patch to work with the new 7.2.315-1.fc11. The updated patch is here.

Better line wrapping in Vim

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 Vaclav Smilauer posted a patch for Vim to add that feature. I updated the patch to apply to the current version of Vim in Fedora 11, 7.2.148-1.fc11. To get this behaviour, rebuild vim with this patch, then set breakindent. It isn't bug-free; it appears to interact badly with set linebreak. But 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.