views:

73

answers:

3

i notice that when i start next line of code and i press enter, it recompacts itself and the continued line moves left a bit... then if i place focus on the second line and press enter again, it (the second line) moves to the left some more, and it keeps doing this every time i focus on second line and press enter. this is as you can imagine, really annoying!!

how can i make it so that my second (and third etc) lines are formatted in a pre-determined way so they are always a certain amount of tabs indented to the right from where my line 1 starts??

thanks

ps: i have no idea why VS has always been weird with this, its really bad design if you ask me especially as default behaviour.

+1  A: 

I had this problem for a while in VS2010. It seems to only be a problem if you are using Tab indenting - I fixed it by changing my indenting option to Spaces rather than Tabs.

Tools > Options > Text Editor > Basic > Tabs :

* Indenting: Smart
* Insert Spaces
Pondidum
thanks buddy, i have accepted and upvoted your answer, this sounds like something that would work, although, this also means that scrolling through your code using the arrow keys are going to be more painful, what do you think? does anyone know how we can keep tabs and have consistent formatting?
I also preferred tabs to spaces, but I found that I don't really notice the difference, especially when navigating with CTRL + Left/Right/Up/Down etc.
Pondidum
+1  A: 

Try IDE Editor Format settings. Or Ctrl+K, D quick formatting.

KMan
+1  A: 

Go to Tools -> Options -> Text Editor -> [Language] -> Tabs and you can set up your indenting options as needed. For more information I have a post here that may help: http://blogs.msdn.com/b/zainnab/archive/2010/09/08/insert-spaces-vs-keep-tabs-vstipedit0072.aspx

zainnab