I have wrapping turned on in vim, but is it possible to disable it for certain regions in the file I'm editing? To be specific, I'm editing LaTeX files, I would like the contents of some environments (tabular for example) not to be wrapped, since this would make the table contents much easier to read.

A solution based on automatically detecting such environments based on their opening/closing tags would be the best of course, but I'm not against a solution needing some explicit tags or commands in a comment in the file.

  • 1
    If you can't find any other solution, map :set wrap and :set nowrap to alt F-keys so you can quickly toggle. – goldilocks Mar 26 '14 at 13:27

If you can identify the table regions through a particular syntax group, my OnSyntaxChange plugin can help.

Alternatively, you can transparently edit the table parts in a separate buffer with the NrrwRgn - A Narrow Region Plugin similar to Emacs plugin.

Or, as the 'wrap' option is window-local, just open a :split window of the same buffer with an inverted option value there.

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.