spacemacs icon indicating copy to clipboard operation
spacemacs copied to clipboard

Make `lazy-helm/spacemacs/helm-jump-in-buffer` work with `evil-jump-backward`

Open fleimgruber opened this issue 2 years ago • 10 comments

As in subject, doing an evil-jump-backward with C-o after a lazy-helm/spacemacs/helm-jump-in-buffer with SPC s j does not jump back to the position curser was on before helm-jumping, but to any other buffer position evil-jump remembers (usually very old and unrelated or from a few movements in the past). Are users supposed to use a different command combination for this functionality?

fleimgruber avatar Sep 18 '22 11:09 fleimgruber

https://github.com/syl20bnr/spacemacs/blob/3ba43e29165fb17d39baab528d63a63e907fa81a/layers/%2Bcompletion/helm/funcs.el#L566

only does jumping but doesn't try to remember the last position before jumping...

lebensterben avatar Sep 18 '22 14:09 lebensterben

Thanks for the quick reply! I see, so what is the recommendation for "evilifying" *-jump and other commands to make them work more nicely with C-o & C-i? The latter two are etched into my nervous system. Or is there a more Spacemacs-ish way of going back to last cursor position?

fleimgruber avatar Sep 18 '22 14:09 fleimgruber

this command needs to remember the position... that's it

lebensterben avatar Sep 18 '22 14:09 lebensterben

Oh, I misread your comment then. It sounded to me as if you were saying that spacemacs/helm-jump-in-buffer does what it should, i.e. that it is supposed to not remember the last position, but to jump only. And that remembering the position should be solved on user side, e.g. with the advice system (or similar).

fleimgruber avatar Sep 18 '22 15:09 fleimgruber

Related: #9451

pataquets avatar Nov 07 '22 20:11 pataquets

Oh, I misread your comment then. It sounded to me as if you were saying that spacemacs/helm-jump-in-buffer does what it should, i.e. that it is supposed to not remember the last position, but to jump only. And that remembering the position should be solved on user side, e.g. with the advice system (or similar).

I got confused by this conversation too.

Here is how I solve this:

(evil-add-command-properties #'spacemacs/helm-jump-in-buffer :jump t)

Since evil has provided a simple mechanism to do this, no need to write an advice. Not sure if evil-define-motion will be better.

xuan-w avatar May 03 '23 20:05 xuan-w

this is really a neat solution.

lebensterben avatar May 03 '23 23:05 lebensterben

Here is how I solve this:

(evil-add-command-properties #'spacemacs/helm-jump-in-buffer :jump t)

This looks really nice, but does not work for me. Previous helm-jump-in-buffer locations are not visited by evil-jump-backward.

edit: My bad, it works with (evil-add-command-properties #'lazy-helm/spacemacs/helm-jump-in-buffer :jump t)

fleimgruber avatar May 04 '23 15:05 fleimgruber

@lebensterben although this is labelled "Feature request", would the "Found work-around" label make sense?

fleimgruber avatar May 04 '23 15:05 fleimgruber

Please note that the actual jump function you are using might have changed in the meantime, e.g.:

(evil-add-command-properties #'spacemacs/consult-jump-in-buffer :jump t)

fleimgruber avatar May 01 '24 17:05 fleimgruber