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

Reworked counsel-fzf to support ctl-u and prompt #1281

Conversation

@woodensquares
Copy link
Contributor

commented Nov 13, 2017

Resolves #1280

Besides ctrl-u I have also added support for specifying a custom prompt similarly to the other counsel- functions.

@abo-abo

This comment has been minimized.

Copy link
Owner

commented Nov 14, 2017

Thanks, since the change is above the 15 lines, it needs an Emacs Copyright Assignment. If you're willing to get it, see the README for more info.

@woodensquares

This comment has been minimized.

Copy link
Contributor Author

commented Nov 14, 2017

I should already have a copyright assignment on file, I sent you an email to discuss the details in private

counsel.el Outdated
(projectile-project-root)
(or initial-directory
default-directory)))
(ivy-set-prompt 'counsel-ag counsel-prompt-function)

This comment has been minimized.

Copy link
@jojojames

jojojames Nov 16, 2017

Contributor

Should this be counsel-fzf?

This comment has been minimized.

Copy link
@woodensquares

woodensquares Nov 16, 2017

Author Contributor

yes it should, not sure how that slipped in, thanks for the review, let me fix it

@woodensquares woodensquares force-pushed the woodensquares:issue-1280-counsel-fzf-ctl-u branch 2 times, most recently Nov 16, 2017

@woodensquares

This comment has been minimized.

Copy link
Contributor Author

commented Nov 16, 2017

actually just realized that @abo-abo had changed some logic, in the same function, let me integrate his changes

@woodensquares woodensquares force-pushed the woodensquares:issue-1280-counsel-fzf-ctl-u branch Nov 16, 2017

@woodensquares woodensquares force-pushed the woodensquares:issue-1280-counsel-fzf-ctl-u branch to 02f4449 Nov 16, 2017

@agsdot

This comment has been minimized.

Copy link

commented Nov 23, 2017

Pardon my ignorance here, but what does ctrl-u do @woodensquares ?

@agsdot

This comment has been minimized.

Copy link

commented Nov 23, 2017

Or rather how do I use ctrl-u with counsel-fzf to "to select the starting directory " ? Thanks!

@woodensquares

This comment has been minimized.

Copy link
Contributor Author

commented Nov 23, 2017

it would work similarly to say counsel-rg, you would do ctrl-u counsel-fzf, then you pick a directory, press enter, then fzf would start in the directory you chose rather than in the current directory or in the projectile project root.

@agsdot

This comment has been minimized.

Copy link

commented Nov 23, 2017

Interesting, never knew about that feature @woodensquares . I noticed though I had to drop into emacs key bindings (normally, I use evil keybindings).

@jojojames , you initially put in the counsel-fzf function, and I know that you specialize in evil keybindings (e.g. github.com/jojojames/evil-collections ), what would be a good way to use "ctrl u counsel-fzf" with evil?

@woodensquares

This comment has been minimized.

Copy link
Contributor Author

commented Nov 23, 2017

we are definitely going offtopic here :), but I think something like this should work for example to bind a "choose the directory first" counsel-rg to g in evil if you have set evil to take over ctrl-u

(evil-leader/set-key
 "g"
 (lambda ()
   (interactive)
   (let ((current-prefix-arg 4))
     (call-interactively #'counsel-rg))))
@jojojames

This comment has been minimized.

Copy link
Contributor

commented Nov 23, 2017

@agsdot Since you probably have C-u bound, you need to bind universal-argument to another key.

C-u runs the command universal-argument (found in global-map), which
is an interactive compiled Lisp function in ‘simple.el’.

It is bound to C-u.

(universal-argument)

You could also use the \ command to switch to emacs state first before triggering C-u.

\ runs the command evil-execute-in-emacs-state (found in
evil-motion-state-map), which is an interactive Lisp function in
‘evil-commands.el’.

It is bound to \.

(evil-execute-in-emacs-state)
@agsdot

This comment has been minimized.

Copy link

commented Nov 23, 2017

Interesting, @jojojames .

I'll consider doing that or binding that interactive lambda function to an evil-leader / general keybinding as @woodensquares suggested.

Thanks!

@abo-abo abo-abo closed this in b64c6e6 Nov 30, 2017

@abo-abo

This comment has been minimized.

Copy link
Owner

commented Nov 30, 2017

Merged, thanks.

@agsdot

This comment has been minimized.

Copy link

commented Dec 1, 2017

Thanks @woodensquares @jojojames @abo-abo for developing and refining the counsel-fzf function. Much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.