VIM Mode - Quality of Life Improvements

I would also LOVE to be able to customize vim. gj to j and gk to k for example.

Also, I if I just press and hold j or k, it doesn’t continuously scroll; I have to press the j or k keys every single time I want the cursor to go down or up. Is there some setting to allow for continuous movement by just pressing and holding the key? I thought this was default vim behavior. Maybe there’s something in my .vimrc that I put a long time ago that makes this happen. Any help would be greatly appreciated :slight_smile:


Deeper Vim integration will be amazing. Maybe after there is a plugin API, someone will use Neovim to actually embed a Vim editor directly in Obsidian.


Don’t know if this helps narrow down the issue. While using vim, I’ve found that commands with the inside/around modifiers work with non-bracket types such as quotes. so a ci[ or di( don’t work, but a ci’ or di" does.

As far as esc key rebinding, I rebind my capslock key to esc using my OS or keyboard software then set up a macro somewhere else to toggle capslock in case it gets toggled on somehow.


j and k working like pressing up or down arrow would make the vim mode nicer to use.


I agree with you, but it should likely be a setting. I think what you are describing is gj and gk. This moves straight up and down even when words are wrapping. This is default Vim behaviour.

It will be ideal when we can use a .vimrc to set things specifically. Because I do map gj to j and gk to k. I almost never find the default j and k movement to be useful or intuitive.


Would like to second the point about Neovim; I don’t think that we even need to necessarily embed the editor, Obsidian can probably do it in the same fashion that the VSCode neovim extension does it; by just using nvim as a “backend”:

I also commented on this thread about adding Neovim as a “plugin”, however I think we’d get 90% of “I wish Obsidian’s Vim mode could do X” requests by just doing it the way the VSCode extension does it and replacing vim keybindings with it entirely.


Steps to reproduce

(with vim mode enabled)

  1. make a file with the following text:
# abcdef
## abcdefg
text text text text text text
text text text text text text
text text text text text text.
  1. fold the H2 heading (abcdefg)
  2. place cursor on g in H2 heading
  3. go up one line (press K)
  4. go down one line (press J)

Expected result

The cursor should return to the char g or atleast return somewhere on the heading

Actual result

The fold is opened and the cursor jumps to the end of the last line. In the above example it jumps to the fullstop


  • Operating system: Ubuntu 20.04
  • Obsidian version: 8.0.0

Additional information

This is a minor issue, but in vim mode it is common to scroll in a file using the J and K keys (like using arrow keys in non-vim mode) and random folds opening as you scroll and jumping of the cursor interrupts the flow of editing a lot, especially if the fold has lots of text.

I suspect it might be due to the editor wanting to place the cursor at the end of the line as you scroll, but instead placing it at the end of the fold. In vim when going down from a longer line to a shorter line it jumps to the end of the line depending on where the cursor was initially, that might be whats affecting this.

This happens in a lot of random places in my files, the above example was just one i was able to reproduce. I also was not able to reproduce this in normal (non vim) mode.

1 Like

Copy doesn’t work when using the keyboard shortcuts. In both Insert and Normal mode.
Right clicking and then selecting Copy does work.


I wouldn’t consider this a bug. This is always the case for IDEs with vim keybindings and you usually override what Ctrl+C does (see JetBrains, Atom, etc).

See also: VIM Mode - Quality of Life Improvements

Well then Ctrl-V shouldn’t be working either.

Yeah, maybe. You can still enter visual block mode with Ctrl+V from normal mode if you want. Either way, the ability to remap keys is the main point here.

1 Like

I completely agree.

For those who want the Ctrl+C combination to work with clipboard in Vim mode - you can temporary unmap keybinding in your current session.

Run CodeMirror.Vim.unmap('<C-c>') in console. You can do remapping similar way.


@mrjackphil’s great tip emphasizes the need to Support loading Vim commands from configuration (vimrc-style).
Otherwise, like he says, this is a temporary hack that needs to be repeated on every session.


wow @mrjackphil thank you for that tip on unmapping ctrl+c on console. It works perfectly.
Is there any way to make this into a volcano plug-in. So that in persists after restarting obsidian?
thank you!

1 Like

I believe (but I could be wrong, of course) what testing API would be available soon. I’ll adapt this workaround for it.


Thank you so much, I’ll keep an eye for it once the API is available. I appreciate your hard work!

1 Like

I would add that currently using standard vim navigation I can not move cursor behind the last symbol in the line.

I guess thats normal vim. You can press a to get in insert mode right from the cursor.

1 Like

thank you for the tip. I’m new in vim. However I’ve checked this in Neovim and it works as expected

1 Like