Add an ivy module

ivy is a modern alternative to ido and is superior to ido in many ways
(especially when you're dealing with a lot of candidates).
This commit is contained in:
Bozhidar Batsov 2017-12-29 22:09:55 +02:00
parent dbabbd6a7d
commit 2bfa877db0
2 changed files with 76 additions and 1 deletions

74
modules/prelude-ivy.el Normal file
View file

@ -0,0 +1,74 @@
;;; prelude-ivy.el --- Ivy setup
;;
;; Copyright © 2011-2017 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Ivy-related config.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(prelude-require-packages '(ivy swiper counsel))
;; ivy is a powerful alternative to the popular ido-mode
(require 'ivy)
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq enable-recursive-minibuffers t)
(global-set-key (kbd "C-c C-r") 'ivy-resume)
(global-set-key (kbd "<f6>") 'ivy-resume)
(setq projectile-completion-system 'ivy)
;; swiper provides enhanced buffer search
(require 'swiper)
(global-set-key "\C-s" 'swiper)
;; counsel supercharges a lot of commands with some ivy magic
(require 'counsel)
(global-set-key (kbd "M-x") 'counsel-M-x)
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
(global-set-key (kbd "<f1> f") 'counsel-describe-function)
(global-set-key (kbd "<f1> v") 'counsel-describe-variable)
(global-set-key (kbd "<f1> l") 'counsel-find-library)
(global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
(global-set-key (kbd "<f2> u") 'counsel-unicode-char)
(global-set-key (kbd "C-c g") 'counsel-git)
(global-set-key (kbd "C-c j") 'counsel-git-grep)
(global-set-key (kbd "C-c k") 'counsel-ag)
(global-set-key (kbd "C-x l") 'counsel-locate)
(define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history)
(provide 'prelude-ivy)
;;; prelude-ivy.el ends here

View file

@ -2,7 +2,8 @@
;; Emacs IRC client ;; Emacs IRC client
(require 'prelude-erc) (require 'prelude-erc)
(require 'prelude-ido) ;; Super charges Emacs completion for C-x C-f and more ;; (require 'prelude-ido) ;; Super charges Emacs completion for C-x C-f and more
(require 'prelude-ivy) ;; A mighty modern alternative to ido
;; (require 'prelude-helm) ;; Interface for narrowing and search ;; (require 'prelude-helm) ;; Interface for narrowing and search
;; (require 'prelude-helm-everywhere) ;; Enable Helm everywhere ;; (require 'prelude-helm-everywhere) ;; Enable Helm everywhere
(require 'prelude-company) (require 'prelude-company)