I'm now setting up Vim for use with LaTeX. This is about setting up the indentation. In the picture below, there are many things that need tweaking. Everything between \vskip .5cm and \vskip 1in is just one hard line (as opposed to 3 soft-wrapped lines). enter image description here

  1. I want the soft-wrapped lines to follow the original indentation, in this case, the indentation of Once upon a time...
  2. At the right side of the screenshot, computer and called are badly broken. If they don't fit the line width, they might as well move to the next (soft) line altogether. UPDATE: Now I have this fixed with set linebreak.

Current settings
My pertinent settings in ~/.vim/ftplugin/tex_latexSuite.vim are

set ts=4
set sw=4
set autoindent
set linebreak

Solutions I've tried
Upon reading :help autoindent, I find that I can use gqgq to format the current hard line, like so: enter image description here

The single hard line now becomes 4 hard lines. However, that's not what I want. I believe that what I'm looking for is soft wrapping with proper indentation. Can I do that in Vim? How?

  • This was discussed a while ago on StackOverflow without finding a solution. I don't know whether recent updates to vim have changed this.
    – mas
    Aug 28, 2011 at 8:08
  • @mas, it's actually more than a while already, ~2009, :(
    – Kit
    Aug 28, 2011 at 8:22
  • See the patch at retracile.net/wiki/VimBreakIndent
    – Aditya
    Sep 12, 2011 at 3:50

3 Answers 3


As @Aditya wrote, there is a patch of mine at https://retracile.net/wiki/VimBreakIndent . It looks like this (left without, right with): screenshot

  • 1
    I have just found this and applied it successfully to MacVim. Eudoxos, you deserve a gold medal for this!
    – Daniel
    Dec 2, 2011 at 14:58
  • Thanks, @Daniel, though I would be even happier if it were integrated upstream. To say the least, they are reluctant and I gave up persuading them (I mean, him...) :-|
    – eudoxos
    Dec 2, 2011 at 23:16
  • Thats a pity, really. Given that it has been on the TODO list for ... how many years? I guess its been since 2004, at least.
    – Daniel
    Dec 3, 2011 at 9:52

The breakintent feature has been finally merged into vim, see https://retracile.net/wiki/VimBreakIndent.

You can now simply use

set breakindent

or combine it with other methods like

set showbreak=.. 

to get an additional indent.

  • 1
    This is a link-only answer.
    – user31729
    Aug 17, 2014 at 8:32

An update on this issue:

(citing this page: https://retracile.net/wiki/VimBreakIndent)

The official patch to this wrapping problem had been released. I put my distribution of Vim on line through Github: https://github.com/llinfeng/Vim-Win

In the latest commit (as of 2014-07-24), I documented how I managed to "sudo-patch" my Vim. The distribution online is working fine for me.

Happy Vimming!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.