Re-indent multiple files (LaTex) with Vim

Reference Information. I decided to try Vim with a latex package as my editor for a rather large LaTeX project. Since I switched to Vim from another editor / IDE, that did not make autoindent (and I was sloppy with hand-indented), the current indent .tex files rather inconsistent and does not correspond to the style that I want (which is added filetype plugin indent onand automcd Filetype tex setlocal shiftwidth= etcin my .vimrc; this works great).

A project consists of several .tex files structured as

main.tex
tex/
   chapter1.tex
   chapter2.tex
   ...
   chapter10.tex

This stackexchange file reports the fingerprint of a single source code file opened in vim easily with =, as in

gg=G

which works great. Now the question.

Vim (/ bash/other, Vim , Vim), "reindent" .tex ( , gg=G tex, ?)

+4
1

LaTeX Vim ( , ):

:args *.tex **/*.tex

:argdo ( :normal, ); , , :

:argdo execute 'normal gg=G' | update
+5
source

Source: https://habr.com/ru/post/1528950/


All Articles