Skip to content

Add keyboard shortcuts to step over Markdown formatting markers #490

Closed

Description

@uNyanda
  • Date: 2026-07-26
  • Type: Enhancement
  • Priority: Low

Problem

Keyboard shortcuts such as Ctrl+B, Ctrl+I, and similar formatting shortcuts automatically insert Markdown formatting markers and place the cursor between them, making it quick to begin typing formatted text.

However, once the user has finished typing, moving the cursor outside the formatting markers requires additional cursor movement before they can continue writing. This interrupts an otherwise smooth keyboard-driven editing workflow.

Proposed enhancement

Provide keyboard shortcuts for navigating across Markdown formatting markers when the cursor is inside a formatted region.

Example

  • Ctrl+L moves the cursor to the first position immediately after the closing formatting markers.

    Before

    **This|**

    After

    **This**|
  • Ctrl+H moves the cursor to the first position immediately before the opening markers.

    Before

    **That|**

    After

    |**That**
  • When the cursor is immediately before the opening formatting markers, pressing Ctrl+L once moves the cursor inside the formatted region. Pressing Ctrl+L again moves the cursor to the first position immediately after the closing formatting markers.

    Before

    |**This** 

    After pressing Ctrl+L once

    **|This**

    After pressing Ctrl+L the second time

    **This**|
  • When the cursor is immediately after the closing formatting markers, pressing Ctrl+H moves the cursor inside the formatted region. Pressing Ctrl+H again moves the cursor to the first position immediately before the opening formatting markers.

    Before

    **This**|

    After pressing Ctrl+H once

    **This|**

    After pressing Ctrl+H the second time

    |**This**

Why this would help

  • Improves keyboard-driven editing.
  • Reduces unnecessary cursor movement.
  • Makes working with Markdown formatting faster and more efficient.
  • Provides a smoother writing experience for users who frequently use formatting shortcuts.

Current workaround

Users must manually move the cursor out of the formatting markers using the arrow keys, the mouse, or editor-specific navigation commands (such as Vim motions). These approaches require multiple keystrokes or mode changes, interrupting an otherwise smooth keyboard-driven editing workflow.

Additional context

This behaviour would be especially useful for users who frequently write in Markdown using keyboard shortcuts, allowing them to navigate across formatting boundaries without interrupting their typing flow.

If implemented, the same concept could potentially be extended to other paired characters such as (), [], and {} for consistent cursor navigation across paired delimiters.

Activity

  1. adibhanna commented on Jul 27, 2026

    @adibhanna
    Contributor

    Built — it ships in 2.19.0. Thanks @uNyanda, this was a good catch about where the cursor is left stranded.

    Alt+] moves the cursor to the far side of the next run of markers on the line; Alt+[ to the near side of the previous one. That gives all four moves you specified:

    **This|**   → Alt+]  →  **This**|
    **That|**   → Alt+[  →  |**That**
    |**This**   → Alt+]  →  **|This**   → Alt+]  →  **This**|
    **This**|   → Alt+[  →  **This|**   → Alt+[  →  |**This**
    

    A "run" is consecutive identical marker characters, so ** is crossed whole. That also answers your extension idea about (), [], {} — they're included, and because ]( is two runs rather than one, [text](url) walks in three useful steps: out of the link text, into the URL, out of the link. The full set is **, *, ~~, ==, backticks, $ and the three bracket pairs.

    _ is deliberately not in the set. It's a valid emphasis marker, but snake_case words are common enough in notes that including it would stop the cursor in the middle of ordinary text. Say the word if you'd rather have it and I'll make it a setting.

    On Ctrl+L / Ctrl+H: I didn't use them as the defaults, because both are already taken exactly where you'd press them — Mod+L is CodeMirror's select-line on Linux and Windows (you're on Linux, so Ctrl+L would be shadowing it), and Ctrl+H is delete-backward on macOS and in Vim insert mode. The defaults are Alt+] and Alt+[, bracket keys as a delimiter mnemonic. Both are proper keymap entries (editor.hopMarkerForward / editor.hopMarkerBackward), so if you want your original proposal, Settings → Keymaps will take Ctrl+L / Ctrl+H — and it'll warn you about any conflict. They're also settable in config.toml under [keymap].

    Two details worth knowing:

    • The scan is line-scoped. Inline markers don't span lines, and a motion that could throw the cursor into another paragraph would be worse than no motion.
    • With no marker ahead, the key does nothing and falls through to whatever else it's bound to, rather than inventing a jump to the end of the line.

    Works in Vim mode and out of it — I verified all three states by driving the packaged app: non-Vim, Vim insert, and Vim normal. In each, Mod+B bold Alt+] omega writes Alpha **bold** omega, and Alt+[ walks back out to the front of the pair.

    Related, from the same release: pressing the formatting shortcut a second time now also steps out of the span (#443, by @junereycasuga), so Mod+B bold Mod+B gets you out of bold specifically. The new hops are the general motion — any marker, either direction, regardless of which format you're in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions