     (interactive)
     (switch-to-buffer (other-buffer (current-buffer) 1))))
 
-(add-hook 'emacs-startup-hook
-          (lambda ()
-            ;; In addition to highlighting, we get navigation between
-            (use-package highlight-symbol
-              :hook ((prog-mode . highlight-symbol-mode)
-                     (prog-mode . highlight-symbol-nav-mode))
-              :ensure t
-              :bind (:map highlight-symbol-nav-mode-map
-                          (("M-n" . highlight-symbol-next)
-                           ("M-p" . highlight-symbol-prev)))
-              :config
-              (set-face-attribute 'highlight-symbol-face nil
-                                  :background "default"
-                                  :foreground "yellow")
-              (vsetq highlight-symbol-idle-delay 0.2)
-              (vsetq highlight-symbol-on-navigation-p t))))
+(add-hook! 'emacs-startup-hook
+           ;; In addition to highlighting, we get navigation between
+           (use-package highlight-symbol
+             :hook ((prog-mode . highlight-symbol-mode)
+                    (prog-mode . highlight-symbol-nav-mode))
+             :ensure t
+             :bind (:map highlight-symbol-nav-mode-map
+                         (("M-n" . highlight-symbol-next)
+                          ("M-p" . highlight-symbol-prev)))
+             :config
+             (set-face-attribute 'highlight-symbol-face nil
+                                 :background "default"
+                                 :foreground "yellow")
+             (vsetq highlight-symbol-idle-delay 0.2)
+             (vsetq highlight-symbol-on-navigation-p t)))
 
 ;;;; Navigation END
 


;;;; Navigation START

(add-hook 'emacs-startup-hook
          (lambda ()
            (use-package isearch
              :commands (isearch-forward isearch-backward)
              :defer 5
              :preface
              (provide 'isearch)
              :config
              (use-package char-fold)

              (vsetq search-default-mode #'char-fold-to-regexp)

              ;; Prepopulate isearch with selectionn.
              ;; From http://www.reddit.com/r/emacs/comments/2amn1v/isearch_selected_text
              (defadvice isearch-mode (around isearch-mode-default-string
                                              (forward &optional regexp op-fun recursive-edit word-p) activate)
                "Enable isearch to start with current selection."
                (if (and transient-mark-mode mark-active (not (eq (mark) (point))))
                    (progn
                      (isearch-update-ring (buffer-substring-no-properties (mark) (point)))
                      (deactivate-mark)
                      ad-do-it
                      (if (not forward)
                          (isearch-repeat-backward)
                        (goto-char (mark))
                        (isearch-repeat-forward)))
                  ad-do-it)))

            ;; From http://endlessparentheses.com/emacs-narrow-or-widen-dwim.html
            (defun ar/narrow-or-widen-dwim (p)
              "Widen if buffer is narrowed, narrow-dwim otherwise.
Dwim means: region, org-src-block, org-subtree, or defun,
whichever applies first. Narrowing to org-src-block actually
calls `org-edit-src-code'.

With prefix P, don't widen, just narrow even if buffer is
already narrowed."
              (interactive "P")
              (declare (interactive-only))
              (cond ((and (buffer-narrowed-p) (not p)) (widen))
                    ((region-active-p)
                     (narrow-to-region (region-beginning) (region-end)))
                    ((derived-mode-p 'org-mode)
                     ;; `org-edit-src-code' is not a real narrowing
                     ;; command. Remove this first conditional if you
                     ;; don't want it.
                     (cond ((ignore-errors (org-edit-src-code))
                            (delete-other-windows))
                           ((ignore-errors (org-narrow-to-block) t))
                           (t (org-narrow-to-subtree))))
                    ((derived-mode-p 'latex-mode)
                     (LaTeX-narrow-to-environment))
                    (t (narrow-to-defun))))

            (bind-key "C-x n n" #'ar/narrow-or-widen-dwim)))

(use-package swiper
  :ensure t


;;;; Hydra START

(add-hook! 'emacs-startup-hook
           (use-package hydra
             :ensure t
             :defer 5
             :config
             (vsetq hydra-is-helpful t)
             (defhydra hydra-search (:color blue)
               "search"
               ("d" ar/helm-ag "search directory")
               ("f" ar/find-dired-current-dir "find file")
               ("a" ar/find-all-dired-current-dir "find all files")
               ("i" ar/helm-ag-insert "insert match")
               ("q" nil "quit"))
             (defhydra hydra-quick-insert (:color blue)
               "
Quick insert: _w_eb bookmark _b_acklog bookmark
              _t_odo _d_one
"
               ("w" ar/helm-org-add-bookmark nil)
               ("b" ar/helm-org-add-backlog-link nil)
               ("t" ar/org-add-todo nil)
               ("d" ar/org-add-done nil)
               ("q" nil nil :color blue))

             (defun ar/hydra-open-dwim ()
               "Choose \"open\" hydra based on current mode."
               (interactive)
               (cond ((derived-mode-p 'c-mode) (hydra-open-c-mode/body))
                     ((derived-mode-p 'prog-mode) (hydra-open-prog-mode/body))
                     (t (hydra-open/body))))

             (defhydra hydra-open-c-mode (:color blue)
               "open"
               ("o" ff-find-other-file "other")
               ("e" ar/platform-open-in-external-app "externally")
               ("u" ar/platform-open-file-at-point "url at point")
               ("b" ar/file-open-closest-build-file "build file")
               ("q" nil "cancel"))

             (defhydra hydra-open (:color blue)
               "
Open: _p_oint _e_xternally
"
               ("e" ar/platform-open-in-external-app nil)
               ("p" ar/platform-open-file-at-point nil)
               ("q" nil "cancel"))

             (defhydra hydra-open-prog-mode (:color blue)
               "open"
               ("o" ff-find-other-file "other")
               ("e" ar/platform-open-in-external-app "externally")
               ("u" ar/platform-open-file-at-point "url at point")
               ("b" ar/file-open-closest-build-file "build file")
               ("q" nil "cancel"))

             (defhydra hydra-git-gutter (:pre (git-gutter-mode +1))
               "
Git: _n_ext     _s_tage  _d_iff
     _p_revious _k_ill _q_uit
"
               ("n" git-gutter:next-hunk nil)
               ("p" git-gutter:previous-hunk nil)
               ("s" git-gutter:stage-hunk nil)
               ("k" (lambda ()
                      (interactive)
                      (git-gutter:revert-hunk)
                      (call-interactively #'git-gutter:next-hunk)) nil)
               ("d" git-gutter:popup-hunk nil)
               ("q" nil nil :color blue))
             :bind (("C-c s" . hydra-search/body)
                    ("C-c x" . hydra-quick-insert/body)
                    ("C-c o" . ar/hydra-open-dwim)
                    ("C-c g" . hydra-git-gutter/body))))

;;;; Hydra END

;;;; Buffers START
