Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tpope/vim-repeat compatibility #32

Merged
merged 1 commit into from
Jan 11, 2015
Merged

Conversation

wilywampa
Copy link
Contributor

No description provided.

@tommcdo
Copy link
Owner

tommcdo commented Jan 11, 2015

Exchange repeats naturally. Can you give more detail about what this is doing?

@wellle
Copy link
Contributor

wellle commented Jan 11, 2015

@tommcdo: I noticed some issues from time to time too. This PR could fix them.

Here's an example:

before

foo
bar

With the surround plugin, type yssb to surround the first lines in parentheses. Pressing . will repeat it to ((foo)). Not press cxx to mark the current line for exchange. Pressing . on the second line should finish the exchange, but it will surround the second line instead:

after

((foo))
(bar)

expected

bar
((foo))

@tommcdo
Copy link
Owner

tommcdo commented Jan 11, 2015

Interesting... I'm curious about what's going on here, but for now I'll merge this in.

tommcdo added a commit that referenced this pull request Jan 11, 2015
Add tpope/vim-repeat compatibility
@tommcdo tommcdo merged commit 5cb2a37 into tommcdo:master Jan 11, 2015
@wilywampa
Copy link
Contributor Author

Sure. When calling repeat#set(), vim-repeat saves the value of b:changedtick in g:repeat_tick. The next time . is pressed, vim-repeat checks if b:changedtick has incremented since being saved to g:repeat_tick. If it has, then it assumes that no repeatable action has occurred since repeat#set() was called and it repeats what is in g:repeat_sequence, otherwise it uses Vim's . functionality.

The problem addressed in this PR is that if the action before using Exchange was saved in vim-repeat and then Exchange is used for the first half of an exchange, b:changedtick is not incremented so when the user pressed . vim-repeat fires off g:change_sequence instead of letting Vim repeat the Exchange action. Calling repeat#invalidate() resets g:repeat_tick so that vim-repeat knows it should let Vim do its thing instead of using g:repeat_sequence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants