             (helm :sources '(helm-source-do-ag) :buffer "*helm-ag*"
                   :input search-string
                   :keymap helm-do-ag-map)))))
-
-    (defun spacemacs/helm-projectile-ag-region-or-symbol (&optional options)
-      "Version of `spacemacs/helm-do-ag-region-or-symbol' that
-defaults to searching the current project. Requires \"ag\" search tool."
-      (interactive)
-      (unless (executable-find "ag")
-        (error "ag not available"))
-      (if (require 'helm-ag nil  'noerror)
-          (if (projectile-project-p)
-              (let* ((grep-find-ignored-files
-                      (-union (projectile-ignored-files-rel)  grep-find-ignored-files))
-                     (grep-find-ignored-directories
-                      (-union (projectile-ignored-directories-rel) grep-find-ignored-directories))
-                     (ignored
-                      (mapconcat (lambda (i)
-                                   (concat "--ignore " i))
-                                 (append grep-find-ignored-files grep-find-ignored-directories)
-                                 " "))
-                     (helm-ag-command-option options)
-                     (helm-ag-base-command (concat helm-ag-base-command " " ignored)))
-                (spacemacs/helm-do-ag-region-or-symbol (projectile-project-root)))
-            (error "You're not in a project"))
-        (error "helm-ag not available")))
-    (evil-define-key 'normal helm-ag-map "SPC" evil-leader--default-map)
-    (evilify helm-ag-mode helm-ag-mode-map
-             (kbd "RET") 'helm-ag-mode-jump-other-window
-             (kbd "q") 'quit-window)))
+    :config
+    (progn
+      (evil-define-key 'normal helm-ag-map "SPC" evil-leader--default-map)
+      (evilify helm-ag-mode helm-ag-mode-map
+               (kbd "RET") 'helm-ag-mode-jump-other-window
+               (kbd "q") 'quit-window))))
 
 (defun spacemacs/init-helm-descbinds ()
   (use-package helm-descbinds

(defun spacemacs/init-helm-ag ()
  (use-package helm-ag
    :defer t
    :config
    (defun spacemacs/helm-do-ag-region-or-symbol (&optional basedir)
      "Calls `helm-do-ag' with a default string of the escaped
active region or the symbol at the point if there is no active
region. Requires \"ag\" search tool."
      (interactive)
      (require 'helm-mode)
      (require 'helm-grep)
      (require 'helm-ag)
      (require 'pcre2el)
      (unless (executable-find "ag")
        (error "ag not available"))
      (setq helm-ag--original-window (selected-window))

(defun spacemacs/init-expand-region ()
  (use-package expand-region
    :defer t
    :init (evil-leader/set-key "v" 'er/expand-region)
    :config
    (progn
      ;; add search capability to expand-region
      (when (configuration-layer/package-usedp 'helm-ag)
        (defadvice er/prepare-for-more-expansions-internal
            (around helm-ag/prepare-for-more-expansions-internal activate)
          ad-do-it
          (let ((new-msg (concat (car ad-return-value)
                                 ", / to search in project, "
                                 "s to search in other files"))
                (new-bindings (cdr ad-return-value)))
            (cl-pushnew
             '("/" (lambda ()
                     (call-interactively
                      'spacemacs/helm-projectile-ag-region-or-symbol)))
             new-bindings)
            (cl-pushnew
             '("s" (lambda ()
                     (call-interactively
                      'spacemacs/helm-do-ag-region-or-symbol)))
             new-bindings)
            (setq ad-return-value (cons new-msg new-bindings)))))
      (custom-set-variables
       '(expand-region-contract-fast-key "V")
       '(expand-region-reset-fast-key "r")))))

(defun spacemacs/init-fancy-battery ()
  (use-package fancy-battery
