skip to Main Content

Is there any keyboard shortcut to jump between headers when editing a Markdown file in Visual Studio code? It could be using an extension or (hopefully) without any. I am using MacOS.

3

Answers


  1. You can use the extension Select By and the command moveby.regex to move the cursor to the next or begin occurrence of a regex.

      {
        "key": "ctrl+f6",  // or any other key combo
        "when": "editorTextFocus",
        "command": "moveby.regex",
        "args": {
          "regex": "#+",
          "properties": ["next", "end"]
        }
      },
      {
        "key": "shift+ctrl+f6",  // or any other key combo
        "when": "editorTextFocus",
        "command": "moveby.regex",
        "args": {
          "regex": "#+",
          "properties": ["prev", "start"]
        }
      }
    
    

    This jumps to the end of the next sequence of # characters or start of previous sequence.

    Login or Signup to reply.
  2. You can use the Go to Symbol in Editor... command, which on Windows and Linux is bound by default to ctrl+shift+o (not sure what it is on MacOS), and which opens a searchable and clickable selection menu of all the headings for Markdown files. You can also use arrow keys to navigate between entries listed in that menu. You also edit keybindings to your liking.

    You can also use the breadcrumbs bar (the thing between the tab bar and the editor panel). Just click on one of the heading entries in the breadcrumbs bar to get a popup menu where you can click on any other heading to jump there.

    There’s also the outline view (a subsection of the Explorer view), which you can focus with the Explorer: Focus on Outline View command, and bind to a keybinding with the outline.focus command ID.

    Login or Signup to reply.
  3. Your Outline view does a very good job of outlining a markdown file. Clicking on the entries takes you to that header. For example:

    Outline view of a markdown file

    You can show the Outline either by right-clicking the Explorer header and enabling Outline or View/Open View/Outline.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search