 
 (require 'use-package)
 
-;;;;
+(add-to-list 'load-path (concat user-emacs-directory "vendor/"))
+
+
+;;;; Globals
+
+;; I rarely turn off the computer, so it's ok to have these in /tmp.
+;; You know, auto cleanup as a service ;)
 (defvar td/data-directory "/tmp/")
-(add-to-list 'load-path (concat user-emacs-directory "vendor/"))
-
-;; I rarely turn off the computer, so it's ok to have these at /tmp.
-;; You know, auto cleanup as a service ;)
 (setq backup-directory-alist `((".*" . ,td/data-directory))
       auto-save-list-file-prefix td/data-directory
       auto-save-timeout (* 5 60)

;;   :defer t
;;   :init
;;   (add-hook 'clojure-mode-hook 'cider-mode))
(use-package monroe
  :ensure t
  :defer t
  :commands (clojure-enable-monroe)
  :init (add-hook 'clojure-mode-hook 'clojure-enable-monroe))


(defun td/css-imenu-expressions ()
  "TODO: docs."
  (set (make-local-variable 'imenu-generic-expression)
       '(("Section" "^.*\\* =\\(.+\\)$" 1)
         (nil "^\\(.+\\)\\S*{$" 1))))

(use-package css-mode
  :mode (("\\.css$" . css-mode))
  :config
  (progn
    (setq css-indent-offset 2)
    (add-hook 'css-mode-hook #'td/css-imenu-expressions)))

(use-package scss-mode
  :ensure t
  :mode (("\\.scss$" . scss-mode)))

(use-package less-css-mode
  :ensure t
  :mode (("\\.less" . less-css-mode)))

(use-package yaml-mode
  :ensure t
  :mode (("\\.yaml$" . yaml-mode)

  :defer t
  :init (add-hook 'projectile-mode-hook #'projectile-rails-on))

(use-package dumb-jump
  :ensure t
  :init (dumb-jump-mode t))

(use-package swiper
  :defer t
  :ensure t
  :bind (("C-M-l" . swiper)))

(use-package ivy
  :defer t
  :init (ivy-mode t)
  :bind (("C-M-o" . ivy-switch-buffer))
  :config
  (progn
    (setq ivy-format-function 'ivy-format-function-arrow
          ivy-count-format ""
          ivy-use-virtual-buffers t
          ivy-height 16
          projectile-completion-system 'ivy)

    (use-package flx
      :ensure t
      :init
      (setq ivy-re-builders-alist '((t . ivy--regex-plus))
            ivy-initial-inputs-alist nil))

    (require 'ivy-popup)))

(use-package counsel
  :ensure t
  :defer t
  :bind (([remap find-file] . counsel-find-file)
         ([remap execute-extended-command] . counsel-M-x)
         ("M-m" . counsel-M-x)
         ("C-c i" . counsel-imenu)))

(use-package smex
  :ensure t
  :init (smex-initialize))

(use-package imenu
  :defer t
  :config
  (setq imenu-auto-rescan t))

(use-package ag
  :defer t
  :ensure t)

(use-package wgrep-ag
  :defer t
  :ensure t)


;;;; Programming langauges
;;;; Web
(use-package emmet-mode
  :ensure t
  :defer t
