Vim mode: Passing multiple lines to obcommand using Vimrc Support Plugin

Hi, I understand this is probably a very niche request for help so here it goes. I use Vim keybindings (Preferences → Editor → Vim key bindings) and recently came across the Vimrc Support community plugin. This is not a feature request for Obsidian as I know it simply uses CodeMirror’s Vim implementation. So, seeking some help or suggestions here in the help section.

In my non-obsidian .vimrc, I am spoiled in using (uppercase) J and K to move lines up and down. This is great for outlining. After reading the Vimrc Support docs, I found a way to make it work but only for current line or single line but when I use multiple lines using v or V (visual mode), it still operates on a single line. This is true for any other obcommand as well.

What I’m trying to do

Using obcommand, bind J and K to move multiple lines (single lines work)

Things I have tried

My .obsidian.vimrc contains the following (which works for single line but not for multiple lines)

Binding K and J to moving line up and down
This doesn’t work for multiple lines - use alt + J or K

exmap moveup obcommand editor:swap-line-up
exmap movedown obcommand editor:swap-line-down
nmap K :moveup
nmap J :movedown
vmap K :moveup
vmap J :movedown

I also tried a different obcommand in case swap-line-up/ swap-line-down only works on single line.

Insert callout

exmap callout :obcommand editor:insert-callout
nmap z! :callout
vmap z! :callout

This also applies a callout to a single line and not multiple selected lines.

If using non-vim standard keybindings using Hotkeys, it works as expected.

Just wondering if I am missing something?

System information

"arch": "x64",
"platform": "darwin",
"version": "Version 1.3.7 (Installer 1.2.8)"
"obsidian-vimrc-support": "version": "0.9.0"

Thank you!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.