https://github.com/karimaziev/defun-ivy
Macros for creating custom ivy completion commands with ease.
https://github.com/karimaziev/defun-ivy
emacs ivy macro
Last synced: 3 months ago
JSON representation
Macros for creating custom ivy completion commands with ease.
- Host: GitHub
- URL: https://github.com/karimaziev/defun-ivy
- Owner: KarimAziev
- Created: 2021-04-17T07:48:35.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-01-22T21:41:07.000Z (over 1 year ago)
- Last Synced: 2025-02-25T04:13:58.417Z (7 months ago)
- Topics: emacs, ivy, macro
- Language: Emacs Lisp
- Homepage:
- Size: 22.5 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
README
#+AUTHOR: Karim Aziiev
#+EMAIL: karim.aziiev@gmail.com
#+LANGUAGE: en
#+OPTIONS: ^:nil tags:nil num:nil* About
The =defun-ivy+= macro simplifies the creation of custom commands utilizing =ivy-read= for enhanced Emacs completion experiences.
#+BEGIN_SRC emacs-lisp
(defun-ivy+ km-browse-ivy-chrome-history
:bind "C-c g h"
:collection (km-browse-init-chrome-history-candidates)
:prompt "Select history\s"
:initial-input (km-get-word-or-region)
:multi-action (lambda (marked)
(dolist (it marked)
(km-browse-action-default it)))
:actions '(("C-j" km-browse-eww-action "eww")
("RET" km-browse-action-default "chrome")
("C-c x" km-browse-xvidget-action)
("C-c k d" km-browse-download-url :no-exit))
:display-fn #'km-browse-display-fn)
#+END_SRC* Table of Contents :TOC_2_gh:QUOTE:
#+BEGIN_QUOTE
- [[#about][About]]
- [[#requirements][Requirements]]
- [[#installation][Installation]]
- [[#with-use-package-and-straightel][With use-package and straight.el]]
- [[#manual-installation][Manual installation]]
- [[#arguments][Arguments]]
- [[#customization][Customization]]
#+END_QUOTE* Requirements
| Name | Version |
|-------+---------|
| Emacs | 25.1 |* Installation
** With use-package and straight.el
#+begin_src elisp :eval no
(use-package defun-ivy+
:straight (defun-ivy+
:repo "KarimAziev/defun-ivy"
:type git
:host github))
#+end_src** Manual installation
Download the source code and put it wherever you like, e.g. into =~/.emacs.d/defun-ivy/=
#+begin_src shell :eval no
git clone https://github.com/KarimAziev/defun-ivy.git ~/.emacs.d/defun-ivy/
#+end_srcAdd the downloaded directory to the load path:
#+begin_src elisp :eval no
(add-to-list 'load-path "~/.emacs.d/defun-ivy/")
(require 'defun-ivy+)
#+end_src* Arguments
This table outlines the various keywords you can pass to =defun-ivy+= and their associated actions:
| Argument | Description |
|---------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| =:actions= | List of actions =(KEYBINDING ACTION DESCRIPTION)=. The =:no-exit= keyword can be included to call an action without exiting the minibuffer. |
| =:bind= | Global keybinding for invoking the command. |
| =:init= | Form to execute before =ivy-read=. |
| =:prompt= | String normally ending in a colon and a space. The default prompt is an empty string. |
| =:collection= | Specifies the collection for =ivy-read=. |
| ... | Additional =ivy-read= arguments like =:predicate=, =:require-match=, =:initial-input=, =:history=, =:preselect=, =:def=, =:keymap=, =:update-fn=, =:action=, =:multi-action=, =:unwind=, =:re-builder=, =:matcher=, =:dynamic-collection=, =:extra-props=, and =:sort=. |
| =:sort-fn= | Function for =ivy-configure= to sort candidates. |
| =:display-fn= | Function for =ivy-configure= to display candidates. |
| ... | Additional =ivy-configure= options like =:height=, =:exit-codes=, =:occur=, =:update-fn=, =:unwind-fn=, =:index-fn=, =:format-fn=, =:more-chars=, =:grep-p=, and =:exit-codes=. |To see the full range of arguments and their effects, consult the complete documentation within the source.
* Customization
**** ~defun-ivy-enable-imenu-support~
If non-nil, cause imenu to see =defun-ivy+= declarations. This is done by adjusting =lisp-imenu-generic-expression= to include support for finding =defun-ivy+= forms. Must be set before loading Defun-Ivye.
**** ~defun-ivy-regexp-eval~
Sexp providing regexp for finding =defun-ivy+= forms in user files. This is used by =defun-ivy-enable-imenu-support=.