MAG
MAG

Reputation: 3075

Using vim for indentation in C++

I use vim to write code (please , lets not discuss why) . We indent our code using a common vimrc

syntax on        "Turn on syntax highlighting
set laststatus=2 "Always show status line

set tabstop=4    "Number of spaces a TAB in the text stands for

...<more code>...

""Converting tabs to spaces
set expandtab
set tags=./tags;/
map <C-\> :vsp <CR>:exec("tag ".expand("<cword>"))<CR>

This however is missing code to remove extra white space in between the 2 words and removing wrong spaces before comma etc .

Does anyone has any suggestion to remove those white spaces as well ?

Is there some standard that is followed which can help me as a guide to format c++ code ?

Upvotes: 0

Views: 521

Answers (1)

lcd047
lcd047

Reputation: 5861

Vim is the wrong tool for what you want, since it doesn't know, nor care, about C++ syntax. Try a source code beautifier instead, such as uncrustify or GNU indent.

Upvotes: 2

Related Questions