Align code in VS 2010 - c++

Is there a way to align the written C++ code in VS 2010? I want after selecting a block of code to apply a combination of button press and the code to be aligned as in Eclipse or Netbeans with Java.

Look at Edit -> Advanced -> Format Selection
The keyboard shortcut depends on your settings. It's Ctrl+K+F for me. (Under Options -> Environment -> Keyboard enter Edit.FormatSelection into the field labeled Show commands containing to add your own shortcut.)

for code block : ctrl +E,F (Edit -> Advanced -> Format Selections)
for document : ctrl +E,D (Edit -> Advanced -> Format Document)

Try using Ctrl+K+F on the selected text.

Is Ctrl + E, D what you're after?

Related

C++ Visual Studio - How to tab at end of line to add comment

This is a stupid and frustrating thing. Working with VS 2019 after a few years away, and I cannot remember the option to allow me to tab at the end of a line to add an end-of-line comment. The cursor just sits there when I hit tab at the end of
int frustrationLevel = 99;
I want to tab after the semicolon dagnabit!
int frustrationLevel = 99; // omg please help me!
I know this used to be possible.
TIA!
After comparing option after option with a previous version of VS where the tab worked as desired, I found an option that was set
Options -> Text Editor -> C/C++ -> Code Style -> Formatting -> General ::
Automatically indent when I type a tab.
Unchecking this option fixed my issue.

Visual Studio- Task List is empty

I don't know how it is happened, but suddenly my Task list is empty.
I checked Tools -> Options -> Text Editor -> C/C++ -> Formatting -> view,
but I did not find anything wrong.
You must enable following option:
Also only displays for current open document.

How to prevent VS code formatter inserting spaces in vectors

The Visual Studio 15 code formatter always inserts spaces in vector declarations
eg I get
vector< string > something;
instead of
vector<string> something;
Is there any way of preventing this?
In Visual Studio, click on Tools -> Options.
In the left panel, select Text Editor -> C/C++ -> Formatting -> Spacing.
You will see a tree of things in the right panel; one of the options will change the behavior you've described.

How do I turn off auto-complete for Code::Blocks

As I am typing in Code::Blocks, I would prefer to type code directly without having the editor insert closing parentheses and brackets.
I chose the disable code-completion in Settings > Editor > Code Completion, but this feature does not disable auto complete features with closing characters.
What is the right setting for turning off this feature in Code::Blocks?
(Be aware this could happen to you by the pronoun censors: https://www.theregister.co.uk/2019/10/08/stack_overflow_apology/)
"Settings -> Editor... -> General settings -> Indent options -> Brace completion"
I got it,How to disable the auto brace and etc.....Tools>Editor option>Completion....you will find two tabs under the main tab Code completion and Symbol completion....Disable both tick marks of it and free to write coding....
You have to go to:
"Settings -> Editor X -> General Settings -> Indent options -> Complete brackets"
And with that, it would have to work
Tool=>Editor Options=>Completion tab=>symbol completion
Unselect the ones that are not desirable

Aligning code/Code margin in Visual Studio

So when I used to program in java I did it in Eclipse. Whenever my code had all the same margin I just had to select everything and press Ctrl+i.
Now I use Visual Studio Professional for programming in C++
The question is simple enough: How to properly set a margin to the lines of code so that it all looks well and I can easily tell what code belongs inside what brackets.
Thank you beforehand, and I hope this question is not closed. I tried searching for an answer, but found none.
Select what needs formatting and CTRL+K followed by CTRL+F.
Found in the C++ Visual Studio 2010 Keybinding Poster:
Select the code you want to format then:
CTRL + K, F or
CTRL + E, F
Formats the current selection
according to the indentation and
code formatting settings specified on
the Formatting pane under Tools |
Options | Text Editor | C/C++.
You can always find out what the actual shortcut is and use it or customize it:
go to Tools -> Options.
expand Environment, select Keyboard
type 'Format' in the textbox labeled 'Show command containing:'
find the row that reads 'Edit.FormatDocument'
read the value in the 'Shortcuts for selected command:' dropdown
If you want to change it, use a new shortcut key in the 'Press shortcut keys' box, then click 'Assign'.