[Bug] vim-mode gj movement command break with live preview, bullets, and transclusion

Using

  • vim mode
  • live preview
  • a transcluded (embedded) wiki link
  • inside a bullet point

vim movement command gj can not move past the transcluded link.

gj is identical to j except it accounts for line wraps. Some of us noremap j gj for this reason.

gj is effectively equivalent to using the arrow keys to navigate.

Steps to reproduce

  1. enable vim mode
  2. use Live Preview
  3. create the following document
![[#foo]]

- ![[#foo]]

# foo

NOTE: for some reason, copy and pasting this snippet from Discourse into Obsidian elides the line breaks. Go into source mode to ensure the document is structured properly

  1. starting at the top line, attempt to navigate down one line at a time using gj. Type gj repeatedly. Same with the down arrow.

Expected result

gj should be able to move past the transcluded wikilink in the bullet point just as it does on the transcluded wikilink that isn’t in a bullet.

Actual result

gj can not move past the bullet point with the transcluded wikilink. j of course still works.

The same result happens with the down arrow.

Environment

SYSTEM INFO:
	Obsidian version: v0.13.22
	Installer version: v0.13.19
	Operating system: Darwin Kernel Version 20.6.0: Wed Nov 10 22:23:07 PST 2021; root:xnu-7195.141.14~1/RELEASE_X86_64 20.6.0
	Login status: logged in
	Catalyst license: vip
	Insider build toggle: on
	Live preview: on
	Legacy editor: off
	Base theme: dark
	Community theme: none
	Snippets enabled: 0
	Safe mode: on

RECOMMENDATIONS:
	none

1 Like

does it happen in source mode?

It does not happen in source mode, just LP.
It also happens in LP when in vim mode and using the down arrow key to navigate.

It doesn’t happen in LP when out of vim mode and using the down arrow key to navigate lines.

(Deleted my previous reply; I was confused on which bug this was. Sorry.)

Since updating to 13.30 I have a similar problem with ‘gj’ in vim mode, only it does not move past level one headings. This is with either live preview or source view toggled. Transcluded links and bullets, other level headings, work fine. ‘gj’ works in legacy mode.

Debug Info

SYSTEM INFO:
	Obsidian version: v0.13.30
	Installer version: v0.12.19
	Operating system: #1 SMP Mon Feb 7 14:40:20 UTC 2022 (77d9d02) 5.3.18-150300.59.49-default
	Login status: not logged in
	Insider build toggle: off
	Live preview: on
	Legacy editor: off
	Base theme: dark
	Community theme: none
	Snippets enabled: 0
	Safe mode: off
	Plugins installed: 0
	Plugins enabled: 0

RECOMMENDATIONS:
	none

I had the same issue with H1 and was able to fix by reducing the size of my headings. It seems like there is a bug computing logical lines, likely upstream cc @WhiteNoise

:root {
  --h1: 1.25em;
  --h2: 1.20em;
  --h3: 1.15em;
  --h4: 1.10em;
  --h5: 1.05em;
  --h6: 1.00em;
}
1 Like

Thanks for that!

For what it is worth the magic number for me was 1.87em. Any greater and ‘gj’ can’t scroll past h1.

Related