VIM Mode: Recent changes getting lost

Steps to reproduce

  1. Open new note.
  2. Enter insert mode (because I’m using Vim key bindings).
  3. Type a sentence and immediately press Ctrl+W to close the note.

How much content gets saved seems to vary, but the end of the content is almost always missing. For example, just now I typed: This is a note., but when I reopened the note, all it contained was: This is a

Expected result

All content typed before closing the note should be saved.

Actual result

The end of the content is elided when the note is reopened.

Environment

  • Operating system: Linux (flatpak)
  • Obsidian version: 0.9.6

Additional information

I even tried pressing Ctrl+S followed immediately by Ctrl+W, but that didn’t seem to help. The only thing that seems to avoid the issue is waiting a while after finishing typing before I close the note.

2 Likes

Interesting

Not a bug.
That’s what ctrl-w does in instert mode in vim.

You should remap ctrl-w in obsidian to something else to avoid conflicts

1 Like

Vim only deletes the previous word when in insert mode. It doesn’t do that in command mode.

I believe that’s why I was confused: I expected Obsidian to do similarly: delete the previous word in insert mode (but not close the pane), but close the pane when in command mode (but not delete the previous word).

Would it be possible to have a more consistent behavior here rather than needing to manually rebind ctrl-w if you enable Vim key bindings?

We may disable obsidian shortcuts while in insert mode, but ultimately we can’t handle all the possible conflicts between the various vim modes and obsidian.

Yeah, makes sense :+1:

We may disable obsidian shortcuts while in insert mode

I think that sounds like an extreme idea. That seems like it would mean choosing between Obsidian and Vim functionality. Vim isn’t a plugin I want to keep having to turn off and on.

If that were done, how much functionality would be lost in terms of navigating panes, editing titles, opening sidebars, etc?

we can’t handle all the possible conflicts

Perhaps not. But I think it would be far easier to handle an occasional conflict when and if it arises (this is one single conflict and seems pretty important), rather than introduce the possibility that you need to reimplement all the hotkeys in some Vim Mode equivalent, or disable them all completely.

I propose that ctrl-w as a “delete word” function simply be removed from Vim Insert Mode. As a heavy Vim user, to me it would make more sense to take Vim functionality away from Insert Mode, than to ever take away from Obsidian’s functionality. If Insert Mode basically functioned like regular Obsidian, that would not bother me at all. (Personally speaking of course.)

Normal Mode, Command Line, and Visual Mode are the only important parts of the Vim plugin to me.