obsidian-vimrc-support icon indicating copy to clipboard operation
obsidian-vimrc-support copied to clipboard

vmap doesn't seem to work with toggle commands

Open adaitche opened this issue 1 year ago • 1 comments

I am trying to create a shortcut for various toggle commands for lists. For example, toggling a list to a numbered list.

Reproduce

Setup

Here is what I put in my .vimrc:

exmap toggleNumberedList obcommand editor:toggle-numbered-list
nmap gl1 :toggleNumberedList
vmap gl1 :toggleNumberedList

Problem

When I do a visual select of a bullet list and press gl1, only the last item is turned into a numbered item. For example, the result is

- foo
- bar
1. baz

after selecting the whole list and applying the command.

Environment

  • OS: MacOS
  • Vimrc plugin version: 0.9

adaitche avatar Jan 26 '24 15:01 adaitche

I also have the same problem. I found out that it is because of obcommand. If you highlight the text in visual mode and use the command via the command palette it works. There is also one old issue #187 that covers this. But it didn't get implemented.

ghost avatar Nov 08 '24 14:11 ghost