I have a nice cindent configuration for my coding style, but the licence header of my file is reindented not correctly if i reindent all the file in vim.
the licence header :
/* =========================================================================
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.
========================================================================= */
my .vimrc ( relevant section ):
: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
Hoped results : no change in licence header indentation
Seen Results :
/* =========================================================================
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.
========================================================================= */
I have found a work around. I simply map the following command in my .vimrc :
map <F12> gg=G\|:3,12>\|:10,12> <Enter> <Enter>
It map the F12 key to :
So it is very specific to my header and will not work in another project. All my vimrc is specific for this project anyway.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.