tommcdo / vim-exchange

Easy text exchange operator for Vim
MIT License
756 stars 23 forks source link

The example in the help doc isn't working #2

Closed mwcz closed 10 years ago

mwcz commented 10 years ago

I love the idea for the plugin, but I'm having a hard time getting it to work. I'm attempting to do this example found in :help exchange:

In the text below, we will exchange everything inside the parentheses with
everything inside the double quotes.

    Tom "a Vim plugin developer" McDonald (The Dev)

First, place your cursor somewhere inside the quoted string and type `cxi"`.
Then move your cursor to somewhere inside the parentheses and type `cxi)`. The
text will the be changed to:

    Tom "The Dev" McDonald (a Vim plugin developer)

It should be noted that I don't actually go by that nickname.

But it isn't working for me. Here are my exact keystrokes, starting from the command line:

vim<CR>:help exchange<CR>/plugin dev<CR>cxi"fDcxi)

Result: Exchange aborted: overlapping text

tommcdo commented 10 years ago

I'll look into this. Just implemented overlap detection today and haven't had a lot of time to test it. Looks like a lot of stuff is broken, actually. Bad timing for that Reddit post :P

mwcz commented 10 years ago

I'm patient!

tommcdo commented 10 years ago

I was able to duplicate this problem once, and then never again. I'm a little stumped.

It may have to do with an exchange region already being defined; Try clearing it (if any) with cxc first before trying again.

Also, I haven't considered how it works in a read-only buffer (as the help page would be). Does it work in a regular buffer?

wellle commented 10 years ago

Works for me in the help file after :set modifiable.

tommcdo commented 10 years ago

@mwcz, any chance you had set ignorecase in your vimrc? Turns out that applies to the == operator as well (see #4).

Let me know if you're still having the problem after pulling in the latest changes.

mwcz commented 10 years ago

@tommcdo Nice! I do have set ignorecase. You're like a prophet.

I pulled the latest changes and the example works now. :+1: