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

String before prompt #2185

Closed
wants to merge 2 commits into from
Closed

String before prompt #2185

wants to merge 2 commits into from

Conversation

takaxp
Copy link
Contributor

@takaxp takaxp commented Aug 5, 2019

Hi!

I've attempted to integrate an icon and a separator before the ivy prompt.
I added a new custom variable to control the appearance.

(Setup)

  1. User can implement a function that will return a string
  2. Set the function to ivy-pre-prompt-function defined as a new custom variable in this PR

(Example code: depends on all-the-icons.el)

(defun my-pre-prompt-function ()
      (if window-system
          (format "%s\n%s "
                  (make-string (frame-width) ?\x5F) ;; "__"
                  (all-the-icons-faicon "sort-amount-asc"))
        (format "%s\n" (make-string (1- (frame-width)) ?\x2D))))
(setq ivy-pre-prompt-function #'my-pre-prompt-function)

(Result)
Screen Shot 2019-08-06 at 0 57 27

What do you think?

@abo-abo
Copy link
Owner

@abo-abo abo-abo commented Aug 7, 2019

Thanks, merged with minor changes. Please review.

@takaxp
Copy link
Contributor Author

@takaxp takaxp commented Aug 7, 2019

Verified, thank you for simplifying the code and merge :)

@ambihelical
Copy link
Contributor

@ambihelical ambihelical commented Aug 10, 2019

This is a very nice addition, thanks @takaxp and @abo-abo . I'm currently binding this to ivy-action-name, so it shows the current action. Along with some ivy-next/prev-action bindings this makes it very ergonomic to select the action.

astoff pushed a commit to astoff/swiper that referenced this issue Jan 1, 2021
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

3 participants