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

Surround [[ not working in visual mode

Open Subtly7011 opened this issue 1 year ago • 6 comments

Please Review Before Posting!

  • [x] I'm reasonably sure that this bug is indeed about the Vimrc file support and not a general Vim in Obsidian issue. If it's a general Vim issue, report it here.

Describe the bug: Firstly many thanks for this plugin!

Have added the surround_wiki [[ command to the vimrc file and this is working in normal mode (I have updated to include the <CR> tag in my file). However, this is not working in visual mode, meaning that I can only use the [[ shortcut to surround_wiki a single word, rather than selecting multiple words as the title of a note to wiki link.

In the command line, it is returning an error: RangeError: Invalid change range x to y (in doc of length z) Which means (I think) it is trying to jump to a line in the file that does not exist.

To Reproduce: vimrc file: exmap surround_wiki surround [[ ]] map [[ :surround_wiki<CR>

Enter visual mode and select multiple words, press [[ to surround_wiki these words. Returns the above error.

Environment (please complete the following information):

  • OS: Windows
  • Vimrc plugin version: 0.10.1

Subtly7011 avatar Oct 23 '24 10:10 Subtly7011

I'm also facing it. It actually stopped working (for me) with a selection from right to left. I've prepared a simple demo.

https://github.com/user-attachments/assets/4d0ac970-3cab-414c-ad51-a9c86611a239

  • OS: MacOS 14.4.1

  • Obsidian: 1.7.4

  • Vimrc plugin version: 0.10.1

  • I updated the Obsidian & Vmirc Plugin yesterday. Before the update - the surrounding functionality worked correctly, I used to use it every day.

    • Previous versions: (don't remember minor versions)
      • Vimrc Plugin: 0.9.*
      • Obsidian: 1.6.*

korniychuk avatar Oct 24 '24 10:10 korniychuk

Yeah I always make sure to use it when text is selected left-to-right, I figured this was always a small bug in the implementation

(protip - hit o while in visual mode to switch selection direction)

alythobani avatar Oct 26 '24 18:10 alythobani

Oh, looks like this is a duplicate of #234 which has been fixed already, the fix just hasn't been released yet? @esm7

alythobani avatar Oct 26 '24 19:10 alythobani

Indeed, I haven't released a version for a while, aiming for this week.

esm7 avatar Oct 29 '24 11:10 esm7

Thanks for the release @esm7 🙏 I've upgraded and can confirm that in 0.10.2 the issue from my demo has disappeared (fixed). Thanks! 🚀

korniychuk avatar Nov 07 '24 11:11 korniychuk

Same here—thanks @esm7 !

alythobani avatar Nov 07 '24 16:11 alythobani