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

[evil-mc] Disable paste transient state when multiple cursors are active #8620

Closed

Conversation

korayal
Copy link
Contributor

@korayal korayal commented Mar 31, 2017

As discussed at gabesoft/evil-mc#53 evil-mc has no support for the 'paste transient state', hence we should fall back to the default version of paste when multiple cursors are active.

@korayal korayal force-pushed the evil-mc-disable-paste-transient-state branch 2 times, most recently from 970efa6 to 69f22f8 Compare April 2, 2017 15:52
@bmag
Copy link
Collaborator

bmag commented Apr 4, 2017

Won't it be more robust to write a function that calls either spacemacs/paste-transient-state/evil-paste-* or evil-paste-* depending on evil-mc's state, and bind that to p/P instead of spacemacs/paste-transient-state/evil-paste-*?

@korayal
Copy link
Contributor Author

korayal commented Apr 4, 2017

@bmag I'm sorry I couldn't get my mind around your suggestion, doesn't spacemacs-evil/evil-mc-set-paste do that?

or, are you suggesting that I should use something other than evil-mc-before-cursors-created hooks?

edit: ok, I think I get it. will send a new commit.

@korayal
Copy link
Contributor Author

korayal commented Apr 4, 2017

Am I doing something wrong here?

I am able to get the right command called on both cases, but paste doesn't work on all cursors.

      (defun spacemacs-evil/evil-mc-paste-after ()
        (interactive)
        (if (and (eq (evil-mc-get-cursor-count) 1) dotspacemacs-enable-paste-transient-state)
          (call-interactively 'spacemacs/paste-transient-state/evil-paste-after)
          (call-interactively 'evil-paste-after)))

      (defun spacemacs-evil/evil-mc-paste-before ()
        (interactive)
        (if (and (eq (evil-mc-get-cursor-count) 1) dotspacemacs-enable-paste-transient-state)
          (call-interactively 'spacemacs/paste-transient-state/evil-paste-before)
          (call-interactively 'evil-paste-before)))

      (define-key evil-normal-state-map "p" 'spacemacs-evil/evil-mc-paste-after)
      (define-key evil-normal-state-map "P" 'spacemacs-evil/evil-mc-paste-before)

@korayal
Copy link
Contributor Author

korayal commented Apr 5, 2017

updated the PR, but it will also require the PR at evil-mc to be accepted before proceeding.

@korayal korayal force-pushed the evil-mc-disable-paste-transient-state branch from 6d37494 to aec756e Compare April 7, 2017 10:38
evil-mc has no support for the 'paste transient state', hence we should fall back
to the default version during that period.
@korayal korayal force-pushed the evil-mc-disable-paste-transient-state branch from aec756e to c15cc87 Compare April 9, 2017 21:34
@korayal
Copy link
Contributor Author

korayal commented Apr 9, 2017

If there is nothing else, the mentioned PR from evil-mc lib is merged, so this is also ready to go.

@syl20bnr syl20bnr self-assigned this Apr 10, 2017
@syl20bnr
Copy link
Owner

Thank you ! 👍
Warning I renamed the functions in commit fed06956
Please adjust the function names accordingly upstream.
Cherry-picked into develop branch, you can safely delete your branch.

@syl20bnr syl20bnr closed this Apr 10, 2017
@syl20bnr syl20bnr removed the Merged label Apr 10, 2017
korayal added a commit to korayal/evil-mc that referenced this pull request Apr 10, 2017
As per request from syl20bnr/spacemacs#8620 the function names were renamed from
`spacemacs-evil/evil-mc-paste-*` to `spacemacs/evil-mc-paste-*`
@korayal korayal deleted the evil-mc-disable-paste-transient-state branch April 10, 2017 06:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants