emacs-prelude/modules/prelude-ivy.el

82 lines
2.6 KiB
EmacsLisp
Raw Normal View History

;;; prelude-ivy.el --- Ivy setup
;;
2020-01-20 16:35:36 +02:00
;; 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:
2020-09-23 09:53:33 +03:00
;; 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:
2020-11-27 09:20:32 +02:00
(prelude-require-packages '(ivy ivy-prescient swiper counsel))
2020-09-23 09:53:33 +03:00
;;; Ivy
2020-11-27 10:03:28 +02:00
;;
;; ivy is a powerful alternative to the popular ido-mode
(require 'ivy)
(require 'counsel)
(require 'ivy-prescient) ;; must be loaded after counsel
2020-11-24 09:40:14 +02:00
(require 'diminish)
(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)
2020-11-27 09:20:32 +02:00
;; smarter filtering and sorting for ivy
(ivy-prescient-mode 1)
2020-11-24 09:40:14 +02:00
(diminish 'ivy-mode)
2020-09-23 09:53:33 +03:00
;;; Swiper
2020-11-27 10:03:28 +02:00
;;
;; swiper provides enhanced buffer search
(global-set-key "\C-s" 'swiper)
2020-09-23 09:53:33 +03:00
;;; Counsel
2020-11-27 10:03:28 +02:00
;;
;; 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)
2020-12-10 21:01:13 +02:00
(global-set-key (kbd "C-c g") 'counsel-git) ; will override the keybinding for `magit-file-dispatch'
(global-set-key (kbd "C-c j") 'counsel-git-grep)
2018-05-06 18:06:54 +03:00
(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