Matching brackets are not found in VIM mode

I’ve tried this with all core plugins off and only the the vim keybinding activated and everything else as is the default.

Steps to reproduce

  1. Create or move into a file
  2. Write text in it that has brackets (e.g. hello(world))
  3. Try to use any function of vim that requires the matching bracket. For example pressing % in normal mode while on a bracket, or being in-between the brackets and pressing vi( in normal mode.

Expected result

The cursor moves to the matching brackets/text in between them is highlighted.

Actual result

Nothing happens and the console logs the following errors:

TypeError: cm.scanForBracket is not a function (cm-addons.js:993)
    at selectCompanionObject (cm-addons.js:3999)
    at Object.textObjectManipulation (cm-addons.js:2136)
    at Object.evalInput (cm-addons.js:1587)
    at Object.processMotion (cm-addons.js:1297)
    at Object.processCommand (cm-addons.js:1272)
    at cm-addons.js:986
    at runInOp (codemirror.js:3929)
    at CodeMirror.operation (codemirror.js:8615)
    at cm-addons.js:980
    at doHandleBinding (codemirror.js:7129)
Uncaught TypeError: cm.scanForBracket is not a function (cm-addons.js:3999)
    at selectCompanionObject (cm-addons.js:3999)
    at Object.textObjectManipulation (cm-addons.js:2136)
    at Object.evalInput (cm-addons.js:1587)
    at Object.processMotion (cm-addons.js:1297)
    at Object.processCommand (cm-addons.js:1272)
    at cm-addons.js:986
    at runInOp (codemirror.js:3929)
    at CodeMirror.operation (codemirror.js:8615)
    at cm-addons.js:980
    at doHandleBinding (codemirror.js:7129)

Environment

  • Operating system: Windows 10
  • Obsidian version: v0.12.4 (with installer version v0.11.9)

Additional information

Boostnote used to have the same problem & they posted the solution (for them) in the issue

2 Likes

There’s a plugin that activates it. (not sure about %, but things like di( and ya[ work with it)

Oh nice, I found it: GitHub - mrjackphil/obsidian-add-codemirror-matchbrackets: This plugins adds matchbrackets.js which allows to use `di[` or `ya(` commands in Vim mode

I still think that this is a bug that should be fixed in the core

1 Like

will be included in 0.13.8.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.