emacsorphanage / helm-swoop

Efficiently hopping squeezed lines powered by Emacs helm interface
GNU General Public License v3.0
689 stars 55 forks source link

replace isearch with helm-swoop #91

Closed xin-jin closed 8 years ago

xin-jin commented 8 years ago

Hi,

I know it has been mentioned several times in issues, and I understand that I can configure the pre-input to change the default behavior. But is it possible to just implement something like helm-swoop-without-pre-input (with behavior just like helm-occur)? I would like to keep both the no-pre-input (to replace isearch) version and the currently default one, and thus doesn't want to change the pre-input-fucntion.

Thanks!

jeberger commented 8 years ago

Note that if you disable pre-input, you can always use C-w to yank the word at point into the input (similar to helm-occur), which should give you what you want:

See also #90.

xin-jin commented 8 years ago

@jeberger But C-s C-w is two keys. I am not sure how to combine these two functions together into a function (as C-w applies to the Helm Swoop buffer)?

ShingoFukuyama commented 8 years ago

How about this? Overriding helm-swoop-without-pre-input only within the function.

(defun helm-swoop-with-no-query ()
  (interactive)
  (let ((_helm-swoop-pre-input-function helm-swoop-pre-input-function))
    (unwind-protect
        (progn
          (setq helm-swoop-pre-input-function (lambda () nil))
          (helm-swoop))
      (setq helm-swoop-pre-input-function _helm-swoop-pre-input-function))))
xin-jin commented 8 years ago

@ShingoFukuyama Thanks, this seems to work great! Would you mind incorporating it into the package?

xin-jin commented 8 years ago

Moreover, one nice feature of helm-occur is that when we hit RET, the line we select will flash for half-second so that we know exactly where we are. This is actually very useful, since my cursor is only a vertical line, because of which I always need to spend some time looking for where I am when the search buffer window quits.

Possible to implement this?

ShingoFukuyama commented 8 years ago

I added helm-swoop-without-pre-input.

ShingoFukuyama commented 8 years ago

helm-swoop always highlighting the target line and words both on buffers, as long as your face/color settings are correct.

xin-jin commented 8 years ago

@ShingoFukuyama Thanks for adding the function!

No, I didn't mean the highlighting when helm-swoop is on. I meant the "flash highlighting" on the target line in the original buffer after the helm occur buffer closes (when I hit RET on the selected line). You can try running helm-occur, and you'll see.

ShingoFukuyama commented 8 years ago

I understood what you meant to do. The feature works in the latest update.

xin-jin commented 8 years ago

Thanks! It works perfectly now.