;; -*- mode: lisp; -*-
(prefer-coding-system 'utf-8)
(menu-bar-mode 0)
(setq inhibit-startup-message t)
(setq initial-scratch-message "")
(setq vc-follow-symlinks t)

(add-to-list 'load-path "~/.emacs.d/manual")
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
                         ("marmalade" . "https://marmalade-repo.org/packages/")
			 ("melpa" . "http://melpa.milkbox.net/packages/")
                         ("elpy" . "http://jorgenschaefer.github.io/packages/")))
(package-initialize)
(osx-clipboard-mode +1)

(load-theme 'monokai t)
(require 'powerline)
(powerline-default-theme)

(setq backup-inhibited t)
(setq auto-save-default nil)
(setq require-final-newline t)
(setq mode-require-final-newline t)
(define-key global-map (kbd "RET") 'newline-and-indent)
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(setq-default indent-tabs-mode nil)

(global-hl-line-mode 1)
(set-face-background hl-line-face "#333")
(global-linum-mode 1)
(setq linum-format "%4d |")
(set-face-attribute 'linum nil :background "#000" :foreground "#FFF")
(global-git-gutter-mode 1)

(setq mouse-wheel-mode 0)
(setq mouse-wheel-up-event 0)
(setq mouse-wheel-down-event 0)
(require 'centered-cursor-mode)
(global-centered-cursor-mode +1)

(define-globalized-minor-mode global-fci-mode fci-mode (lambda () (fci-mode 1)))
(global-fci-mode 1)
(setq fci-rule-column 100)
(setq fci-rule-width 1)
(setq fci-rule-color "yellow")

;(setq sml/no-confirm-load-theme t)
;(sml/setup)

(display-time-mode 1)
(display-battery-mode 1)

(helm-mode 1)
(projectile-global-mode 1)
(global-set-key (kbd "C-c p s a") 'helm-projectile-ack)
(global-subword-mode 1)

(add-hook 'flymake-find-file-hook (lambda()
                                    (flymake-cursor-mode)))
(add-hook 'markdown-mode-hook (lambda()
                                (require 'poly-markdown)
                                (poly-markdown-mode 1)
                                (flyspell-mode 1)
                                ;(setq fill-column 80)
                                ;(auto-fill-mode)
                                (setq fci-rule-column 80)))
(add-hook 'python-mode-hook (lambda()
                              (elpy-mode)
                              (elpy-enable)
                              (setq python-indent 4)
                              (setq elpy-rpc-backend "jedi")
                              (highlight-indentation-mode 0)))
(add-hook 'go-mode-hook (lambda()
                          (auto-complete-mode)
                          (ac-config-default)
                          (require 'go-autocomplete)
                          (require 'auto-complete-config)
                          (load-file "/Users/brettlangdon/go/src/code.google.com/p/go.tools/cmd/oracle/oracle.el")
                          (go-oracle-mode)
                          (setq gofmt-command "goimports")
                          (local-set-key (kbd "M-.") 'godef-jump)
                          (add-hook 'before-save-hook #'gofmt-before-save)))
(add-hook 'js-mode-hook (lambda()
                          (flymake-jslint-load)
                          (flymake-cursor-mode)
                          (setq js2-include-node-externs t)
                          (setq js2-highlight-level 3)
                          (setq js2-mode-show-parse-errors nil)
                          (setq js2-mode-show-strict-warnings nil)
                          (js2-minor-mode)
                          (ac-js2-mode)
                          (company-mode)
                          (setq js-indent-level 2)
                          (setq flymak-jslint-args (mapcar
                                                    'symbol-name
                                                    '(--white --undef --nomen --regexp --plusplus --bitwise --newcap --sloppy --vars --eqeq --node)))))

(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
(add-to-list 'magic-mode-alist '("#!.*node" . js-mode))
