Incorrect vim-mode replace

Steps to reproduce

  1. Activate vim mode in the Editor preferences.
  2. Type **bold** on a line.
  3. Keep the cursor on the line, in normal mode.
  4. Try to remove all stars with the command :s/\*//g.

Did you follow the troubleshooting guide? Yes (observed in the Sandbox vault).

Expected result

In vim, the above removes all stars (as expected from the “global” flag /g).

Actual result

In Obsidian, only the first star is removed from each group, and we get *bold*.

Environment

SYSTEM INFO:
Obsidian version: v1.5.3
Installer version: v1.4.13
Operating system: Darwin Kernel Version 23.3.0: Wed Dec 20 21:30:27 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T8103 23.3.0
Login status: not logged in
Insider build toggle: off
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: off
Plugins installed: 1
Plugins enabled: 1
1: Various Complements v8.3.2


Additional information

I checked on CodeMirror that their vim editor works correctly, and it does (both with their version 5 and their version 6): this appears to be an Obsidian specific bug.

Does it happen in source mode?

Does it happen here?

Thank you for your followup.

The same problem also appears in source mode (the result is *bold*).

The problem is also present in the online editor you pointed to (which produces *bold* too).

Now, vim on macOS correctly produces bold, instead (as does the CodeMirror 5 online editor, again).

Thanks

Please, search/open a bug report here and explain them how to reproduce the bug in their sandbox.

Thanks for the pointers.

Done!

1 Like

For reference:

  1. This was fixed upstream in the codemirror-vim repo on 2024-11-06.
  2. The fix is apparently not yet included in Obsidian 1.7.7, as codemirror-vim was only updated in Obsidian before 2024-10-16 (Obsidian 1.7.4).

Keeping my fingers crossed for the fix to work in a future version of Obsidian!

1 Like