Skip to content

Instantly share code, notes, and snippets.

Created Sep 27, 2015
What would you like to do?

Emacs Configuration File

(defun tangle-init ()
  "If the current buffer is '' the code-blocks are
   tangled, and the tangled file is compiled."
  (when (equal (buffer-file-name)
               (expand-file-name (concat user-emacs-directory "")))
    ;; Avoid running hooks when tangling.
    (let ((prog-mode-hook nil))
      (byte-compile-file (concat user-emacs-directory "init.el")))))

(add-hook 'after-save-hook 'tangle-init)
(setq package-archives
      '(("gnu" . "")
        ("org" . "")
        ("melpa" . "")))
(add-to-list 'auto-mode-alist '("\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
(setq web-mode-markup-indent-offset 2)
(setq web-mode-css-indent-offset 2)
(setq web-mode-code-indent-offset 2)
(setq web-mode-style-padding 1)
(setq web-mode-script-padding 1)
(setq web-mode-enable-css-colorization t)
(add-hook 'js2-mode-hook 'skewer-mode)
(add-hook 'css-mode-hook 'skewer-css-mode)
(add-hook 'html-mode-hook 'skewer-html-mode)
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
(add-to-list 'interpreter-mode-alist '("node" . js2-mode))
(add-hook 'js2-mode-hook #'js2-refactor-mode)
(add-hook 'js2-mode-hook #'js2-highlight-vars-mode)
(add-hook 'after-init-hook 'helm-mode)
(add-hook 'after-init-hook 'projectile-global-mode)
(add-hook 'projectile-mode-hook 'helm-projectile-on)
(add-hook 'after-init-hook 'global-company-mode)
(with-eval-after-load 'company
  (add-to-list 'company-backends 'company-tern)
  (add-to-list 'company-backends 'company-math-symbols-unicode)
  (company-quickhelp-mode 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment