esm7 / obsidian-vimrc-support

A plugin for the Obsidian.md note-taking software
MIT License
1.11k stars 52 forks source link

Surround [[ not working in visual mode #245

Open Subtly7011 opened 1 month ago

Subtly7011 commented 1 month ago

Please Review Before Posting!

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 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

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

Environment (please complete the following information):

korniychuk commented 1 month ago

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

alythobani commented 1 month ago

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 commented 1 month ago

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

esm7 commented 4 weeks ago

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

korniychuk commented 2 weeks ago

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! 🚀

alythobani commented 2 weeks ago

Same here—thanks @esm7 !