[Tex/LaTex] Why does Vim force really long lines in text file

editorsvim

I am using Vim to edit my tex file and I am relatively new to LaTeX. One thing that I don't understand is why tex wants you to write incredibly long lines in your tex file? For instance, each line becomes a new paragraph so if you have along paragraph you can have a line in your text file that is miles long. Currently this is driving me crazy because if I press 'j' or 'k' to move up and down lines I move lines at a time instead of paragraphs at a time.

While messing with this I just feel like "This can't be what I'm supposed to be doing." Does anyone else use an editor like vi/vim to edit their tex files, and if so, how do you navigate? If you are editing your .tex file full screen (to get rid of distractions), how do you prevent full monitor word garbage due to incredibly long lines?

I really like the TeX philosophy of separating content from design, but I feel like I am going to make myself go cross-eyed editing these .tex files.

Best Answer

You can press return at the end, but in VIM you would typically "reformat" or "rewrap" a paragraph after and during writing. Typical commands to do so are:

gq (see :help gq)
gw (like gq but puts the cursor back where it started
:set textwidth = 70 

:set textwidth is something people use for automatic wrapping, and sometimes it appears in their vimrc or plugin. I personally don't like it, and find that just rewrapping lines is much faster.

Once you get used to wrapping it becomes second nature while writing. I find that restyling the tex code is another way to find mistakes in the content or structure that I would not otherwise see.

Related Question