- starting init.el just basics (package, use-package, path-handlin) - include my-site-start.el that includes site-start.d directory and imports all *.el files in lexical order - functionality is imported via use-package inside the *.el file (first run: internet connection is needed to MELPA)
72 lines
2.4 KiB
EmacsLisp
72 lines
2.4 KiB
EmacsLisp
;;; 102-ivy-councel.el --- Completion framework for Emacs
|
|
|
|
;;; Commentary:
|
|
;; Ivy - a generic completion frontend for Emacs,
|
|
;; Swiper - isearch with an overview
|
|
;; Councel - it consumes Ivy and provides useful commands
|
|
|
|
;; Reference: https://github.com/abo-abo/swiper
|
|
;; Presentation: https://writequit.org/denver-emacs/presentations/2017-04-11-ivy.html
|
|
|
|
;;; Code:
|
|
(use-package counsel
|
|
:bind (("C-x C-f" . counsel-find-file)
|
|
("C-x C-m" . counsel-M-x)
|
|
("C-x C-f" . counsel-find-file)
|
|
("C-h f" . counsel-describe-function)
|
|
("C-h v" . counsel-describe-variable)
|
|
("M-i" . counsel-imenu)
|
|
("M-I" . counsel-imenu)
|
|
("C-c i" . counsel-unicode-char)
|
|
:map read-expression-map
|
|
("C-r" . counsel-expression-history)))
|
|
|
|
(use-package swiper
|
|
:bind (("C-s" . swiper)
|
|
("C-r" . swiper)
|
|
("C-c C-r" . ivy-resume)
|
|
:map ivy-minibuffer-map
|
|
("C-SPC" . ivy-restrict-to-matches))
|
|
:init
|
|
(ivy-mode 1)
|
|
:config
|
|
(setq ivy-count-format "(%d/%d) "
|
|
ivy-display-style 'fancy
|
|
ivy-height 4
|
|
ivy-use-virtual-buffers t
|
|
ivy-initial-inputs-alist () ;; http://irreal.org/blog/?p=6512
|
|
enable-recursive-minibuffers t))
|
|
|
|
(use-package all-the-icons)
|
|
|
|
(use-package ivy-rich
|
|
:after ivy
|
|
:config
|
|
;; All the icon support to ivy-rich
|
|
(defun ivy-rich-switch-buffer-icon (candidate)
|
|
(with-current-buffer
|
|
(get-buffer candidate)
|
|
(all-the-icons-icon-for-mode major-mode)))
|
|
|
|
(setq ivy-rich--display-transformers-list
|
|
'(ivy-switch-buffer
|
|
(:columns
|
|
((ivy-rich-switch-buffer-icon (:width 2))
|
|
(ivy-rich-candidate (:width 30))
|
|
(ivy-rich-switch-buffer-size (:width 7))
|
|
(ivy-rich-switch-buffer-indicators (:width 4 :face error :align right))
|
|
(ivy-rich-switch-buffer-major-mode (:width 12 :face warning))
|
|
(ivy-rich-switch-buffer-project (:width 15 :face success))
|
|
(ivy-rich-switch-buffer-path (:width (lambda (x) (ivy-rich-switch-buffer-shorten-path x (ivy-rich-minibuffer-width 0.3))))))
|
|
:predicate
|
|
(lambda (cand) (get-buffer cand)))))
|
|
|
|
;; Add custom icons for various modes that can break ivy-rich
|
|
(add-to-list 'all-the-icons-mode-icon-alist '(dashboard-mode all-the-icons-fileicon "elisp" :height 1.0 :v-adjust -0.2 :face all-the-icons-dsilver))
|
|
(add-to-list 'all-the-icons-mode-icon-alist '(ess-mode all-the-icons-fileicon "R" :face all-the-icons-lblue))
|
|
|
|
(ivy-rich-mode 1))
|
|
|
|
(provide '102-ivy-councel)
|
|
;;; 102-ivy-councel.el ends here
|