23

Is there a way to auto indent (like ctrl+i in MATLAB) FORTRAN code in Visual Studio.

dewalla
  • 1,317
  • 8
  • 18
  • 42

2 Answers2

33

If you are using Visual Studio with the C# keyboard settings, the keyboard shortcut is Ctrl+K followed by Ctrl+F.

To get the full list of predefined shortcuts, see http://msdn.microsoft.com/en-us/library/da5kh0wa.aspx (Edit.FormatDocument). The list has all keyboard shortcuts from Visual Studio 6 to Visual Studio 2013.

Craig M. Brandenburg
  • 3,354
  • 5
  • 25
  • 37
Martin
  • 39,309
  • 62
  • 192
  • 278
3

Select the code you want to format and press Ctrl+K,F (i.e Ctrl+K then Ctrl+F)

Ctrl+K,D will format the entire document, without changing your cursor position (as Select-All option does).

ilivewithian
  • 19,476
  • 19
  • 103
  • 165