The $ regex metacharacter in vim keybindings does not recognize end of file

Steps to reproduce

Create a simple note such as:

line1
line2
line3
line4

With vim keybindings enabled, in edit mode, type the following:

:%s/[0-9]$//

Expected result

Note should now appear as follows:

line
line
line
line

Actual result

Note actually appears as:

line
line
line
line4

Environment

  • Operating system: Linux Mint 19
  • Obsidian version: 0.9.17

Additional information

Note that searching while in edit mode (with slash) does not exhibit this behavior; it will properly find the last line of the file. Thus behavior of the $ metacharacter is inconsistent. I believe the substitute command is interpreting $ to be end of line (\n) but not end of file, therefore skipping the last line because there is no newline. End of line is end of line, even if it’s at the end of the file.

Since I can repro this on codemirror website, this should be an upstream bug.

I suggest you file a bug report there.