I guess this was asked before, but I could not find any similar question.
When writing part of the scope operator in C++, Vim guesses that it's going to be a label (on the first :
) and then indents it automatically, which is pretty annoying. Example:
#1 - initial typing
{
std
#2 - added :
{
std:
#3 - added :
{
std::
Of course, it's correct at the end, but is there any way to disable the automatic indent for labels? I rarely use them, and it wouldn't be a great deal to indent manually in those cases.
1 The indent Program. The indent program can be used to make code easier to read. It can also convert from one style of writing C to another. indent understands a substantial amount about the syntax of C, but it also attempts to cope with incomplete and misformed syntax.
Liberal blank lines and comments are the approach I've typically taken regarding non-indented #ifdef checks. All that said, there's no rule that you can't indent preprocessor checks if it makes the code more readable.
Step 1 Boot to system repair disc. After changing boot sequence in bios and restart computer, after which computer will boot from the system repair disc. Step 2 Click Command Prompt from System Recovery Options. Then type command format c: /fs:ntfs and press Enter key.
Software programs may use different amounts of indentation. However, a good rule of thumb is to use one space for each tab character in a line of code. Most computer programs use eight spaces to indent a line.
Just tell vim not to de-indent labels with:
:set cinoptions+=L0
For reference, if by "visibility" modifiers you mean access specifiers, these can be set to not indent with:
:set cinoptions+=g0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With