emacs-prelude/modules/prelude-ivy.el
2020-09-23 09:53:33 +03:00

72 lines
2.4 KiB
EmacsLisp

;;; prelude-ivy.el --- Ivy setup
;;
;; Copyright © 2011-2020 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Ivy-related config. Ivy is a smart framework for minibuffer
;; completion/filtering/selection (think of ido). Swiper and counsel
;; are two packages built on top of ivy that provide ivy-powered
;; versions of popular Emacs commands.
;;; 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
;; 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
;; swiper provides enhanced buffer search
(global-set-key "\C-s" 'swiper)
;;; Counsel
;; counsel supercharges a lot of commands with some ivy magic
(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 a") '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