Vim support for the new editor (Codemirror 6) - Neovim, libvim, or something else

This CM6 vim mode experiment repo from the BountySource issue seems like the most up to date and promising effort thus far. Is there an up to date guide for integrating code for CM into Obsidian? I only just got started with Obsidian this last week, and don’t have the context of how CM fits in.

3 Likes

Following up on this, the recent changes in the repo (12 hours ago as of this post) have made great progress. I’m able to build and run a barebones CM6 editor with this new experimental Vim mode now :tada:

In my very light testing I haven’t had any issues with basic Vim usage. What is typically the next step for including CM changes into Obsidian when a new beta is being worked on, like v0.13 is now?

PS: I don’t know who to ping about this, so I’ll ping you given how Vim is blocking us from using Live Preview @santi :slight_smile:

6 Likes

thanks for keeping up with this post, Like you said I haven’t been able to move to Live Preview, due to the lack of vim.
I’m not sure if I understood what you said correctly, did you manage to test vim in Obsidian’s live preview with the updates done in that CM6 repo?

Really hope there’s a solution for us desperate vimers

3 Likes

licat is creating pulls against that cm6 vim mode experiment repo Add support for font family and font size on fat-cursor. by lishid · Pull Request #1 · nightwing/cm6-vim-mode-experiment · GitHub

1 Like

Oh we’ve already gotten vim mode working in the upcoming release - licat

Yes vim mode is coming to live preview - licat

1 Like

And here it is in 0.13.8! :tada:

Vim mode is now available for both Live Preview and Source mode.

vimLive

11 Likes

With this VIM Mode support, Is there a way to enable copy/paste from system clipboard to the note and vice versa?

Hi @shankarnakai I don’t know if that was fixed in Windows/Linux yet. (It always worked in MacOS.) If not, did you see this workaround? How to copy with vim mode? - #27 by santi

1 Like

@shankarnakai @rigmarole
In legacy editor, install and enable the vimrc plugin and put this in your .obsidian.vimrc file:

set clipboard=unnamed

…and restart obsidian.
The vimrc plugin doesn’t work yet with the new editor.

At least on Mac, Cmd-c/x/v work in insert mode with the new CM6 editor too.

3 Likes

Whoops noted, sorry!

Thanks @pmbauer @rigmarole , It worked for me.

1 Like

Didn’t see this - oops! Yes I was testing the experimental Vim repo, keeping up with their progress and testing in a stand alone CM6 editor. It got far enough to be included, which I was thrilled to see, and had nothing to do with my testing :slight_smile:

1 Like

This is awesome! Can I ask, is there a new method for defining ex commands with the new editor? I’m working on a plugin that listens for the codemirror event, then calls CodeMirror.Vim.defineEx(), but that doesn’t work with the new editor. The codemirror event doesn’t fire, and even if I try calling defineEx() in a long setTimeout, it doesn’t work. Strangely, it doesn’t throw an error. CodeMirror.Vim.defineEx does exist, but it doesn’t have any effect.