Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
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 '11 at 8:08
    
@mas, it's actually more than a while already, ~2009, :( –  Kit Aug 28 '11 at 8:22
    
See the patch at retracile.net/wiki/VimBreakIndent –  Aditya Sep 12 '11 at 3:50

2 Answers 2

up vote 5 down vote accepted

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

share|improve this answer
    
I have just found this and applied it successfully to MacVim. Eudoxos, you deserve a gold medal for this! –  Daniel Dec 2 '11 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 '11 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 '11 at 9:52

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!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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