我发现当注释中存在“{”时,vim没有正确缩进/正确重新格式化我的cpp文件。喜欢
int main(){
cout<<"Hello World"<<endl;
if(1){
if(1){
//if(){
cout<<"Hello World"<<endl;
}
}
// if you insert a line from here, it will be indented here
}
int haha(){
}
当我gg = G时,我得到了
int main(){
cout<<"Hello World"<<endl;
if(1){
if(1){
//if(){
cout<<"Hello World"<<endl;
double a=1.5;
cerr<<" "<<fabs(a)<<endl;
}
}
// if you insert a line from here, it will be indented here
}
int haha(){
}
如果我删除了 /如果(){ 它会很好。
我正在使用以下.vimrc
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" start of my plugins
Plugin 'scrooloose/NERDCommenter'
Plugin 'Tabular'
Plugin 'vim-scripts/matchit.zip'
Plugin 'vim-scripts/restore_view.vim'
"Plugin 'WolfgangMehner/vim-plugins'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to au
to-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
set wildmenu
set showcmd
" Use case insensitive search, except when using capital letters
set ignorecase
set smartcase
set laststatus=2
set vb
"set nostartofline
set autoindent
set showmatch
set incsearch
syntax enable
syntax on
set hlsearch
set background=dark
let g:solarized_termcolors=256
colorscheme solarized
" foldings
"set foldmethod=syntax
"set foldlevel=1
"set foldnestmax=1
"autocmd BufWinLeave *.* mkview
"autocmd BufWinEnter *.* silent loadview
"set foldignore=
set expandtab
set softtabstop=4
set shiftwidth=4
let mapleader = ","
谢谢!