2019-03-01 07:01:47 +01:00
|
|
|
|
;;; oni-ivy.el --- Ivy configuration -*- lexical-binding: t; -*-
|
|
|
|
|
|
|
|
|
|
;; Copyright (C) 2019 Tom Willemse
|
|
|
|
|
|
|
|
|
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
|
|
|
|
;; Keywords: local
|
2021-07-13 06:53:01 +02:00
|
|
|
|
;; Version: 2021.0712.215209
|
2020-03-06 07:50:18 +01:00
|
|
|
|
;; Package-Requires: (ivy oni-prescient oni-hydra ivy-hydra diminish ivy-posframe ivy-prescient)
|
2019-03-01 07:01:47 +01:00
|
|
|
|
|
|
|
|
|
;; 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 this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
|
|
;; Ivy configuration.
|
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
|
|
(require 'ivy)
|
|
|
|
|
(require 'ivy-hydra)
|
2019-05-23 05:49:31 +02:00
|
|
|
|
(require 'ivy-posframe)
|
2020-02-25 08:11:41 +01:00
|
|
|
|
(require 'ivy-prescient)
|
2019-03-01 07:01:47 +01:00
|
|
|
|
|
2019-03-01 07:06:47 +01:00
|
|
|
|
(defun oni-ivy--disable (orig-fun &rest args)
|
|
|
|
|
"Disable ivy while running ORIG-FUN with ARGS."
|
|
|
|
|
(let ((ivy-enabled ivy-mode))
|
|
|
|
|
(unwind-protect
|
|
|
|
|
(progn
|
|
|
|
|
(when ivy-enabled
|
|
|
|
|
(ivy-mode -1))
|
|
|
|
|
(apply orig-fun args))
|
|
|
|
|
(when ivy-enabled
|
|
|
|
|
(ivy-mode 1)))))
|
|
|
|
|
|
2021-07-13 06:53:01 +02:00
|
|
|
|
(defun ivy-posframe-display-at-frame-bottom-center (str)
|
|
|
|
|
"Display STR in ivy’s posframe at the bottom centre of the current frame."
|
|
|
|
|
(ivy-posframe--display str #'posframe-poshandler-frame-bottom-center))
|
|
|
|
|
|
2019-03-01 07:06:47 +01:00
|
|
|
|
(when (eq system-type 'windows-nt)
|
|
|
|
|
(with-eval-after-load 'grep
|
|
|
|
|
(add-function :around (symbol-function 'grep-read-files)
|
|
|
|
|
#'oni-ivy--disable)))
|
|
|
|
|
|
2019-09-18 20:07:46 +02:00
|
|
|
|
(global-set-key (kbd "C-<up>") 'ivy-push-view)
|
|
|
|
|
(global-set-key (kbd "C-<down>") 'ivy-switch-view)
|
|
|
|
|
|
2021-07-13 06:53:01 +02:00
|
|
|
|
(setq ivy-posframe-style 'frame-bottom-center)
|
|
|
|
|
|
2019-03-01 07:01:47 +01:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(add-hook 'emacs-startup-hook 'ivy-mode)
|
|
|
|
|
|
2019-07-09 07:47:11 +02:00
|
|
|
|
(ivy-posframe-mode)
|
2020-02-25 08:11:41 +01:00
|
|
|
|
(ivy-prescient-mode)
|
2019-07-09 07:47:11 +02:00
|
|
|
|
|
2020-04-08 20:16:00 +02:00
|
|
|
|
(with-eval-after-load 'ivy-posframe (diminish 'ivy-posframe-mode))
|
|
|
|
|
(with-eval-after-load 'ivy (diminish 'ivy-mode))
|
2019-05-23 05:49:31 +02:00
|
|
|
|
|
|
|
|
|
;;;###autoload(with-eval-after-load 'ivy (require 'oni-ivy))
|
|
|
|
|
|
2019-03-01 07:01:47 +01:00
|
|
|
|
(provide 'oni-ivy)
|
|
|
|
|
;;; oni-ivy.el ends here
|