 
 (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)

      create-lockfiles nil
      ring-bell-function 'ignore)

;;
(setq user-full-name "Tung Dao"
      user-mail-address "me@tungdao.com"
      default-input-method 'vietnamese-telex)

(setq default-frame-alist
      '((right-fringe . 0)
        (font . "Fira Code 12")
        (top . 0)
        (left . 512)
        (width . 128) (height . 64)
        (border-width . 0)
        (internal-border-width . 0)))
(setq-default line-spacing 2
              fringes-outside-margins t)

;; This is for emacsforosx.com version
(setq mac-option-modifier 'super
      mac-command-modifier 'meta)

(if (fboundp 'mac-auto-operator-composition-mode)
    (mac-auto-operator-composition-mode))

(set-default-coding-systems 'utf-8-unix)
(set-terminal-coding-system 'utf-8-unix)
(set-keyboard-coding-system 'utf-8-unix)
(prefer-coding-system 'utf-8-unix)

(setq-default indent-tabs-mode nil
              tab-width 2)
(setq require-final-newline t
      echo-keystrokes 0.1
      scroll-margin 4)

(global-auto-revert-mode t)


(use-package etags
  :defer t
  :config
  (setq tags-revert-without-query t))

(use-package whitespace
  :commands (whitespace-cleanup
             whitespace-mode)
  :bind ("C-c w" . whitespace-mode)
  :init (add-hook 'before-save-hook #'whitespace-cleanup)
  :config
  (progn
    (add-to-list 'whitespace-display-mappings

  (setq ediff-window-setup-function 'ediff-setup-windows-plain
        ediff-split-window-function 'split-window-horizontally))


;;;; UI
(setq-default
 line-spacing 2
 fringes-outside-margins t
 indicate-empty-lines t
 default-frame-alist
 '((right-fringe . 0)
   (font . "Fira Code 13")
   (top . 0)
   (left . 512)
   (width . 120) (height . 64)
   (border-width . 0)
   (internal-border-width . 0)))

(scroll-bar-mode -1)
(tool-bar-mode -1)
(blink-cursor-mode -1)
(electric-pair-mode t)
(column-number-mode t)
(unless (display-graphic-p)
  (menu-bar-mode -1))

(defvar td/adaptive-theme-functions '()
  "Hook run after custom themes are loaded.")

(defun td/adaptive-theme (theme &optional no-confirm no-enable)
  "Adapt some faces according to THEME, NO-CONFIRM and NO-ENABLE."
  (run-hooks 'td/adaptive-theme-functions))

(advice-add 'load-theme :after #'td/adaptive-theme)

(define-fringe-bitmap 'tilde
  [#b01110001
   #b11011011
   #b00001110]
  nil nil 'center)
(setcdr (assq 'empty-line fringe-indicator-alist) 'tilde)
(eval-after-load 'linum
  '(set-fringe-bitmap-face 'tilde 'linum))


(use-package color-theme-approximate
  :ensure t
  :init (color-theme-approximate-on))


(use-package subatomic-theme
  :ensure t
  :init (load-theme 'subatomic t))


(use-package smart-mode-line
  :ensure t
  :defer t
  :init (sml/setup)
  :config
  (progn
    (add-to-list 'sml/replacer-regexp-list
                 '("^~/Projects/dotfiles/\\(.*\\)/" ":Config:\\1:"))

    (use-package rich-minority
      :init
      (progn
        (add-to-list 'rm-blacklist " wg")
        (add-to-list 'rm-blacklist " snipe")
        (add-to-list 'rm-blacklist " ivy")
        (add-to-list 'rm-blacklist " Undo-Tree")
        (add-to-list 'rm-blacklist " Anzu")
        (add-to-list 'rm-blacklist " yas")
        (add-to-list 'rm-blacklist " company")))))

(use-package paren-face
  :ensure t
