Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to automatically place cursor between braces on its own line using Visual Studio 2017

When I place an open brace in Visual Studio 2017 (C#) the cursor automatically goes to the next line to the left of the end brace. Like this (period as cursor):

if() {
.}

I'd like the cursor to automatically be on its own line like this (period as cursor):

if() {
    .
}

Does anybody know how to make the cursor automatically go where the period is in the second example?

like image 454
Andrew Avatar asked Jul 30 '17 01:07

Andrew


2 Answers

When you are at state 1 from your example use Ctrl + Enter.

This sends the line you are at one level down but keeps the cursor at current position. Effectively that will get you from state 1 in your example to state 2 in your example.

like image 175
PiotrWolkowski Avatar answered Sep 25 '22 15:09

PiotrWolkowski


Not sure because I am on VS 2013, but what you're looking for is probably in

Tools --> Options --> Text Editor --> C# --> formatting --> New Lines

like image 21
Devin L. Avatar answered Sep 23 '22 15:09

Devin L.