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

Pre-select the pre-input so that it can be clear immediately by any new input #118

Open
ahlearn opened this issue Aug 12, 2017 · 8 comments

Comments

@ahlearn
Copy link

ahlearn commented Aug 12, 2017

Similar to many other softwares (e..g, Chrome), when we initiate word search by Ctrl-F, the pre-input is pre-selected so that we can replace it by simply typing a new keyword, or append new string to it by first pressing right-arrow key. Can we have the same behavior in helm-swoop? Thanks.

@ahlearn ahlearn changed the title Shift-select pre-input so that it can be clear immediately by any new input Pre-select the pre-input so that it can be clear immediately by any new input Nov 6, 2017
@ahlearn
Copy link
Author

ahlearn commented May 7, 2018

I achieved it by adding following hook:

(defun my-minibuffer-setup-hook ()
;; select input string (if any).
(setq this-command-keys-shift-translated t)
(handle-shift-selection)
(beginning-of-line)
)
(add-hook 'minibuffer-setup-hook #'my-minibuffer-setup-hook)

@ahlearn ahlearn closed this as completed May 7, 2018
@rileyrg
Copy link

rileyrg commented Dec 23, 2019

This ought to be the default behaviour of all such helm input buffers. I would suggest reopening.

@conao3 conao3 reopened this Dec 24, 2019
@conao3
Copy link
Collaborator

conao3 commented Dec 24, 2019

OK.
@rileyrg, the default behaviour of all such helm input buffers is what?
I usually use ivy, I have not familiar with helm. What concrete helm function works like that, please listing?

@cireu
Copy link
Collaborator

cireu commented Dec 24, 2019

@rileyrg You'd better open a feature request in helm's issue tracking system to achieve this goal. Because helm-swoop is specialized for buffer searching.

@cireu
Copy link
Collaborator

cireu commented Dec 24, 2019

I usually use ivy, I have not familiar with helm. What concrete helm function works like that, please listing?

I guess he want a flex placeholder for minibuffer.

@conao3
Copy link
Collaborator

conao3 commented Dec 24, 2019

Thanks. Anyway, any change with breakage hard to merge to master.
If user customization can satisfy your requirements, we would be glad if you could respond there.

@rileyrg
Copy link

rileyrg commented Dec 24, 2019 via email

@conao3
Copy link
Collaborator

conao3 commented Dec 25, 2019

May this configure helps you?

;; If a symbol or phrase is selected, use it as the initial query.
(setq helm-swoop-pre-input-function
      (lambda ()
        (if mark-active
            (buffer-substring-no-properties (mark) (point))
          "")))

This pre-input-function fill selected string if mark active.
If you search for something you want, deactivate the mark and launch helm-swoop.

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

No branches or pull requests

4 participants