Created
March 10, 2018 13:16
-
-
Save isido/ffc1d1eedc2115a7fc57969f83bf078c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(setq inhibit-startup-screen t) | |
(setq custom-file "~/.emacs.d/custom-settings.el") | |
(load custom-file t) | |
;; Packages | |
(require 'package) | |
(add-to-list 'package-archives | |
'("marmalade" . "http://marmalade-repo.org/packages/")) | |
(add-to-list 'package-archives | |
'("melpa" . "https://melpa.org/packages/") t) | |
(package-initialize) | |
;; use-package | |
;; see https://github.com/eastwood/config/blob/master/emacs.d/org-init.org | |
(unless (package-installed-p 'use-package) | |
(package-refresh-contents) | |
(package-install 'use-package)) | |
;; OS X tweaks | |
(setq mac-option-modifier nil | |
mac-command-modifier 'meta | |
x-select-enable-clipboard t) | |
;; OSX fix for eslint lookup | |
(use-package exec-path-from-shell | |
:ensure t | |
:config | |
(when (memq window-system '(mac ns)) | |
(exec-path-from-shell-initialize))) | |
;; For Homebrew | |
(let ((default-directory "/usr/local/share/emacs/site-lisp/")) | |
(normal-top-level-add-subdirs-to-load-path)) | |
;; CCrypt | |
(require 'ps-ccrypt) | |
;(require 'evil) | |
;(evil-mode 1) | |
;; Clojure | |
; Cider (package cider paredit rainbow-delimiters) | |
(add-hook 'clojure-mode-hook 'cider-mode) | |
(add-hook 'clojure-mode-hook 'paredit-mode) | |
(add-hook 'clojure-mode-hook 'rainbow-delimiters-mode) | |
(add-hook 'cider-repl-mode-hook #'eldoc-mode) | |
(add-hook 'cider-repl-mode-hook #'paredit-mode) | |
;; Go | |
(require 'go-mode) | |
(defun go-mode-setup () | |
(go-eldoc-setup) | |
(setq gofmt-command "goimports") | |
(local-set-key (kbd "M-.") 'godef-jump) | |
(setq compile-command "go build -v && go test -v && go vet -shadow") | |
(define-key (current-local-map) "\C-c\C-c" 'compile) | |
(add-hook 'before-save-hook 'gofmt-before-save)) | |
(add-hook 'go-mode-hook 'go-mode-setup) | |
;; Ruby | |
(require 'inf-ruby) | |
;; Scala | |
;(require 'ensime) | |
;(add-hook 'scala-mode-hook 'ensime-scala-mode-hook) | |
;; OCaml | |
; Opam | |
(setq opam-share (substring (shell-command-to-string "opam config var share 2> /dev/null") 0 -1)) | |
(add-to-list 'load-path (concat opam-share "/emacs/site-lisp")) | |
(require 'ocp-indent) | |
; Merlin | |
(require 'merlin) | |
(add-hook 'tuareg-mode-hook 'merlin-mode t) | |
(add-hook 'caml-mode-hook 'merlin-mode t) | |
(setq merlin-use-auto-complete-mode 'easy) | |
(setq merlin-command 'opam) | |
; Utop | |
(autoload 'utop "utop" "Toplevel for OCaml" t) | |
(autoload 'utop-minor-mode "utop" "Toplevel for OCaml" t) | |
(add-hook 'tuareg-mode-hook 'utop-minor-mode) | |
; Java and Eclim | |
;(require 'eclim) | |
;(add-hook 'java-mode-hook 'eclim-mode) | |
;(require 'gradle-mode) | |
;(add-hook 'java-mode-hook '(lambda () gradle-mode 1)) | |
;(add-to-list 'compilation-error-regexp-alist '(":compile.*?\\(/.*?\\):\\([0-9]+\\): " 1 2)) | |
;(require 'eclimd) | |
;(require 'company) | |
;(global-company-mode t) | |
;(require 'company-emacs-eclim) | |
;(company-emacs-eclim-setup) | |
;; FlyCheck | |
(use-package flycheck | |
:ensure t | |
:diminish flycheck-mode | |
:config | |
(add-hook 'prog-mode-hook 'flycheck-mode) | |
(setq-default flycheck-disabled-checker 'javascript-jshint) | |
(setq-default flycheck-disabled-checker 'json-jsonlist) | |
(setq-default flycheck-disabled-checker 'javascript-eslint) | |
(setq-default flycheck-javascript-eslint-executable "eslint-project-relative") | |
(flycheck-add-mode 'javascript-eslint 'web-mode) | |
(defun my/use-eslint-from-node-modules () | |
(let* ((root (locate-dominating-file | |
(or (buffer-file-name) default-directory) | |
"node_modules")) | |
(eslint (and root | |
(expand-file-name "node_modules/eslint/bin/eslint.js" | |
root)))) | |
(when (and eslint (file-executable-p eslint)) | |
(setq-local flycheck-javascript-eslint-executable eslint)))) | |
(add-hook 'flycheck-mode-hook #'my/use-eslint-from-node-modules) | |
;;; (with-eval-after-load 'flycheck | |
;;; (advice-add 'flycheck-eslint-config-exists-p :override (lambda() t))) | |
) | |
;; Javascript, eslint and related | |
(use-package json-mode | |
:ensure t) | |
(use-package web-mode | |
:ensure t | |
:config | |
(defun my-web-mode-hook () | |
"Hooks for Web mode. Adjust indents" | |
(setq web-mode-markup-indent-offset 2) | |
(setq web-mode-attr-indent-offset 2) | |
(setq web-mode-css-indent-offset 2) | |
(setq web-mode-code-indent-offset 2) | |
(setq css-indent-offset 2)) | |
(add-hook 'web-mode-hook 'my-web-mode-hook)) | |
(use-package js2-mode | |
:ensure t | |
:mode "\\.js\\'" | |
:config | |
(setq-default js2-ignored-warnings '("msg.extra.trailing.comma")) | |
(setq-default js2-strict-missing-semi-warning nil)) | |
;; see https://jamiecollinson.com/blog/my-emacs-config/ | |
; http://codewinds.com/blog/2015-04-02-emacs-flycheck-eslint-jsx.html | |
; yarn global add eslint babel-eslint | |
; package-install flycheck js2-mode json-mode web-mode | |
;(require 'js2-mode) | |
;(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode)) | |
;(add-to-list 'auto-mode-alist '("\\.jsx$" . web-mode)) | |
;(setq-default flycheck-disabled-checkers | |
; (append flycheck-disabled-checkers | |
; '(javascript-jshint))) | |
;(flycheck-add-mode 'javascript-eslint 'web-mode) | |
;(setq-default flycheck-disabled-checkers | |
; (append flycheck-disabled-checkers | |
; '(json-jsonlist))) | |
; adjust indents for web-mode to 2 spaces | |
(defun my-web-mode-hook () | |
"Hooks for Web mode. Adjust indents" | |
;;; http://web-mode.org/ | |
(setq web-mode-markup-indent-offset 4) | |
(setq web-mode-css-indent-offset 4) | |
(setq web-mode-code-indent-offset 4)) | |
(add-hook 'web-mode-hook 'my-web-mode-hook) | |
(global-flycheck-mode) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment