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

@woodensquares woodensquares 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
Copy link
Owner

@abo-abo abo-abo 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
Copy link
Contributor Author

@woodensquares woodensquares 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)
Copy link
Contributor

@jojojames jojojames Nov 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be counsel-fzf?

Copy link
Contributor Author

@woodensquares woodensquares Nov 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@woodensquares woodensquares force-pushed the issue-1280-counsel-fzf-ctl-u branch 2 times, most recently from ccc3306 to f13a2ed Compare Nov 16, 2017
@woodensquares
Copy link
Contributor Author

@woodensquares woodensquares 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 issue-1280-counsel-fzf-ctl-u branch from f13a2ed to a6574f0 Compare Nov 16, 2017
@woodensquares woodensquares force-pushed the issue-1280-counsel-fzf-ctl-u branch from a6574f0 to 02f4449 Compare Nov 16, 2017
@agsdot
Copy link

@agsdot agsdot commented Nov 23, 2017

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

@agsdot
Copy link

@agsdot agsdot commented Nov 23, 2017

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

@woodensquares
Copy link
Contributor Author

@woodensquares woodensquares 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
Copy link

@agsdot agsdot 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
Copy link
Contributor Author

@woodensquares woodensquares 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
Copy link
Contributor

@jojojames jojojames 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
Copy link

@agsdot agsdot 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
Copy link
Owner

@abo-abo abo-abo commented Nov 30, 2017

Merged, thanks.

@agsdot
Copy link

@agsdot agsdot 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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants