          :map counsel-ag-map
          ("C-c C-e" . ar/ivy-occur)
          :map wgrep-mode-map
-         ("C-c C-c" . ar/wgrep-finish-edit))
+         ("C-c C-c" . ar/wgrep-finish-edit)
+         ("C-c C-k" . ar/wgrep-abort-changes))
   :init
-  ;; `ar/ivy-occur',`ar/counsel-ag', and `ar/wgrep-finish-edit' replicate a more
+  ;; `ar/ivy-occur',`ar/counsel-ag', `ar/wgrep-abort-changes' and `ar/wgrep-finish-edit' replicate a more
   ;; streamlined result-editing workflow I was used to in helm-ag.
+
   (defun ar/ivy-occur ()
     (interactive)
+    (defvar ar/ivy-occur--win-config)
+    (setq ar/ivy-occur--win-config
+          (current-window-configuration))
     (if (not (window-minibuffer-p))
         (user-error "No completion session is active")
       (let* ((caller (ivy-state-caller ivy-last))

          (setq-local ivy--directory ivy--directory)
          (ivy-wgrep-change-to-wgrep-mode))
        (ivy-exit-with-action
         (lambda (_) (pop-to-buffer buffer))))))

  (defun ar/counsel-ag (arg)
    (interactive "P")

           (minibuffer-keyboard-quit))))
  (ivy-mode +1)

  ;; Unsure about this one.
  ;; (use-package ivy-posframe
  ;;   :ensure t
  ;;   :config
  ;;   (setq ivy-display-function #'ivy-posframe-display-at-frame-center)
  ;;   (ivy-posframe-enable))
  )

;; Displays yasnippet previous inline when cycling through results.
(use-package ivy-yasnippet
