Last active
July 26, 2018 19:25
-
-
Save noahsussman/e6fb79581543a57449ed85c9645a32ee to your computer and use it in GitHub Desktop.
.emacs.d/init.el - Noah Sussman's configuration for Emacs 26 on OS X
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
;;; package --- Summary" | |
;;; Commentary: | |
;;; Noah Sussman's .emacs file | |
;;; Code: | |
(setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin:/usr/local/opt/curl/bin:/usr/local/opt/findutils/bin:/usr/local/opt/coreutils/libexec/gnubin:/Users/nsussman/Documents/toolchain/bin:/opt/local/bin")) | |
(require 'package) | |
(package-initialize) | |
(add-to-list 'load-path "~/.emacs.d/vendor/") | |
(require 'ido-hippie-expand) | |
(require 'i-ching) | |
(add-to-list 'package-archives | |
'("melpa" . | |
"http://melpa.milkbox.net/packages/") t) | |
(require 'anzu) | |
(require 'better-defaults) | |
(require 'browse-kill-ring) | |
(require 'hlinum) | |
(require 'rainbow-delimiters) | |
(require 'undohist) | |
(require 'key-chord) | |
(require 'color-theme) | |
(require 'recentf) | |
(require 'stripe-buffer) | |
(require 'flycheck) | |
(require 'nyan-mode) | |
(require 'persistent-scratch) | |
(persistent-scratch-setup-default) | |
(autoload 'tsv-mode "tsv-mode" "A mode to edit table like file" t) | |
(autoload 'tsv-normal-mode "tsv-mode" "A minor mode to edit table like file" t) | |
;; These lines cause Emacs to hang on new machine! | |
;; (require 'exec-path-from-shell) | |
;; (when (memq window-system '(mac ns)) | |
;; (exec-path-from-shell-initialize)) | |
; ALWAYS remind me there is a keyboard shortcut for that! | |
(setq suggest-key-bindings t) | |
(global-set-key "\C-x\ f" 'recentf-open-files) | |
; global hooks: | |
(add-hook 'find-file-hook 'recentf-save-list) | |
; add mode-specific hooks | |
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode) | |
(add-hook 'prog-mode-hook 'turn-on-stripe-buffer-mode) | |
(add-hook 'prog-mode-hook 'hl-line-mode) | |
;(add-hook 'prog-mode-hook 'idle-highlight) | |
;(add-hook 'completion-list-mode-hook 'idle-highlight) | |
(add-hook 'dired-mode-hook 'stripe-listify-buffer) | |
(add-hook 'ibuffer-mode-hook 'stripe-listify-buffer) | |
(add-hook 'recentf-dialog-mode-hook 'stripe-listify-buffer) | |
(add-hook 'shell-mode-hook 'arcane/shell-mode-hook) | |
(add-hook 'gnuplot-mode-hook 'gnuplot-inline-image-mode) | |
(autoload 'markdown-mode "markdown-mode" | |
"Major mode for editing Markdown files" t) | |
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode)) | |
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) | |
; add global hooks | |
(add-hook 'before-save-hook 'delete-trailing-whitespace) | |
(add-hook 'after-init-hook 'global-flycheck-mode) | |
(add-hook 'after-init-hook 'arcane/setup-windows) | |
(add-hook 'after-init-hook 'arcane/toggle-fullscreen) | |
(defun arcane/toggle-fullscreen () | |
"Toggle full screen" | |
(interactive) | |
(set-frame-parameter | |
nil 'fullscreen | |
(when (not (frame-parameter nil 'fullscreen)) 'fullboth))) | |
(defun arcane/setup-windows () | |
(interactive) | |
; (split-window-horizontally) | |
(split-window-vertically) | |
(other-window 1) | |
(recentf-open-files) | |
; (other-window 1) | |
; (ansi-term "/bin/bash" "*Arcane shell*") | |
; (other-window 1) | |
(other-window 1)) | |
(defun arcane/shell-mode-hook () | |
"Allow using arrow keys for cmd history, etc. in Shell Mode" | |
(local-set-key '[up] 'comint-previous-input) | |
(local-set-key '[down] 'comint-next-input) | |
(local-set-key '[(shift tab)] 'comint-next-matching-input-from-input) | |
(setq comint-scroll-to-bottom-on-output all)) | |
; http://www.masteringemacs.org/articles/2011/01/27/find-files-faster-recent-files-package/ | |
(defun arcane/ido-recentf-open () | |
"Use `ido-completing-read' to \\[find-file] a recent file" | |
(interactive) | |
(if (find-file (ido-completing-read "Open recent: " recentf-list)) | |
(message "Opening file...") | |
(message "Aborting"))) | |
(defun arcane/undo-fill-paragraph () | |
"fill individual paragraphs with large fill column" | |
(interactive) | |
(let ((fill-column 100000)) | |
(fill-individual-paragraphs (point-min) (point-max)))) | |
(defun arcane/replace-garbage-chars () | |
"Replace goofy MS and other garbage characters with latin1 equivalents. cf. http://www.emacswiki.org/emacs/ReplaceGarbageChars" | |
(interactive) | |
(save-excursion ;save the current point | |
(replace-string "”" "\"" nil (point-min) (point-max)) | |
(replace-string "΄" "\"" nil (point-min) (point-max)) | |
(replace-string "“" "\"" nil (point-min) (point-max)) | |
(replace-string "’" "'" nil (point-min) (point-max)) | |
(replace-string "“" "\"" nil (point-min) (point-max)) | |
(replace-string "—" "--" nil (point-min) (point-max)) ; multi-byte | |
(replace-string "" "'" nil (point-min) (point-max)) | |
(replace-string "" "'" nil (point-min) (point-max)) | |
(replace-string "" "\"" nil (point-min) (point-max)) | |
(replace-string "" "\"" nil (point-min) (point-max)) | |
(replace-string "" "\"" nil (point-min) (point-max)) | |
(replace-string "" "\"" nil (point-min) (point-max)) | |
(replace-string "‘" "\"" nil (point-min) (point-max)) | |
(replace-string "’" "'" nil (point-min) (point-max)) | |
(replace-string "¡\"" "\"" nil (point-min) (point-max)) | |
(replace-string "¡" "..." nil (point-min) (point-max)) | |
(replace-string " " "..." nil (point-min) (point-max)) | |
(replace-string "" " " nil (point-min) (point-max)) ; M-SPC | |
(replace-string "" "`" nil (point-min) (point-max)) ; \221 | |
(replace-string "" "'" nil (point-min) (point-max)) ; \222 | |
(replace-string "" "``" nil (point-min) (point-max)) | |
(replace-string "" "''" nil (point-min) (point-max)) | |
(replace-string "" "*" nil (point-min) (point-max)) | |
(replace-string "" "--" nil (point-min) (point-max)) | |
(replace-string "" "--" nil (point-min) (point-max)) | |
(replace-string " " " " nil (point-min) (point-max)) ; M-SPC | |
(replace-string "¡" "\"" nil (point-min) (point-max)) | |
(replace-string "´" "\"" nil (point-min) (point-max)) | |
(replace-string "»" "<<" nil (point-min) (point-max)) | |
(replace-string "Ç" "'" nil (point-min) (point-max)) | |
(replace-string "È" "\"" nil (point-min) (point-max)) | |
(replace-string "é" "e" nil (point-min) (point-max)) ;; é | |
(replace-string "ó" "-" nil (point-min) (point-max)) | |
)) | |
; UI display styles | |
(set-face-attribute 'default nil :font "Consolas 18") | |
; activate various packages that require activation | |
(undohist-initialize) | |
(hlinum-activate) | |
(key-chord-mode 1) | |
(setq-default abbrev-mode t) | |
(setq save-abbrevs t) | |
(setq-default truncate-lines t) | |
; Display 'current match/total matches' in the mode-line in various | |
; search modes. | |
(global-anzu-mode +1) | |
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode)) | |
(add-to-list 'auto-mode-alist '("\\.gnu\\'" . gnuplot-mode)) | |
(add-to-list 'auto-mode-alist '("\\.gnuplot\\'" . gnuplot-mode)) | |
(add-to-list 'auto-mode-alist '("\\.plot\\'" . gnuplot-mode)) | |
(add-to-list 'auto-mode-alist '("\\.gp\\'" . gnuplot-mode)) | |
; globally disable auto-fill-mode | |
(auto-fill-mode -1) | |
(remove-hook 'text-mode-hook 'turn-on-auto-fill) | |
(remove-hook 'prog-mode-hook 'turn-on-auto-fill) | |
; use unified diff | |
(setq diff-switches "-u") | |
; stop asking for a yes/no answer | |
(fset 'yes-or-no-p 'y-or-n-p) | |
; Don't show splash screen on startup | |
(setq inhibit-splash-screen t) | |
; save every keystroke to a backup file! | |
(open-dribble-file "~/.emacs.d/dribble") | |
; map keyboard | |
(browse-kill-ring-default-keybindings) | |
(global-set-key (kbd "C-x f") 'arcane/ido-recentf-open) | |
(global-set-key (kbd "C-x M-x") 'repeat-complex-command) | |
(global-set-key (kbd "C-x v c") 'vc-diff) | |
(global-set-key (kbd "C-?") 'transparency-set-value) | |
(global-set-key (kbd "C->") 'transparency-increase) | |
(global-set-key (kbd "C-<") 'transparency-decrease) | |
; UNBIND keys that serve no purpose except to press them by accident | |
(global-unset-key "\C-z") | |
(global-unset-key (kbd "C-x C-c")) | |
; chords that are under my fingers / right hand: | |
(key-chord-define-global "jj" 'save-buffer) | |
(key-chord-define-global ";;" 'vc-next-action) | |
(key-chord-define-global "uu" 'magit-diff-unstaged) | |
; left hand-under-fingers chords | |
(key-chord-define-global "jk" 'ido-switch-buffer) | |
(key-chord-define-global "qq" 'isearch-forward-regexp) | |
; more left-hand chords | |
(key-chord-define-global "``" 'delete-other-windows) | |
(key-chord-define-global "`1" 'other-window) | |
(key-chord-define-global "`2" 'ibuffer) | |
(key-chord-define-global "`3" 'magit-status) | |
; bind repeat complex command to C-x M-x | |
(global-set-key [24 27 120] (quote repeat-complex-command)) | |
; DO NOT use C-x C-c to quit -- too easy to type by accident | |
(global-unset-key "") | |
; Set Size of the Kill-Ring and other histories that we use constantly | |
(setq kill-ring-max 500) | |
(setq extended-command-history-max 500) | |
(setq query-replace-history-max 500) | |
(setq replace-string-history-max 500) | |
(setq file-name-history-max 500) | |
(setq replace-regex-history-max 500) | |
(setq minibuffer-history-max 1000) | |
(setq shell-command-history-max 1000) | |
(setq find-file-history-max 1000) | |
; Fix for "empty or unsupported pasteboard type" error when trying to | |
; cut/paste. See: | |
; http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-08/msg00353.html | |
(defun ns-get-pasteboard () | |
"Returns the value of the pasteboard, or nil for unsupported formats." | |
(condition-case nil | |
(ns-get-selection-internal 'CLIPBOARD) | |
(quit 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. | |
;; Your init file should contain only one such instance. | |
;; If there is more than one, they won't work right. | |
'(ansi-color-names-vector | |
["#2e3436" "#a40000" "#4e9a06" "#c4a000" "#204a87" "#5c3566" "#729fcf" "#eeeeec"]) | |
'(better-registers-use-C-r nil) | |
'(column-number-mode t) | |
'(custom-safe-themes | |
(quote | |
("c74e83f8aa4c78a121b52146eadb792c9facc5b1f02c917e3dbb454fca931223" "3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "a27c00821ccfd5a78b01e4f35dc056706dd9ede09a8b90c6955ae6a390eb1c1e" "2affb26fb9a1b9325f05f4233d08ccbba7ec6e0c99c64681895219f964aac7af" "1a93b9b08961240cfe1df39c0c66743100ed5c4d7ee1dc6024c65203bd864725" default))) | |
'(display-time-24hr-format t) | |
'(display-time-default-load-average nil) | |
'(display-time-mode t) | |
'(enable-recursive-minibuffers t) | |
'(exec-path | |
(quote | |
("/usr/bin" "/bin" "/usr/sbin" "/sbin" "/Applications/MacPorts/Emacs.app/Contents/MacOS/bin-x86_64-10_9" "/Applications/MacPorts/Emacs.app/Contents/MacOS/libexec-x86_64-10_9" "/Users/build/workspace/Emacs-Multi-Build/label/mavericks/emacs-source/nextstep/Emacs.app/Contents/MacOS/libexec" "/usr/local/bin" "/opt/local/bin"))) | |
'(flycheck-completion-system (quote grizzl)) | |
'(global-hl-line-mode t) | |
'(global-whitespace-mode t) | |
'(indent-tabs-mode nil) | |
'(js-indent-level 2) | |
'(js2-mode-show-strict-warnings nil) | |
'(markdown-command "/usr/local/bin/maruku") | |
'(package-selected-packages | |
(quote | |
(counsel-etags bats-mode flycheck-demjsonlint all-the-icons-dired fireplace idle-highlight-mode browse-kill-ring flycheck-yamllint cucumber-goto-step pickle chess epoch-view anzu bash-completion better-defaults better-registers browse-kill-ring+ color-theme csv-mode editorconfig editorconfig-domain-specific exec-path-from-shell flycheck hlinum jq-mode js2-mode json-mode key-chord markdown-mode minimap nyan-mode persistent-scratch php-mode rainbow-delimiters smart-mode-line stripe-buffer terraform-mode undohist yaml-mode))) | |
'(recentf-exclude (quote ("\\.emacs\\.d/elpa/" "Applications/Emacs\\.app/"))) | |
'(recentf-max-menu-items 20) | |
'(recentf-max-saved-items 500) | |
'(recentf-mode t) | |
'(savehist-additional-variables | |
(quote | |
(kill-ring search-ring regexp-search-ring extended-command-history query-replace-history replace-string-history file-name-history replace-regex-history minibuffer-history shell-command-history find-file-history))) | |
'(savehist-mode t) | |
'(sort-fold-case t t) | |
'(tab-stop-list (quote (2))) | |
'(time-stamp-format "%:y-%02m-%02d %02H:%02M:%02S %z") | |
'(whitespace-line-column 80) | |
'(whitespace-style | |
(quote | |
(face tabs spaces trailing lines-tail space-before-tab newline indentation empty space-after-tab space-mark tab-mark))) | |
'(word-wrap t)) | |
(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. | |
'(whitespace-space ((((class color) (background dark)) (:background "gray11" :foreground "gray20"))))) | |
(color-theme-initialize) | |
(color-theme-calm-forest) | |
(put 'narrow-to-region 'disabled nil) | |
(put 'upcase-region 'disabled nil) | |
(put 'downcase-region 'disabled nil) | |
(set-face-attribute 'font-lock-builtin-face nil :foreground "DodgerBlue") | |
(set-face-attribute 'font-lock-comment-face nil :foreground "gray65") | |
(set-face-attribute 'font-lock-doc-face nil :foreground "olivedrab1") | |
(set-face-attribute 'font-lock-string-face nil :foreground "olivedrab1") | |
(set-face-attribute 'highlight nil :background "#022B00") | |
(set-face-attribute 'stripe-highlight nil :background "#1c1c1c") | |
(setq visible-bell nil) | |
;; Show the full path to a file. | |
;; http://stackoverflow.com/questions/3669511/the-function-to-show-current-files-full-path-in-mini-buffer | |
;; Note you can also just type M-: buffer-file-name RET | |
(setq frame-title-format | |
(list (format "%s %%S: %%j " (system-name)) | |
'(buffer-file-name "%f" (dired-directory dired-directory "%b")))) | |
(defun arcane/path-to-file () | |
"Show the full path file name in the minibuffer." | |
(interactive) | |
(message (buffer-file-name))) | |
(defun path () | |
"Same as M-X arcane/path-to-file" | |
(interactive) | |
(arcane/path-to-file)) | |
;; mode-line customization | |
;; __ ___ | |
;; ____ ___ ____ ____/ /__ / (_)___ ___ | |
;; / __ `__ \/ __ \/ __ / _ \ / / / __ \/ _ \ | |
;; / / / / / / /_/ / /_/ / __/ / / / / / / __/ | |
;; /_/ /_/ /_/\____/\__,_/\___/ /_/_/_/ /_/\___/ | |
;; | |
;; __ _ __ _ | |
;; _______ _______/ /_____ ____ ___ (_)___ ____ _/ /_(_)___ ____ | |
;; / ___/ / / / ___/ __/ __ \/ __ `__ \/ /_ / / __ `/ __/ / __ \/ __ \ | |
;; / /__/ /_/ (__ ) /_/ /_/ / / / / / / / / /_/ /_/ / /_/ / /_/ / / / / | |
;; \___/\__,_/____/\__/\____/_/ /_/ /_/_/ /___/\__,_/\__/_/\____/_/ /_/ | |
;; remove '-default' to test locally | |
(setq-default mode-line-format | |
'("%e" | |
mode-line-front-space | |
mode-line-modified | |
" " | |
mode-line-buffer-identification | |
" " | |
mode-line-position | |
mode-line-misc-info | |
" " | |
(vc-mode vc-mode) | |
" " | |
mode-line-mule-info | |
" " | |
mode-line-modes | |
" " | |
mode-line-end-spaces)) | |
(display-battery-mode 1) | |
(nyan-mode) | |
; (nyan-start-animation) | |
(set-variable (quote nyan-wavy-trail) t nil) | |
(require 'better-registers) | |
(better-registers-install-save-registers-hook) | |
(load better-registers-save-file) | |
; | |
;; Fix graphviz-dot-preview | |
(fset 'graphviz-preview | |
[?\C-c ?c return ?\C-c ?p]) | |
;; Make frames transparent by default | |
(set-frame-parameter (selected-frame) 'alpha '(85 . 50)) | |
(add-to-list 'default-frame-alist '(alpha . (85 . 50))) | |
(add-hook 'before-save-hook 'time-stamp) | |
(server-start nil) | |
(provide 'init) | |
;;; init.el ends here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment