+;
+; Packages
+;
+
+(require 'package)
+(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/") t)
+(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
+(add-to-list 'package-archives '("melpa-stable" . "http://melpa-stable.milkbox.net/packages/") t)
+(add-to-list 'package-archives '("marmalde" . "http://marmalade-repo.org/packages/") t)
+(package-initialize)
+
+(if (not (package-installed-p 'use-package))
+    (progn (package-refresh-contents)
+	   (package-install 'use-package)))
+(require 'use-package)
+
 ;
 ; Minimal UI
 ;


; show column numbers too
(column-number-mode 1)

(custom-set-variables
 ;; custom-set-variables was added by Custom.

 ;; If there is more than one, they won't work right.
 )

(use-package autopair
  :ensure
  :diminish autopair
  :idle
  (autopair-global-mode))

; battery status
(use-package fancy-battery
  :ensure
  :idle
  (fancy-battery-mode))

;
; Navigation
;

(use-package ido
  :ensure
  :config
  (progn
    (setq ido-everywhere t)
    (setq ido-enable-flex-matching t))
  :init
  (ido-mode 1))

(use-package ido-vertical-mode
  :ensure
  :init
  (ido-vertical-mode))

(use-package ido-ubiquitous
  :ensure
  :init
  (ido-ubiquitous-mode))

(use-package flx-ido
  :ensure
  ; :config
  ; (setq ido-use-faces nil)
  :init
  (flx-ido-mode 1))

(use-package imenu
  :ensure)

(use-package idomenu
  :ensure
  :bind
  ("C-c i" . idomenu))

(use-package smex
  :ensure
  :config
  (setq smex-key-advice-ignore-menu-bar t)
  :bind
  ("M-x" . smex)
  :init
  (smex-initialize))

;
; Buffers
;

(use-package popwin
  :ensure
  :config
  (popwin-mode 1))

(use-package uniquify
  :config
  (progn
    (setq uniquify-strip-comon-prefix t)
    (setq uniquify-buffer-name-style 'forward)))

;
; Projects
;

(use-package projectile
  :ensure
  :config
  (projectile-global-mode))


(use-package magit
  :ensure
  :commands magit-status)

;
; Auto-Complete
;

(use-package auto-complete
  :ensure
  :init
  (progn
    (require 'auto-complete-config)
    (ac-config-default)
    (setq ac-auto-show-menu 0.2)
    (setq ac-auto-start 0)
    (setq ac-candidate-menu-min 1)
    (setq ac-delay 0.2)
    (setq ac-disable-inline t)
    (setq ac-quick-help-delay 1)
    (setq ac-quick-help-height 60)
    (setq ac-show-menu-immediately-on-auto-complete t)
    (setq ac-use-quick-help t)
    (global-auto-complete-mode)))

;
; Snippets
;
(use-package yasnippet
  :ensure
  :idle
  :config
  (progn
    (add-to-list 'yas-snippet-dirs "~/.emacs.d/snippets/")
    (yas--initialize)))


;
; Flycheck
;

(use-package flycheck
  :ensure
  :idle (global-flycheck-mode))

;
; Set up packages/settings for different modes
