 (global-linum-mode 1) ; Show line numbers
 (column-number-mode 1) ; Show cursor column position
 (desktop-save-mode 1) ; Save/restore opened buffers
-(company-mode 1) ; Enable company mode
-(flycheck-mode 1) ; Enable flycheck
+
+;; Enable minor modes for given major modes
+(defun default-minor-modes ()
+  "Enable several minor modes that are generally applicable."
+  (interactive)
+  (flycheck-mode)
+  (company-mode)
+  (helm-mode)
+  (rainbow-mode)
+  )
+(add-hook 'text-mode-hook 'flyspell-mode)
+(add-hook 'web-mode 'default-minor-modes)
+(add-hook 'python-mode-hook 'default-minor-modes)
+(add-hook 'ruby-mode-hook 'default-minor-modes)
+(add-hook 'emacs-lisp-mode-hook 'default-minor-modes)
+(add-hook 'javascript-mode-hook 'default-minor-modes)
+(add-hook 'javascript-mode-hook 'tern-mode)
+
 
 ;; Use regex searches by default.
 (global-set-key (kbd "C-s") 'isearch-forward-regexp)

(electric-indent-mode +1)

(defun enable_flyspell ()
  (ispell-change-dictionary "american")
  (flyspell-prog-mode))


(add-to-list 'package-archives
   '("melpa" . "http://melpa.milkbox.net/packages/") t)
(add-to-list 'package-archives
   '("marmalade" . "http://marmalade-repo.org/packages/") t)
(defvar mac-option-key-is-meta nil)
(defvar mac-command-key-is-meta t)
(defvar mac-command-modifier 'meta)
(defvar mac-option-modifier nil)
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
