Can I see line numbers in the VS2010 editor? - visual-studio

I spent time searching how to do this but came up with nothing. Is there a simple way I can make the editor show line numbers?

Tools, Options, Text Editor, All Languages, Show Line Numbers
You can also show them only for a specific language.

In the Tools menu, select Options. Under Text Editor, All Languages, General, you'll find "Display line numbers".

http://msdn.microsoft.com/en-us/library/ms165340.aspx
On the menu bar, choose Tools, Options.
In the categories list on the left side of the Options window, expand the Text Editor node.
Expand the All Languages subfolder, and then choose General to set this option globally.

Related

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!)

VS2010 Missing "Show All Settings"

Using VS2010 I wanted to turn on line numbering.
I went to:
Tools -> Options -> Environment with the intention of going to "All Languages" but the option wasn't there - neither was there an option for C# (which was the environment I specified at installation).
So I thought I just need to click "Show All Settings" in the bottom left corner... but it's not there.
All I really want is to turn on the line numbers but I'm kind of stumped without the right options being available.
Can anybody help with this?
From MSDN
To display line numbers in code
1.
On the menu bar, choose Tools, Options.
2.
In the categories list on the left side of the Options window, expand the Text Editor node.
3.
Perform one of the following steps:
◦ To set this option globally, expand the All Languages subfolder.
Depending on your language or setttings, you may also need to select the Show All Settings check box in the Options window to reveal the All Languages subfolder that this procedure mentions.
◦To set this option for a specific language such as Basic, C#, F#, open the subfolder for that language.
4.
Choose the General option.
5.
In the Display section, choose Line numbers.
you can turn on the Line number by going to:
Tools>Option>Text Editor>All Languages> General> mark the the Checkbox of Line numbers as Checked.
Tools -> Options -> TextEditor -> AllLanguages
For C#
Tools -> Options -> TextEditor -> C#

textmates' c++ keywords in color

I was wondering how to enable multi-color function in textmate to display keywords (c-like syntax) in color?
So, for example in sublime, pressing CTRL+SHIFT+P will pop-up a menu from which a user can choose the coloring pattern for the code.
Just save the file with a file extension for the programming language you are using, such as .c for c and the syntax highlighting will appear.
At the bottom of the window there is a drop down menu that shows all of the different styles and contexts that you can use.

Reformatting code in text mate to established code conventions - Visual studio's ctrl K+D equivalent on Text Mate

Can anyone tell me if there's a quick way to format your code in Text Mate, similar to pressing ctrl K+D in Visual studio?
Thanks!
Edit by Damien_The_Unbeliever:
For those not familiar with Ctrl K+D, it doesn't just indent code - it reformats it using the generally established formatting conventions in the editor - it may replace spaces with tabs or vice-versa for the indentation, ensure code is consistently indented, move braces to separate lines, etc.
TextMate reindenting and reformatting varies a little depending on the language you're using.
You can generally use the Text menu, that depending wether you have an active selection or not it will show you different commands under it. For example, if you have selected a section of code, there will be a Indent Selection menu item. If you have no active selection, it will be Indent Line.
To have this working properly, be sure to select the current language, if it isn't assigned yet (like on unsaved documents). If you're working with HTML, it will simply indent the lines depending on what's above it. It will keep line breaks intact.
If you need something to break out tags on new lines and properly format the document, you should use the Tidy command that is found in the Bundles menu, under HTML (or simply by using the shortcut CTRL+SHIFT+H. If you have a selection active at the moment that you use it, it will simply reindent that section. If instead you have no selection, it will properly reformat the whole document, including checking for tag validity and other errors.
The Bundles for other language have similar commands, like XML (still Tidy) and Javascript (that has a Reformat Document command).
As an ending note, I simply suggest to look into the Bundles menu; there are many little gems in it. ;)
Did you look in the menu bar? Under Text you have a couple of Reformat… entries that may fit your needs.
Beside these native features, some bundles — like the JavaScript one — have custom Reformat… commands : click on the little cog button at the bottom and explore your current language's bundle's content.

emacs like fill-paragraph option in textmate?

Is there an option to reformat lines/paragraphs/selected text to 80 cols in TextMate like in emacs (fill-paragraph bound to M-q)? If not, do you know of any option to add this to TextMate - a known plugin/macro? any help in writing such a macro is most welcome too. :)
It only changes how the text is displayed — not the text itself — but in the menu bar, "View" > "Wrap Column" > "78". Or choose "Other…", it displays a vertical ruler you can move to the desired column.
If the "Soft Wrap" option is checked, your text will look like it's reformated.
To reformat the text for real, simply hit ctrlq. It will use the number checked in the aforementioned menu.
If what you want is to hard-wrap paragraphs see here: http://lists.macromates.com/textmate/2006-November/015707.html

Resources