Vim mode `i` command cursor insert position is wrong

Steps to reproduce

  1. Enable the Vim mode.
  2. Start editing a new note.
  3. Enter insert mode, type fob, exit insert mode (with ESC)
  4. Position the cursor (while still in Vim normal mode) on the o in fob.
  5. Press i.

Expected result

The insertion cursor is between the letters f and o, just like it would be in Vim.

Actual result

The insertion cursor is between the letters o and b.

This makes the i command in Vim mode useless because it behaves just like the a command. So instead of having two commands, one that places the insertion cursor before and one after the current letter, we have two commands that do the same thing.

I recommend comparing both i and a commands in Vim versus Obsidian’s Vim mode. You’ll see they don’t position the cursor the same.

For users that have used Vim keybinds for decades, this makes Obsidian incredibly difficult to use (seriously, I am both unable and unwilling to undo decades of muscle memory).

Environment

  • Operating system:
$ uname -a 
Linux debian 5.10.0-8-amd64 #1 SMP Debian 5.10.46-5 (2021-09-23) x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 11 (bullseye)
Release:	11
Codename:	bullseye
  • Obsidian version: 0.12.19

Additional information

2 Likes

I can’t repro. Post a screen recording of this happening in the help vault.

1 Like

I’ve done some testing and the problem occurs when using the ā€˜Fancy cursor’ option from the ā€˜Advanced Appearance’ community plugin.

See this issue and this PR.

3 Likes

rstk got it right. It appears to be a super confusing but visual-only issue, except that I do not have the ā€œAdvanced Appearanceā€ plugin installed and I’ve never heard of the ā€œFancy cursorā€ option. I do use the following community plugins:

  • Minimal Theme Settings
  • Obsidian Git
  • Vimrc support

I also use the Minimal Theme theme. Maybe it’s a shared dependency or some copy-pasted code? The issue I see sounds exactly like the one described by rstk.

I can confirm that it’s not possible to repro this in the help vault (which is a super convenient way to test out plugin interactions without having to roll everything back, so props to that idea).

2 Likes

Switching from Minimal Theme back to Default makes the issue go away. So that’s the culprit.

I’ll just go back to the default theme then. Thanks everyone for your help!

2 Likes

Thank you for identifying this