Skip to content

Instantly share code, notes, and snippets.

@alloy-d
Last active June 24, 2016 13:34
Show Gist options
  • Save alloy-d/e90e8e8b1437586fba3f to your computer and use it in GitHub Desktop.
Save alloy-d/e90e8e8b1437586fba3f to your computer and use it in GitHub Desktop.
(add-to-list 'exec-path "/usr/local/bin")
(setenv "PATH" (concat "/usr/local/bin:" (getenv "PATH")))
(add-to-list 'exec-path "/Users/adam/.rbenv/shims/bundle")
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/") t)
(add-to-list 'package-pinned-packages '(cider . "melpa-stable") t)
(package-initialize)
;; TODO: this probably isn't complete. It also doesn't really work.
(defvar wanted-packages '(arduino-mode
bundler
cider
clojure-mode
color-theme
company
dockerfile-mode
emamux
enh-ruby-mode
fish-mode
flycheck
go-mode
helm
helm-ack
helm-projectile
jsx-mode
less-css-mode
markdown-mode
molokai-theme
nginx-mode
paredit
projectile
py-autopep8
rainbow-delimiters
salt-mode
scss-mode
smartparens
terraform-mode
undo-tree
web-mode
yaml-mode))
(dolist (p wanted-packages)
(unless (package-installed-p p)
(package-refresh-contents)
(package-install p)))
(autoload 'clojure-mode "clojure-mode"
"A major mode for editing Clojure code.")
(add-to-list 'auto-mode-alist '("\\.rb\\'" . enh-ruby-mode))
(add-to-list 'auto-mode-alist '("\\.thor\\'" . enh-ruby-mode))
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.jsx?\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.css\\'" . web-mode))
(setq web-mode-engines-alist
'(("jsx" . "\\.js\\.")
("jsx" . "\\.jsx")))
(setq standard-indent 2)
(setq-default web-mode-attr-indent-offset 2)
(setq-default web-mode-code-indent-offset 2)
(setq-default web-mode-css-indent-offset 2)
(setq-default web-mode-markup-indent-offset 2)
(setq-default web-mode-style-padding 2)
(setq-default web-mode-script-padding 2)
(setq-default css-indent-offset 2)
(require 'projectile)
(projectile-global-mode)
(require 'flycheck)
(flycheck-define-checker jsxhint-checker
"A JSX syntax and style checker based on JSXHint."
:command ("jsxhint" (config-file "--config" flycheck-jsxhintrc) source)
:error-patterns
((error line-start (1+ nonl) ": line " line ", col " column ", " (message) line-end))
:modes (web-mode))
(flycheck-def-config-file-var flycheck-jsxhintrc jsxhint-checker ".jshintrc")
(add-hook 'web-mode-hook
(lambda ()
(when (equal web-mode-content-type "jsx")
;; enable flycheck
(flycheck-select-checker 'jsxhint-checker)
(flycheck-mode))))
(require 'helm-config)
(require 'helm-projectile)
(helm-projectile-on)
(autoload 'rainbow-delimiters-mode "rainbow-delimiters"
"A minor mode for highlighting delimiters according to their depth.")
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
(autoload 'enable-paredit-mode "paredit"
"Turn on pseudo-structural editing of Lisp code." t)
(add-hook 'clojure-mode-hook #'enable-paredit-mode)
(add-hook 'emacs-lisp-mode-hook #'enable-paredit-mode)
(add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode)
(add-hook 'lisp-mode-hook #'enable-paredit-mode)
(add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode)
(add-hook 'scheme-mode-hook #'enable-paredit-mode)
(require 'smartparens-config)
(add-hook 'clojure-mode-hook 'smartparens-strict-mode)
(add-hook 'emacs-lisp-mode-hook 'smartparens-strict-mode)
(require 'uniquify)
(setq uniquify-buffer-name-style 'forward)
(autoload 'py-autopep8-enable-on-save "py-autopep8"
"Run Python code through autopep8 on save." t)
(add-hook 'python-mode-hook #'py-autopep8-enable-on-save)
(add-hook 'after-init-hook 'global-company-mode)
(add-hook 'after-init-hook #'global-flycheck-mode)
(ido-mode t)
(setq ido-enable-flex-matching t)
;; Make the command key behave as meta.
(setq mac-command-modifier 'meta)
;; I can't imagine wanting this outside of a terminal.
(global-unset-key "\C-z")
(global-set-key "\C-w" 'backward-kill-word)
(global-set-key "\C-m" 'comment-indent-new-line)
(global-set-key "\C-x\C-m" 'execute-extended-command)
(global-set-key "\M-v" 'yank)
(global-set-key "\C-x\C-k" 'kill-region)
;; Ido binds C-w to do almost precisely the opposite of what I want.
(define-key ido-file-completion-map "\C-w" 'backward-kill-word)
;; Use undo-tree-mode *everywhere*!
(global-undo-tree-mode)
;; Show column numbers in the status bar.
(column-number-mode 1)
;; Turn off that silly-looking fringe!
(fringe-mode 0)
;; Highlight the current line.
(global-hl-line-mode 1)
;; Don't show scrollbars.
(scroll-bar-mode 0)
;; Highlight matching parentheses.
(show-paren-mode 1)
;; Don't show the toolbar.
(tool-bar-mode 0)
;;(set-default-font
;; "-apple-Inconsolata-medium-normal-normal-*-20-*-*-*-m-0-iso10646-1")
;; (add-to-list 'default-frame-alist
;; '(font . "-apple-Inconsolata-medium-normal-normal-*-14-*-*-*-m-0-iso10646-1"))
(add-to-list 'default-frame-alist
'(font . "-*-Input Mono Narrow-normal-normal-extracondensed-*-14-*-*-*-m-0-iso10646-1"))
(setq inhibit-startup-screen t)
(setq ring-bell-function 'ignore)
(setq shell-command-file "/bin/sh")
(setq-default indent-tabs-mode nil)
(setq-default tab-width 2)
;; Add a newline to the end of the file both when opening it and when saving it.
(setq require-final-newline 'visit-save)
;; Trim trailing whitespace when saving.
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(setq
backup-by-copying t ; don't clobber symlinks
backup-directory-alist
'(("." . "~/.saves")) ; don't litter my fs tree
delete-old-versions t
kept-new-versions 6
kept-old-versions 2
version-control t) ; use versioned backups
;(setq inf-ruby-default-implementation "pry")
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(ansi-color-faces-vector
[default bold shadow italic underline bold bold-italic bold])
'(ansi-color-names-vector
(vector "#4d4d4c" "#c82829" "#718c00" "#eab700" "#4271ae" "#8959a8" "#3e999f" "#ffffff"))
'(custom-enabled-themes (quote (sanityinc-tomorrow-night)))
'(custom-safe-themes
(quote
("06f0b439b62164c6f8f84fdda32b62fb50b6d00e8b01c2208e55543a6337433a" "628278136f88aa1a151bb2d6c8a86bf2b7631fbea5f0f76cba2a0079cd910f7d" "bb08c73af94ee74453c90422485b29e5643b73b05e8de029a6909af6a3fb3f58" "82d2cac368ccdec2fcc7573f24c3f79654b78bf133096f9b40c20d97ec1d8016" default)))
'(enh-ruby-check-syntax nil)
'(enh-ruby-deep-indent-paren nil)
'(fci-rule-color "#d6d6d6")
'(vc-annotate-background nil)
'(vc-annotate-color-map
(quote
((20 . "#c82829")
(40 . "#f5871f")
(60 . "#eab700")
(80 . "#718c00")
(100 . "#3e999f")
(120 . "#4271ae")
(140 . "#8959a8")
(160 . "#c82829")
(180 . "#f5871f")
(200 . "#eab700")
(220 . "#718c00")
(240 . "#3e999f")
(260 . "#4271ae")
(280 . "#8959a8")
(300 . "#c82829")
(320 . "#f5871f")
(340 . "#eab700")
(360 . "#718c00"))))
'(vc-annotate-very-old-color nil))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(load-theme 'molokai t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment