Changing all my indents to 3 spaces. Code::Blocks - codeblocks

I have to submit an assignment and they want all the indents to be 3 spaces. I don't know how to change the settings of Astyle.dll so that it will change them 3 spaces instead of the default 4. Any ideas?
Also, Astyle seems to like having no indent between switch() and its cases, and I need there to be an indent there. Any ideas?

All of Astyle's settings are exposed in the Code::Blocks editor settings dialog. To access them, open the Settings menu, click Editor, and scroll through the sidebar to find the Default code entry.
I have to submit an assignment and they want all the indents to be 3 spaces.
Switch to the Indentation tab, found under Source Formatter in the sidebar, and change Indentation size (in spaces): to 3.
Also, Astyle seems to like to have no indent between switch() and its cases, and i need there to be an indent there.
If I understand what you need correctly, check the box that says Indent switches (keyword case:) and check the box that says Indent case: statement in switches (commands under case:).
You can change any other settings you want as well. When you're done, hit OK, then reformat your code and make sure the settings are set the way you want them.

Related

Sublime Text Double Click highlighting modification

Sublime Text does not register a sass variable ($variable) as a single item when highlighting, so when I double click on the name, it highlights the word, but does not include the $-symbol in the highlighting. Visual Studio, on the other hand, selects the $-symbol along with the variable name when double clicking on a variable to select it.
I write sass all day long, and it could make my life drastically easier if I could modify this small behavior. Is there a way to change this? I am sure it would be possible with a plugin, but I don't know if one exists or how to find it.
There is a setting named word_separators which provides a list of characters that are assumed to not be part of a word for the purposes of things like double click selection, navigating by words, and so on.
The default for that particular setting is set to the following, which includes the $ character that is causing you woes:
// Characters that are considered to separate words
"word_separators": "./\\()\"'-:,.;<>~!##$%^&*|+=[]{}`~?",
You can modify this setting to not include the $ character so that it's treated as a part of the identifier, which should do what you want.
In order to ensure that you don't experience any other knock-on effects of this, you may want to set the setting in the preferences specific to the Sass syntax.
To do that, you can select Preferences > Settings - Syntax Specific while you have a Sass file open and focused, and then copy the default setting into those settings and remove the $ character.

Sublime behavior like in VS

