Visual Studio Expand/Collapse keyboard shortcuts

This question already has an answer here:

  • Visual Studio - Command to collapse all sections of code? 18 answers

  • Collapse to definitions

    CTRL + M, O

    Expand all outlining

    CTRL + M, X

    Expand or collapse everything

    CTRL + M, L

    This also works with other languages like TypeScript and JavaScript


    As you can see, there are several ways to achieve this.

    I personally use:

    Expand all: CTRL + M + L

    Collapse all: CTRL + M + O

    Bonus:

    Expand/Collapse on cursor location: CTRL + M + M


    Visual Studio 2015:

    Tools > Options > Settings > Environment > Keyboard
    

    Defaults:

    Edit.CollapsetoDefinitions: CTRL + M + O

    Edit.CollapseCurrentRegion: CTRL + M +CTRL + S

    Edit.ExpandAllOutlining: CTRL + M + CTRL + X

    Edit.ExpandCurrentRegion: CTRL + M + CTRL + E

    I like to set and use IntelliJ's shortcuts:

    Edit.CollapsetoDefinitions: CTRL + SHIFT + NUM-

    Edit.CollapseCurrentRegion: CTRL + NUM-

    Edit.ExpandAllOutlining: CTRL + SHIFT + NUM+

    Edit.ExpandCurrentRegion: CTRL + NUM+

    链接地址: http://www.djcxy.com/p/49348.html

    上一篇: 如何在Visual Studio代码中复制一行或选择内容?

    下一篇: Visual Studio展开/折叠键盘快捷键