Christopher James Hayward
4 years ago
4 changed files with 111 additions and 148 deletions
@ -1,147 +0,0 @@ |
|||||
#+TITLE: Interface |
|
||||
#+AUTHOR: Christopher James Hayward |
|
||||
#+EMAIL: chris@chrishayward.xyz |
|
||||
|
|
||||
#+PROPERTY: header-args:emacs-lisp :tangle interface.el :comments org |
|
||||
#+PROPERTY: header-args:shell :tangle no |
|
||||
#+PROPERTY: header-args :results silent :eval no-export :comments org |
|
||||
|
|
||||
#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil |
|
||||
#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil |
|
||||
|
|
||||
#+ATTR_ORG: :width 420px |
|
||||
#+ATTR_HTML: :width 420px |
|
||||
#+ATTR_LATEX: :width 420px |
|
||||
[[../docs/images/what-is-emacs-teaser.png]] |
|
||||
|
|
||||
*Bring Emacs out of the eighties* |
|
||||
|
|
||||
* Menu completion |
|
||||
|
|
||||
There's a lot of occasions Emacs asks to input text to match a file name in a directory, just one example of an oppertunity for a completion system. *Swiper*[fn:1] is a family of packages that work towards this common goal in Emacs. |
|
||||
|
|
||||
** Selection menu |
|
||||
|
|
||||
*Ivy*[fn:1] is a powerful selection menu for Emacs. |
|
||||
|
|
||||
#+begin_src emacs-lisp |
|
||||
(use-package ivy |
|
||||
:diminish |
|
||||
:config (ivy-mode 1)) |
|
||||
#+end_src |
|
||||
|
|
||||
** Frame transparency |
|
||||
|
|
||||
TODO |
|
||||
|
|
||||
#+begin_src emacs-lisp |
|
||||
(defun dotfiles/toggle-transparency () |
|
||||
(interactive) |
|
||||
(let ((alpha (frame-parameter nil 'alpha))) |
|
||||
(set-frame-parameter nil 'alpha |
|
||||
(if (eql (cond ((numberp alpha) alpha) |
|
||||
((numberp (cdr alpha)) (cdr alpha)) |
|
||||
((numberp (cadr alpha)) (cadr alpha))) |
|
||||
100) |
|
||||
'(85 . 50) '(100 . 100))))) |
|
||||
#+end_src |
|
||||
|
|
||||
Toggle frame transparency with =SPC t r=. |
|
||||
|
|
||||
#+begin_src emacs-lisp |
|
||||
(dotfiles/leader |
|
||||
"tr" '(dotfiles/toggle-transparency :which-key "Toggle transparency")) |
|
||||
#+end_src |
|
||||
|
|
||||
Enable frame transparency by default. |
|
||||
|
|
||||
#+begin_src emacs-lisp |
|
||||
(set-frame-parameter (selected-frame) 'alpha '(85 . 50)) |
|
||||
(add-to-list 'default-frame-alist '(alpha . (85 . 50))) |
|
||||
#+end_src |
|
||||
|
|
||||
** Popup selection frame |
|
||||
|
|
||||
+ Display =ivy= completions in a popup buffer |
|
||||
+ Set ~parent-frame~ to =nil= for [[file:desktop.org][Desktop]] support |
|
||||
|
|
||||
#+begin_src emacs-lisp |
|
||||
(use-package ivy-posframe |
|
||||
:after ivy |
|
||||
:when (window-system) |
|
||||
:custom (ivy-posframe-display-functions-alist '((t . ivy-posframe-display))) |
|
||||
(ivy-posframe-parameters '((parent-frame nil))) |
|
||||
:config (ivy-posframe-mode 1)) |
|
||||
#+end_src |
|
||||
|
|
||||
** Replace built in commands |
|
||||
|
|
||||
*Counsel*[fn:1] is a customized set of commands to replace built in completion buffers. |
|
||||
|
|
||||
#+begin_src emacs-lisp |
|
||||
(use-package counsel |
|
||||
:after ivy |
|
||||
:custom (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only) |
|
||||
:config (counsel-mode 1)) |
|
||||
#+end_src |
|
||||
|
|
||||
*** Switch buffers with , |
|
||||
|
|
||||
Cherry picked from =doom=. |
|
||||
|
|
||||
#+begin_src emacs-lisp |
|
||||
(dotfiles/leader |
|
||||
"," '(counsel-switch-buffer :which-key "Buffers")) |
|
||||
#+end_src |
|
||||
|
|
||||
** Additional details |
|
||||
|
|
||||
Provide more information about each item in the completion menu with *Ivy rich*[fn:2]. |
|
||||
|
|
||||
#+begin_src emacs-lisp |
|
||||
(use-package ivy-rich |
|
||||
:after counsel |
|
||||
:init (ivy-rich-mode 1)) |
|
||||
#+end_src |
|
||||
|
|
||||
** Candidate sorting |
|
||||
|
|
||||
Sort completion candidates based on how recently or frequently they're selected. This can be helpful when using =M-x= to run commands that aren't bound to specific key-strokes. |
|
||||
|
|
||||
#+begin_src emacs-lisp |
|
||||
(use-package ivy-prescient |
|
||||
:after counsel |
|
||||
:custom (ivy-prescient-enable-filtering nil) |
|
||||
:config (prescient-persist-mode 1) |
|
||||
(ivy-prescient-mode 1)) |
|
||||
#+end_src |
|
||||
|
|
||||
* Footnotes |
|
||||
|
|
||||
[fn:1] https://github.com/abo-abo/swiper |
|
||||
|
|
||||
[fn:2] https://github.com/Yevgnen/ivy-rich |
|
||||
|
|
||||
[fn:3] [[https://github.com/domtronn/all-the-icons.el]] |
|
||||
|
|
||||
[fn:4] https://github.com/jtbm37/all-the-icons-dired |
|
||||
|
|
||||
[fn:5] https://emacswiki.org/emacs/pretty-mode.el |
|
||||
|
|
||||
[fn:6] https://emacswiki.org/emacs/PrettySymbol |
|
||||
|
|
||||
[fn:7] https://github.com/jming422/fira-code-mode |
|
||||
|
|
||||
[fn:8] https://github.com/iqbalansari/emacs-emojify |
|
||||
|
|
||||
[fn:9] https://github.com/hlissner/emacs-doom-themes |
|
||||
|
|
||||
[fn:10] https://github.com/seagle0128/doom-modeline |
|
||||
|
|
||||
[fn:11] https://github.com/Fanael/rainbow-delimiters |
|
||||
|
|
||||
[fn:12] https://github.com/integral-dw/org-superstar-mode |
|
||||
|
|
||||
[fn:13] https://github.com/emacs-dashboard/emacs-dashboard |
|
||||
|
|
||||
[fn:14] https://github.com/emacsmirror/linum-relative |
|
@ -0,0 +1,80 @@ |
|||||
|
#+TITLE: Ivy |
||||
|
#+AUTHOR: Christopher James Hayward |
||||
|
#+EMAIL: chris@chrishayward.xyz |
||||
|
|
||||
|
#+PROPERTY: header-args:emacs-lisp :tangle ivy.el :comments org |
||||
|
#+PROPERTY: header-args:shell :tangle no |
||||
|
#+PROPERTY: header-args :results silent :eval no-export :comments org |
||||
|
|
||||
|
#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil |
||||
|
#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil |
||||
|
|
||||
|
Bring Emacs out of the eighties. |
||||
|
|
||||
|
* Config |
||||
|
|
||||
|
There's a lot of occasions where Emacs asks you to input text to match a file name in a directory, or of a potential buffer selection. The family of packages ~ivy/swiper~[fn:1] work together toward this common goal of improving the default completion menu system. |
||||
|
|
||||
|
#+begin_src emacs-lisp |
||||
|
(use-package ivy |
||||
|
:diminish |
||||
|
:config (ivy-mode 1)) |
||||
|
#+end_src |
||||
|
|
||||
|
** Replacements |
||||
|
|
||||
|
Include ~counsel~[fn:2], a customized set of commands to replace the built-in completion buffers. This will provide an experience similar to what you've maybe experienced on ~doom~ or ~spacemacs~. |
||||
|
|
||||
|
#+begin_src emacs-lisp |
||||
|
(use-package counsel |
||||
|
:after ivy |
||||
|
:custom (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only) |
||||
|
:config (counsel-mode 1)) |
||||
|
#+end_src |
||||
|
|
||||
|
** Additional details |
||||
|
|
||||
|
Provide more information about each item in the completion menu with ~ivy-rich~[fn:3]. This will include snippets from any available documentation, or active buffers. |
||||
|
|
||||
|
#+begin_src emacs-lisp |
||||
|
(use-package ivy-rich |
||||
|
:after counsel |
||||
|
:init (ivy-rich-mode 1)) |
||||
|
#+end_src |
||||
|
|
||||
|
** Popup selection frame |
||||
|
|
||||
|
Display ~ivy~[fn:1] completions in a popup buffer with the ~ivy-posframe~[fn:4] package. I prefer to use this since the menu appears in the center of my screen, stopping my from having to tilt my head to look down at the default completion menu appearing in the mini-buffer. |
||||
|
|
||||
|
#+begin_src emacs-lisp |
||||
|
(use-package ivy-posframe |
||||
|
:after ivy |
||||
|
:when (window-system) |
||||
|
:custom (ivy-posframe-display-functions-alist '((t . ivy-posframe-display))) |
||||
|
(ivy-posframe-parameters '((parent-frame nil))) |
||||
|
:config (ivy-posframe-mode 1)) |
||||
|
#+end_src |
||||
|
|
||||
|
** Candidate selection sorting |
||||
|
|
||||
|
Sort completion candidates based on how recently or frequently they're selected with ~prescient.el~[fn:5]. This can be helpful when using =M-x= to run commands that aren't bound to specific key-strokes. |
||||
|
|
||||
|
#+begin_src emacs-lisp |
||||
|
(use-package ivy-prescient |
||||
|
:after counsel |
||||
|
:custom (ivy-prescient-enable-filtering nil) |
||||
|
:config (prescient-persist-mode 1) |
||||
|
(ivy-prescient-mode 1)) |
||||
|
#+end_src |
||||
|
|
||||
|
* Footnotes |
||||
|
|
||||
|
[fn:1] https://github.com/abo-abo/swiper |
||||
|
|
||||
|
[fn:2] https://libraries.io/emacs/counsel |
||||
|
|
||||
|
[fn:3] https://github.com/Yevgnen/ivy-rich |
||||
|
|
||||
|
[fn:4] https://github.com/tumashu/ivy-posframe |
||||
|
|
||||
|
[fn:5] https://github.com/raxod502/prescient.el |
Write
Preview
Loading…
Cancel
Save
Reference in new issue