我的编码样式有一个很好的cindent配置,但如果我重新加载vim中的所有文件,我的文件的许可标题将无法正确重新标记。
许可证标题:
/* =========================================================================
Program: Visualization Toolkit
Module: vtkPeriodicArray.txx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
========================================================================= */
我的.vimrc(相关部分):
:set tabstop=2 "Number of spaces a TAB in the text stands for
:set shiftwidth=2 "Number of spaces used for each step of (auto)indent
:set expandtab
:set cindent
:set cinoptions={1s,t0,f0s,g0,i0,(0
希望结果:许可证标题缩进没有变化
看到结果:
/* =========================================================================
Program: Visualization Toolkit
Module: vtkPeriodicArray.txx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
========================================================================= */
答案 0 :(得分:0)
我找到了一个解决方法。我只是在我的.vimrc中映射以下命令:
map <F12> gg=G\|:3,12>\|:10,12> <Enter> <Enter>
它将F12键映射到:
因此它对我的标题非常具体,并且不适用于另一个项目。 无论如何,我所有的vimrc都是专门用于这个项目的。