esm7/obsidian-vimrc-support

[question] How do I move selected lines in visual mode?

sesm opened this issue · 1 comments

sesm commented

Please make sure your question is within the scope of this plugin.

  • I know this plugin is about persisting changes to the Vim support built into Obsidian, plus some bonus features, and considered asking in the Obsidian forum first.

Describe the question
In my .vimrc I have the following:

" Use J and K to move text blocks in visual mode
vnoremap J :m '>+1<CR>gv=gv
vnoremap K :m '<-2<CR>gv=gv

When I try to copy this to .obsidian.vimrc, I'm getting the following error when I try to use J or K:

Not and editor command ":m"

How do I fix it? Or maybe there is an alternative way to configure the same behavior in .obsidian.vimrc?

sesm commented

There are obcommands editor:swap-line-up and editor:swap-line-down, but they only move a single line as opposed to moving the selection.