vim autoindent не правильный, когда {внутри комментариев

Я обнаружил, что 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 lineset 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 = ","

Спасибо!

1

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector