Folded sections/lists are expanded when cursor passes them in vim mode

When in vim-mode, moving the cursor to or from a line with folded content (either sub-points in a bullet lists or a folded section) will often expand it, with the cursor landing in the expanded section.

Steps to reproduce

Enable vim mode.
Create a nested list, and fold the top-level bullets points.
Use j/k or up/down arrow keys to navigate between the top-level bullet points in normal mode.
(Failure happens more often if the top-level bullet points are long enough to wrap.)

Expected result

The cursor moves between the top-level bullet points.

Actual result

Often (but not always) the bullet point that the cursor moves to or from will expand (unfold), and the cursor will move to the first or last of the expanded items.


  • Operating system: macOS 11.2.1
  • Obsidian version: v.0.11.3

When I move cursor in Vim mode from a fold line with key j / k, it unfold automatically sometimes according cursor position or just to expand with no condition, but it doesn’t apperence in the edit mode. So I have to move the cursor with mouse or in edit mode to prevent it unfold.

I have reported to the plugin Outliner’s author, and as he said it is like an Obsidian’s vim mode problem.

Please take a look on it, appreciate for all your efforts!

  • System: MacOS 11.2.3
  • Obsidian Version: 11.13 the latest version right now.

I have the same problem. I found minimal steps to reproduce:

  1. Write this in obsidian:
- aax
- a
	- a
  1. Fold the second bullet
  2. Place cursor at x
  3. Press j
  4. (optional) sometimes you have to move up and down once more (kj)

obsidian v0.12.19

So they get unfolded if the cursor is at a character far to the right, and we move to a short line (cursor position > new line length). Does anyone have any idea why that may happen?

This issue makes folding in vim mode almost unusable :frowning:

1 Like

It looks that they may be two separate issues.
I also experienced the one @lukas describes, but I fixed it by remapping:

nmap j gj
nmap k gk

with the vimrc pluggin.

1 Like