2

I was watching a tutorial where they were using Eclipse instead of VS. In that tutorial, they had a line simular to the following example:

if (true){ example = 1; DoSomething(); x = ReturnNumber(); break; }

Using a hotkey they split the line of code, one line at the time, to

if (true)
{
    example = 1;
    DoSomething();
    x = ReturnNumber();
    break;
}

I can't find out what the hotkey for this is since I don't know how to describe it. So, what's the hotkey for it?

Edit: enter image description here

Sander Koldenhof
  • 1,223
  • 4
  • 13
  • 26
  • C#? try ctrl+E, D – Lei Yang Mar 14 '19 at 14:01
  • Tried it, and that isn't it. Ctrl E seems to compile a selected block of code - or line if you haven't selected anything - and Ctrl D duplicates the line. Very useful hotkeys though. – Sander Koldenhof Mar 14 '19 at 14:15
  • i doubt you're using visual studio. because ctrl+D to duplicate is the way netbeans(intellij idea, pycharm) do. how about menu Edit-Advanced-Format(the last word i don't remember) – Lei Yang Mar 14 '19 at 14:18
  • I think you possibly meant ctrl K, D. Ctrl E, D is not recognized as a command so I tried them separately, resulting in the commands above. Ctrl K, D reformats the code. – Sander Koldenhof Mar 14 '19 at 14:31
  • can you paste a screen shot of your menu to the question? i don't believe. – Lei Yang Mar 14 '19 at 14:34
  • Added the screenshot. It's a fresh installment of VS 2017, no hotkeys are swapped. – Sander Koldenhof Mar 14 '19 at 14:49
  • i searched and found this [answer](https://stackoverflow.com/questions/4942113/format-code-shortcut-for-visual-studio), both of our short keys are valid... – Lei Yang Mar 14 '19 at 14:54

0 Answers0