indenting multiple files (LaTex) with Vim
Background: I've decided to try Vim with latex-suite as my editor for a largish LaTeX project. As I've switched to Vim from different editor/IDE which didn't force autoindent (and I was sloppy with indenting manually), the current indentation of .tex files is quite mismatched and doesn't suit the style I want (which is set up by adding filetype plugin indent on
and automcd Filetype tex setlocal shiftwidth= etc
in my .vimrc; this works fine).
The project constitutes of multiple .tex files, structured like
main.tex
tex/
chapter1.tex
chapter2.tex
...
chapter10.tex
This stackexchange tells to indent a single source code file opened in vim easily with =, as in
gg=G
which works perfectly. Now, the question.
Is there a neat Vim (and/or bash/other if Vim can't handle this neatly, but preferrably Vim) solution which would enable me to do similar 'reindent' for all the .tex files at once (in other words, without typing gg=G
separately for each tex file where the indentation needs to be fixed?)
First, add all LaTeX files as arguments in Vim (the example assumes you're in the document's root):
:args *.tex **/*.tex
Then, you can apply the command to all arguments via :argdo
(and :normal
, since this is a normal-mode command); you probably want to persist the changes in the same go, too:
:argdo execute 'normal gg=G' | update
链接地址: http://www.djcxy.com/p/49538.html
上一篇: 将文件从其余客户端上传到其余服务器
下一篇: 用Vim缩进多个文件(LaTex)