mjbrownie / swapit

vim plugin: Extensible Keyword Swapper
39 stars 8 forks source link

Bug with open parenthesis #32

Open kevinlawler opened 2 years ago

kevinlawler commented 2 years ago

Given a string (true with the cursor over the ( using swapit to increment yields the bugged falsetrue instead of the expected value, which I suppose is (false to match the behavior of (0 and (1.

keywords: parentheses

mjbrownie commented 2 years ago

@kevinlawler Thank's. It's happening here. Fixing the behavior seems like a simple nudge if the characters are off.. but there might be side effects. seems to be ok for mid word (eg fal|se ) .

plugin/swapit.vim:336 - 350 web

            else

                "if the letter the cursor is not the first letter of the cur_word,
                " move forward to the start of the word. (see #32)
                if getline(".")[col(".") -1] != a:cur_word[0]
                    exec 'norm f' . a:cur_word[0]
                endif

                if next_word =~ '\W'
                    let in_visual = 1
                    exec 'norm! m' . temp_mark . 'viw""pg`[vg`]' . (&selection ==# 'exclusive' ? 'l' : '')
                else
                    exec 'norm! m' . temp_mark . 'viw""pg`' . temp_mark
                endif
            endif
kevinlawler commented 2 years ago

seems fixed for me