How to do same behaving in Sublime Text as in Visual Studio, when using column selection
for example if there is a line break in a text, the cursor in Sublime go to beginning of a line
And this is behavior in Visual Studio desired behavior
Thanks
While you may want this functionality for other reasons, it seems like you are using it to adjust the indentation of code blocks. Fortunately, there is a much easier way of doing this. Select the text for which you want to change the indentation, then press Ctrl] to increase the indentation (move block right), or Ctrl[ to decrease indentation (move block left). You can also increase indentation by selecting the desired lines and hitting Tab, and using ShiftTab to decrease it. The one place I can think of where multiple selections would come in handy is if, for some reason, you need to indent/dedent by fewer spaces than are in your tab stop. For example, if I have some code that's indented 3 spaces, and I want to change it to 4 (using the Indent Using Spaces setting in the View -> Indentation menu), I would use a multiple selection to put a cursor on each line, then use Space or Backspace to adjust spacing appropriately.

Is there a way to indent lines (not format them) in Visual Studio?

In Eclipse, there are two distinct features: one to format a selection, one to just indent the lines, see e.g. Difference between Ctrl+Shift+F and Ctrl+I in Eclipse. I found the format feature in Visual Studio but how can I actually just indent the lines? Is there some built-in command for that or possibly a 3rd party add-on?
Note: I have asked a couple of friend that use VS daily and they all tried to persuade me that I am looking for the format feature. No I'm not. I tried to live with it for a while and it is just a different feature. I am after the indent/reindent only.
EDIT: I am looking for a clever indent, sometimes called reindent, which is different to just pressing Tab or Shift+Tab (increase/decrease indent level). The indent feature in Eclipse behaves like this:
It places a beginning of current line at the right position, no matter where that line was starting before. So instead of thinking whether you need to increase or descrease the indent level (Tab or Shift+Tab), you just invoke the indent command and it will do the right thing.
Invoking the indent command on an empty line places the caret at the right position for the user to start typing.
It never influences any character beyond the first non-whitespace character.
If you just want to indent some lines, you can
Select them.
Press Tab.
To un-indent them, replace the second step to: Shift+Tab.
You can find more VS shortcuts here.
There are toolbar buttons for this, with wonderfully inconsistent labels (at least in the Visual Studio 2013 I'm using)...
In the "Text Editor" toolbar (in my default setup), I have to buttons whose tooltips are:
"Decrease Line Indent"
"Increase Line Indent"
In the "Customize" dialog, on the "Commands" tab (with "Toolbar" set to "Text Editor") they appear in the list as:
"Line Unindent"
"Line Indent"
And finally, if you press the "Add Command..." button (on the "Customize" dialog) to produce the "Add Command" dialog and select the "Edit" category, you'll see these two entries:
"Outdent"
"Indent"
As far as I can tell, these are all the same two commands, which should do what you want.
They also appear in the Edit -> Advanced menu, at the very bottom.
----- Edit -----
I believe you might be able to turn off all of the "formatting" actions except for indentation, so that when you use the "auto-format" command, only the indentation is "formatted" for you. (Of course this prevents you from ever using the rest of the formatting features without turning them on again, but if you don't use them, this might work!)

Clarification of Xcode's Indentation Options?

Xcode offers the following options under
Preferences > Text Editing > Indentation > Tab key:
In leading white space: Pressing Tab inserts an indentation only at the beginning of a line or following a space.
Never: Pressing Tab never causes an indentation.
Always: Pressing Tab always causes an indentation.
I checked the documentation for these options (that's what is to the right of the colons) but I still don't understand. What is "an indentation"? What I'd really like is if Xcode wouldn't act like it knows better than me and try reindenting lines of code that were already perfectly indented (I find it often does this inside of blocks - I'll have my code nested one level more than the line before it, and for whatever reason it tries aligning with the colon that starts the block argument, leading to unwieldy long lines, as if Obj-C doesn't have enough of those.)
Can anyone give me examples of how Xcode's behavior will change if I choose each of those options? Will one of those options make Xcode behave/autoindent the way I want it to?
If what you want is:
if Xcode wouldn't act like it knows better than me and try reindenting lines of code that were already perfectly indented
then the "Tab key" indentation setting has nothing to do with what you want.
Instead, try unchecking "Automatically indent based on syntax" and Xcode will stop changing your indentation level.
Alternatively, uncheck { and } under "Automatic indent for:".
See also: Xcode Text Editing Preferences Help: Setting Source Editing and Indenting Preferences

Customizing Xcode [fonts, code sense, and more]

How can I make code completion case-sensitive?
How can I make Ctrl-k kill the content of the line and the new line character?
How can I make backspace always delete only one character, no matter what it is? Right now, it deletes spaces in chunks equal to my indent level.
How to change the indentation style in file templates? I like to have the opening brace on its own line.
How can I make the font aliased?
I'm using Xcode 3.2.2.
EDIT: Issues 2, 4, and 5 are solved. 1 and 3 are still open.
EDIT2: ad.3. Yes, I set Xcode to use spaces, not tabs.
3.
Look in Preferences : Key Bindings : Text Key Bindings : Indent Friendly Delete Backwards
If the delete key is mapped to this entry change it to plain Delete Backwards.
2.
In that same preference area, you can see that there is no delete line option to map ^k to.
How can I make code completion case-sensitive?
I don't think that's possible.
How can I make Ctrl-k kill the content of the line and the new line character?
I can't answer that one, you might need to write a script to do it.
How can I make backspace always delete only one character, no matter what it is? Right now, it deletes spaces in chunks equal to my indent level.
Backspace always deletes one character. It sounds like your file has tab characters in it, each one of which takes up the space of 4 spaces by default. You can tell Xcode to use spaces instead by de-selecting Tab key inserts tab, not spaces in the Indentation preference panel.
How to change the indentation style in file templates? I like to have the opening brace on its own line.
You need to create custom file templates. You can find the Xcode templates here:
/Developer/Library/Xcode/Templates/File Templates
You need to copy the appropriate templates to this location:
~/Library/Application Support/Developer/Shared/Xcode/File Templates
You can then edit the template files to use whatever indents you like.
How can I make the font aliased?
You need to use a font that has aliased characters. Try Monaco at 9 or 10 points.

Resources