Vi mode persistent in pane between files

Steps to reproduce

  • Enable vi mode in Obsidian preferences
  • Open file
  • enter edit mode
  • enable vi insert mode
  • click on a different file in the file navigation pane, open a new file through a search result, etc.

Expected result

The newly opened file will open in vi Command mode (NOT edit mode).

Actual result

The new file is opened in edit mode.


  • Operating system: MacOS 11.1
  • Obsidian version: v0.11.0

Additional information

vi is a modal editor with two modes: command mode and edit mode. In normal vi/vim editors, one must exit edit mode in order to open a new file. When the new file is opened, it is therefore opened in command mode.

Obsidian’s current behavior is unexpected and confusing; when a new file is opened, you may want to go to the end of the file (“G”), search for a string in the file ("/search string"), or perform other commands. Due to the fact that Obsidian’s vi mode persists (per pane) between files, it makes it very easy to start typing commands but instead deface the newly opened file.

I would suggest that regardless of other obsidian settings (like “default view mode”), when a new/different file is opened in a new or existing pane, and vi mode is enabled, the file is opened in command mode, not edit mode.

The “bug” is also related to the issue linked below in the following manner: When clicking on a link in a search, the file is opened to the search matching location. However, since one never knows what mode vi happens to be in, using command-mode keys to navigate the newly opened file is likely result in nothing but a bunch of garbage characters inadvertently being typed at the top of the file (and losing the search location):

Note: this bug report is different than this (although perhaps it sounds superficially similar) feature request:

1 Like

I want to carefully clarify that this means that the “vi mode” is command mode.

The “vi mode” is independent from the Obsidian “mode” for the pane.

vi modes: Command mode, Edit mode

Obsidian Modes: Preview mode, Edit mode

I am not suggesting any changes be made to the handling of Obsidian Modes.

Rather the request is to ensure the “vi mode” for a newly opened file in an existing pane is set to Command mode.

I checked the links and there is a big confusion and people want different things.
The current behaviour is this
Open a note in the same pane, maintains the current vi mode.
Open a new pane, opens vi in command mode.

I don’t necessarily think there is anything wrong with it. I understand the different preferences.
I merge this with the feature request you linked and edit it.

A post was merged into an existing topic: VIM: always default to NORMAL when opening a note

Ok, thanks.

Just saying that I use vim mode in every application I have that supports it and I’ve never seen one that leaves vi in insert mode when opening a new file. I do think it’s confusing and non-standard. We’ll see how it goes as a feature request.