Replaced ido with ivy.

This commit is contained in:
tastytea 2019-07-28 05:58:13 +02:00
parent a4ad1f7f7d
commit 9f0c99fac1
2 changed files with 65 additions and 30 deletions

93
init.el
View File

@ -1,5 +1,5 @@
;;; init.el --- tastytea's Emacs init file.
;; Time-stamp: <2019-07-27T06:30:53+00:00>
;; Time-stamp: <2019-07-28T03:55:07+00:00>
;;; Commentary:
;; I am using this file with Emacs 26, but most of it will probably work with
@ -100,9 +100,10 @@
(mouse-wheel-scroll-amount '(1 ((shift) . 1))) ; Scroll 1 line at a time.
;; Paste text where the cursor is, not where the mouse is.
(mouse-yank-at-point t)
(initial-scratch-message nil) ; Make scratch buffer empty,
(initial-major-mode 'markdown-mode) ; and select mode.
(require-final-newline t) ; Always add newline at end of file.
(initial-scratch-message nil) ; Make scratch buffer empty,
(initial-major-mode 'markdown-mode) ; and select mode.
(require-final-newline t) ; Always add newline at end of file.
(recentf-max-saved-items 40) ; Keep this number of buffers in history.
:config
(defalias 'yes-or-no-p 'y-or-n-p) ; Just type y/n instead of yes/no.
@ -261,7 +262,7 @@ With argument, do this that many times."
;; Automatic project management.
(unless slow-computer
(use-package projectile
:after neotree
:after (neotree ivy)
:init
(defun my/projectile-kill-buffers ()
"Kill project buffers and hide neotree."
@ -277,6 +278,7 @@ With argument, do this that many times."
(projectile-project-configure-cmd
"cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-GUnix\\ Makefiles ..")
(projectile-completion-system 'ivy)
:config
(setq projectile-project-compilation-cmd
(concat my/cmake-compile-command " && cd tests && ctest -Q"))
@ -332,19 +334,22 @@ With argument, do this that many times."
;; Tries to find points of interest and jumps to them.
(use-package imenu-anywhere
:after ido-completing-read+
:after ivy
:bind
("M-i" . imenu-anywhere))
("M-i" . ivy-imenu-anywhere)
)
(use-package highlight-doxygen
:custom-face
(highlight-doxygen-comment ((t (:inherit font-lock-comment-face
:foreground "#667788"))))
:foreground "#667788"))))
(highlight-doxygen-code-block ((t (:inherit highlight-doxygen-comment-face))))
:hook
(prog-mode . highlight-doxygen-mode))
(use-package dumb-jump
:custom
(dumb-jump-selector 'ivy)
:bind
("M-." . dumb-jump-go)
("M-," . dumb-jump-back))
@ -514,30 +519,60 @@ With argument, do this that many times."
("C-x M-g" . magit-dispatch)
))
;; Interactive substring matching.
(use-package ido
:defer 5
:config
(ido-mode t)
(ido-everywhere t))
;; Flexible matching for ido.
(use-package flx-ido
:after ido
;; Completion in many Emacs commands.
(use-package ivy
:custom
(ido-enable-flex-matching t)
(ido-ignore-extensions t) ; Ignore extension like ~ and .o.
(ido-use-virtual-buffers t) ; Use history of recently opened buffers.
(recentf-max-saved-items 40) ; Keep this number of buffers in history.
(ivy-use-virtual-buffers t)
(ivy-count-format "[%d/%d] ")
:config
(flx-ido-mode t))
(ivy-mode 1)
)
;; Replaces stock emacs completion with ido completion wherever it is possible.
(unless slow-computer
(use-package ido-completing-read+
:after ido
:config
(ido-ubiquitous-mode t)))
;; Extensions for ivy
(use-package counsel
:bind
("C-x C-f" . 'counsel-find-file)
("M-x" . 'counsel-M-x)
)
;; Nicer interface for ivy
(use-package ivy-rich
:after (all-the-icons counsel)
:config
(defun my/ivy-rich-switch-buffer-icon (candidate)
(with-current-buffer
(get-buffer candidate)
(let ((icon (all-the-icons-icon-for-mode major-mode)))
(if (symbolp icon)
(all-the-icons-icon-for-mode 'fundamental-mode)
icon))))
(setq ivy-rich-display-transformers-list
'(ivy-switch-buffer
(:columns
((my/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)))))
(ivy-rich-mode 1)
(setcdr (assq t ivy-format-functions-alist) #'ivy-format-function-line)
)
;; Better search.
(use-package swiper
:after ivy
:bind
("C-s" . 'swiper)
)
;; Ruler with fill-column marker.
(use-package ruler-mode

View File

@ -1,2 +1,2 @@
127.0.0.1:51313 15321
127.0.0.1:51313 19011
phahw2ohVoh0oopheish7IVie9desh8aequeenei3uo8wahShe%thuadaeNa4ieh