An open API service indexing awesome lists of open source software.

https://github.com/karimaziev/ivy-extra

Extends ivy-read.
https://github.com/karimaziev/ivy-extra

emacs ivy ivyhacks

Last synced: 7 months ago
JSON representation

Extends ivy-read.

Awesome Lists containing this project

README

          

* ivy-extra

Functions and commands that extends ~ivy-read~.

** Requirements

+ Emacs >= 27.1
+ ivy

** Installation

*** Manually

Download repository and it to your load path in your init file:

#+begin_src elisp :eval no

(add-to-list 'load-path "/path/to/ivy-extra)

(require 'ivy-extra)

#+end_src

*** With use-package and straight

#+begin_src elisp :eval no
(use-package ivy-extra
:straight (ivy-extra
:repo "KarimAziev/ivy-extra"
:type git
:host github)
:commands (ivy-extra-read-multi
ivy-extra-read))
#+end_src

** Commands

*** ~ivy-extra-read-multi~ (prompt collection &rest ivy-args)
Read ~collection~ with ~prompt~ and return list with selected candidates. ~ivy-args~ are combined args both from ~ivy-read~ and ~ivy-configure~, excluding:
- =:action=
- =:multi-action=
- =:caller=
but accepting:
- =:persistent-action= - a function to call with current candidate without exiting minibuffer
- =:premarked= - candidates from ~collection~ which should be initially marked.

*Usage example*:
#+begin_src elisp
(ivy-extra-read-multi "My prompt" '("a" "b" "c")
:display-transformer-fn (lambda (it) (concat it "- my suffix")))
#+end_src

*** ~ivy-extra-read~ (prompt collection &rest ivy-args)
Configure and call ~ivy-read~ with ~prompt,~ ~collection~ and ~ivy-args.~ ~ivy-args~ are combined args both from ~ivy-read~ and ~ivy-configure,~ excluding caller.

For example with plain ~ivy-read~ and ~ivy-configure~ you would write something like:

#+begin_src elisp
(defun my-completion-read ()
(interactive)
(ivy-read "My prompt"
'("a" "b" "c")))

(ivy-configure 'my-completion-read
:display-transformer-fn (lambda (it) (concat it "- my suffix")))
#+end_src

And with ~ivy-extra-read~:

#+begin_src emacs-lisp
(defun my-completion-read ()
(ivy-extra-read "My prompt" '("a" "b" "c")
:display-transformer-fn (lambda (it) (concat it "- my suffix"))))
#+end_src