1
0
Fork 0
emacs-config/oni-ivy.el
Tom Willemse db0220de5c Add some layout management commands
After watching a YouTube video[1] on managing window layouts in Emacs I was
reminded of ‘winner-mode’ and introduced to the ‘ivy-push-view’ and
‘ivy-switch-view’ commands. As I feel like I frequently end up with setting up
and losing layouts, I think these may be useful.

[1]: https://www.youtube.com/watch?v=kyllrQiNsyA
2019-09-18 11:07:46 -07:00

63 lines
1.8 KiB
EmacsLisp

;;; oni-ivy.el --- Ivy configuration -*- lexical-binding: t; -*-
;; Copyright (C) 2019 Tom Willemse
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
;; Version: 2019.0918.110642
;; Package-Requires: (ivy ivy-hydra diminish ivy-posframe)
;; 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)
(require 'ivy-posframe)
(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)))))
(when (eq system-type 'windows-nt)
(with-eval-after-load 'grep
(add-function :around (symbol-function 'grep-read-files)
#'oni-ivy--disable)))
(global-set-key (kbd "C-<up>") 'ivy-push-view)
(global-set-key (kbd "C-<down>") 'ivy-switch-view)
;;;###autoload
(add-hook 'emacs-startup-hook 'ivy-mode)
(ivy-posframe-mode)
(diminish 'ivy-posframe-mode)
(diminish 'ivy-mode)
;;;###autoload(with-eval-after-load 'ivy (require 'oni-ivy))
(provide 'oni-ivy)
;;; oni-ivy.el ends here