 
 (add-hook 'occur-mode-hook
           (lambda ()
-            (define-key evil-motion-state-local-map (kbd "e")
-              'occur-edit-mode)
-            (define-key evil-motion-state-local-map (kbd "n")
-              (hong/occur-next-or-prev 'next))
-            (define-key evil-motion-state-local-map (kbd "p")
-              (hong/occur-next-or-prev 'prev))
-            (define-key evil-motion-state-local-map (kbd "RET")
-              #'occur-mode-goto-occurrence-other-window)))
-
-(defun hong/multi-occur-same-major-mode ()
-  (interactive)
-  (defun hong//common-mode-buffers (the-mode)
-    (delq nil (mapcar (lambda (buf)
-                        (when (buffer-live-p buf)
-                          (with-current-buffer buf
-                            (and (eq major-mode the-mode)
-                                 buf))))
-                      (buffer-list))))
-  (multi-occur (hong//common-mode-buffers major-mode)
-               (read-regexp "Collect strings matching regexp: "))
-  (select-window (get-buffer-window "*Occur*"))
-  )
+            (evil-local-set-key 'motion (kbd "e") 'occur-edit-mode)
+            (evil-local-set-key 'motion (kbd "n") (occur-np 'next))
+            (evil-local-set-key 'motion (kbd "p") (occur-np 'prev))
+            (evil-local-set-key 'motion (kbd "RET") #'occur-mode-goto-occurrence-other-window)))
 
 ;;; ========================= key bindings ============================
 (defhydra hydra-search-menu (:color amaranth :hint nil)


;;; =================== occur =========================
;;; occur follow
(defun hong/occur-next-or-prev (next-or-prev)
  (lexical-let ((nop next-or-prev))
    (lambda () (interactive)
      (let ((buf (get-buffer-window (buffer-name))))
        (save-selected-window
          (if (eq nop 'next) (occur-next) (occur-prev))
          (occur-mode-goto-occurrence-other-window)
          (recenter))))))

(defadvice isearch-occur (after hong/occur-exit-isearch activate)
  (and (ignore-errors (select-window (get-buffer-window "*Occur*")))

  ("g" rgrep :color blue)
  ("G" counsel-git-grep :color blue)
  ("s" swiper :color blue)
  ("c" nil "cancel")
  ("q" nil "cancel"))

