             wdired-abort-changes)
     (eval `(defadvice ,it (after revert-buffer activate)
              (revert-buffer))))
-  (global-set-key (kbd "C-c C-j") 'dired-jump)
   (define-key dired-mode-map (kbd "C-c C-c") 'wdired-change-to-wdired-mode)
   (define-key dired-mode-map (kbd "<insert>") 'dired-mark)
   ;; C-a goes to filename

  (use-package inf-haskell))

;; ruby ;;
;; replace normal ruby mode
(defalias 'ruby-mode 'enh-ruby-mode)
;; enhanced ruby mode
(load-lazy '(ruby-mode enh-ruby-mode) "enh-ruby-mode"
  (setq enh-ruby-program "~/.rbenv/shims/ruby")

  ;; we use flycheck to cover errors
  (setq enh-ruby-check-syntax nil)

  ;; better indenting
  (setq ruby-indent-level tab-width)
  (setq enh-ruby-bounce-deep-indent t)
  (setq enh-ruby-deep-indent-paren nil)

  (add-hook 'enh-ruby-mode-hook 'whitespace-mode))

;; Rake files are Ruby, too
(add-to-list 'interpreter-mode-alist '("ruby"        . enh-ruby-mode))
(add-to-list 'auto-mode-alist        '("\\.rake$"    . enh-ruby-mode))
(add-to-list 'auto-mode-alist        '("Rakefile$"   . enh-ruby-mode))
(add-to-list 'auto-mode-alist        '("Gemfile$"    . enh-ruby-mode))
(add-to-list 'auto-mode-alist        '("Capfile$"    . enh-ruby-mode))
(add-to-list 'auto-mode-alist        '("\\.builder$" . enh-ruby-mode))
(add-to-list 'auto-mode-alist        '("\\.gemspec$" . enh-ruby-mode))

(load-after 'enh-ruby-mode
  ;; misc stuff
  (use-package ruby-block) ; show what block an end belongs to
    (ruby-block-mode t)
    (setq ruby-block-highlight-toggle t))
  

;; lua
(load-lazy '(lua-mode) "lua-mode"
  (setq lua-indent-level 2))

;; (s)css
(load-lazy '(scss-mode) "scss-mode"
  (setq scss-compile-at-save nil))

;; web-mode
(load-lazy '(web-mode) "web-mode"
  :prepare (push (! `(,(format "\\.%s$"
                               (regexp-opt
                                '("phtml" "tpl" "php" "gsp" "jsp"
                                  "aspx" "ascx" "erb" "mustache" "djhtml"
                                  "html" "js" "jsx" "css" "xml")))
                      . web-mode)) auto-mode-alist)
  (setq web-mode-markup-indent-offset 2
        web-mode-code-indent-offset 2
        web-mode-css-indent-offset 2
        web-mode-style-padding 2
        web-mode-script-padding 2
        web-mode-block-padding 2)

  (require-keybinds web-mode-map
    [remap comment-dwim] 'web-mode-comment-or-uncomment
    "C-c C-'" 'web-mode-element-close)

  (load-after 'auto-complete
    (load-after 'auto-complete-config
      (setq web-mode-ac-sources-alist
            '(("javascript" . (ac-source-words-in-same-mode-buffers))
              ("php" . (ac-source-words-in-same-mode-buffers))
              ("css" . (ac-source-css-property ac-source-words-in-same-mode-buffers))
              ("html" . (ac-source-words-in-same-mode-buffers))))
      (push 'web-mode ac-modes)))

  (load-after 'smart-compile
    (push '(web-mode . (browse-url-of-buffer)) smart-compile-alist))
  )

;; eldoc, ie function signatures in the minibuffer
(load-lazy '(turn-on-eldoc-mode) "eldoc"

  )

;; markdown
(use-package markdown-mode
  :ensure t
  :mode (("\\.md$"        . markdown-mode)
         ("\\.mkd$"       . markdown-mode)
         ("\\.pdc$"       . markdown-mode)
         ("\\.markdown$"  . markdown-mode)
         ("\\bREADME$$"   . markdown-mode))
  :config
  (setq markdown-command "pandoc --smart -f markdown -t html")
  (setq markdown-css-paths `(,(expand-file-name "markdown.css" "~/.pandoc/css/markdown.css")))
  (setq markdown-enable-math t)
  ;; add pandoc hook
  (add-hook 'markdown-mode-hook 'turn-on-pandoc)
  (add-hook 'pandoc-mode-hook 'pandoc-load-default-settings))

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

;; muflax-notes
(use-package notes-mode
  :mode "\\.notes$")


;; Automatic Math preview toggle in org-mode
;; Source: http://goo.gl/WLYzxp
(defvar org-latex-fragment-last nil
  "Holds last fragment/environment you were on.")
;; FIXME Pretty janky right now
(defun org-latex-fragment-toggle ()
  "Toggle a latex fragment image "
  (and (eq 'org-mode major-mode)
