From 0bcda96e065ec0546bb4cd58fec83184d87e9aca Mon Sep 17 00:00:00 2001
From: David Li
Date: Sun, 4 Mar 2018 19:48:47 -0500
Subject: Use ivy/swiper instead of ido/smex
---
init.el | 32 +++++++++++++++++++++++---------
1 file changed, 23 insertions(+), 9 deletions(-)
diff --git a/init.el b/init.el
index cc5a411..822d897 100644
--- a/init.el
+++ b/init.el
@@ -50,17 +50,28 @@
;; Indentation
(setq-default indent-tabs-mode nil)
-;; ido
-(require 'ido)
-(ido-mode t)
-(setq ido-ignore-extensions t)
+;; ivy
-(require 'ido-vertical-mode)
-(ido-vertical-mode 1)
-(setq ido-vertical-define-keys 'C-n-and-C-p-only)
+(ivy-mode 1)
+(setq ivy-use-virtual-buffers t)
+(setq enable-recursive-minibuffers t)
-(require 'smex)
-(global-set-key (kbd "M-x") 'smex)
+(global-set-key "\C-s" 'swiper)
+(global-set-key (kbd "M-x") 'counsel-M-x)
+(global-set-key (kbd "C-x C-f") 'counsel-find-file)
+(global-set-key (kbd " f") 'counsel-describe-function)
+(global-set-key (kbd " v") 'counsel-describe-variable)
+(global-set-key (kbd " l") 'counsel-find-library)
+(global-set-key (kbd " i") 'counsel-info-lookup-symbol)
+(global-set-key (kbd " u") 'counsel-unicode-char)
+(global-set-key (kbd "C-c k") 'counsel-ag)
+(define-key read-expression-map (kbd "C-r") 'counsel-expression-history)
+
+;;; make ivy like ido
+(define-key ivy-minibuffer-map (kbd "C-j") #'ivy-immediate-done)
+(define-key ivy-minibuffer-map (kbd "RET") #'ivy-alt-done)
+
+(setq ivy-wrap 't)
;; electric-pair
(electric-pair-mode 1)
@@ -119,6 +130,9 @@ This functions should be added to the hooks of major modes for programming."
(define-key evil-normal-state-map (kbd ";") 'comment-or-uncomment-region-or-line)
(define-key evil-normal-state-map (kbd "C-.") 'ido-imenu-anywhere)
+(define-key evil-normal-state-map (kbd "/") 'swiper)
+(define-key evil-normal-state-map (kbd "?") 'swiper)
+
(define-key evil-visual-state-map (kbd ";") 'comment-or-uncomment-region-or-line)
(define-key evil-insert-state-map (kbd "C-d") 'evil-delete-char)
(define-key evil-insert-state-map (kbd "M-d") 'kill-word)
--
cgit v1.2.3