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

Allow all evilem motions push position onto the jump list #29

Closed
sooheon opened this issue Apr 11, 2016 · 4 comments
Closed

Allow all evilem motions push position onto the jump list #29

sooheon opened this issue Apr 11, 2016 · 4 comments

Comments

@sooheon
Copy link

sooheon commented Apr 11, 2016

Currently, issuing an evil-em movement does not work seamlessly with the jump list. If I have points A B and C in the buffer, and I moved from A to B with a regular evil motion, then jump from B to C with evil-em, C-o will take me to A, not B. Neither can I jump back to C with C-i.

Adding (evil--jumps-push) to both :pre-hook and :post-hook solves the issue. Do you think it's worth making this a default?

@PythonNut
Copy link
Owner

Adding (evil--jumps-push) to both :pre-hook and :post-hook solves the issue. Do you think it's worth making this a default?

I'm not sure. I generally use C-i and C-o for jumps beyond the visible portion of the buffer. Do you think this would be a good default? I tend to think that most motions do not move far enough to warrant an item in the jump list.

@sooheon
Copy link
Author

sooheon commented Apr 11, 2016

Hm, I was under the impression that in vim, search motions like f/t were added to the jumplist. I was wrong, so I agree it makes sense not to have this behaviour default. It's strange that every snipe motion pushes to jumplist then--I'll raise the issue over there.

@braham-snyder
Copy link

braham-snyder commented Dec 4, 2016

I like being able to use C-o (and C-i) to always jump back to where I was, without having to remember to add a mark beforehand or worry about how I left or arrived somewhere.

Obviously understandable if you don't want to make it a default, but for what it's worth, the vim version adds to the jumplist: easymotion/vim-easymotion#36

e: for both feedback and posterity, this is where I've put the calls to evil--jumps-push:

(cl-defmacro evilem-make-motion (name
                                 funcs
                                 &key
                                 pre-hook
                                 post-hook
                                 bind
                                 scope
                                 all-windows
                                 initial-point
                                 collect-postprocess)
  "Automatically define an evil easymotion for `func', naming it `name'"
  `(,(if all-windows
         'evil-define-command
       'evil-define-motion)
    ,name (&optional _count)
    (require 'avy)
    (avy-with ,name
      (evil-without-repeat
        (setq evil-this-type 'inclusive)
        (cl-letf* ,bind
          (evil--jumps-push)
          ,(when pre-hook `(funcall ,(if (functionp pre-hook)
                                         pre-hook
                                       `(lambda () ,pre-hook))))
          (evilem--jump (evilem--collect ,funcs
                                         ,scope
                                         ,all-windows
                                         ,initial-point
                                         ,collect-postprocess))
          ,(when post-hook `(funcall ,(if (functionp post-hook)
                                          post-hook
                                        `(lambda () ,post-hook))))
          (evil--jumps-push)
          )))))

@PythonNut
Copy link
Owner

@braham-snyder oh sorry, I must have missed this. Having had more time with evil-easymotion, I think this would be a good default behavior.

@PythonNut PythonNut reopened this Jan 11, 2017
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

No branches or pull requests

3 participants