Last active
October 21, 2018 16:24
-
-
Save agarman/e0eed5ff2989f938ef2cf81be9b448bd to your computer and use it in GitHub Desktop.
Dumped spacemacs for my own .emacs
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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;; https://gist.github.com/agarman/e0eed5ff2989f938ef2cf81be9b448bd | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;; Setup packages | |
(package-initialize) | |
(add-to-list 'package-archives | |
'("melpa-stable" . "https://stable.melpa.org/packages/") t) | |
(add-to-list 'package-archives | |
'("melpa" . "https://melpa.org/packages/") t) | |
;; refresh packages | |
(unless package-archive-contents | |
(package-refresh-contents)) | |
(defun do-install (package) | |
(unless (package-installed-p package) | |
(package-install package))) | |
;; making emacs lovely | |
(do-install 'exec-path-from-shell) | |
(do-install 'better-defaults) | |
(do-install 'smooth-scrolling) | |
(do-install 'monokai-theme) | |
;; making emacs schwifty | |
(do-install 'org) | |
(do-install 'neotree) | |
(do-install 'which-key) | |
(do-install 'undo-tree) | |
;; turning emacs into an IDE | |
(do-install 'company) | |
(do-install 'magit) | |
(do-install 'flycheck) | |
(do-install 'paredit) | |
;; working in Clojure | |
(do-install 'cider) | |
(do-install 'clj-refactor) | |
(do-install 'jdecomp) | |
(do-install 'sayid) | |
;; working with Elixir/Erlang | |
(do-install 'alchemist) | |
;; working with Rust | |
(do-install 'rust-mode) | |
(do-install 'cargo) | |
(do-install 'racer) | |
(do-install 'flycheck-rust) ;; only in Melpa | |
;; working with JavaScript / TypeScript | |
(do-install 'js2-mode) | |
(do-install 'tide) | |
;; working with various markdowns | |
(do-install 'markdown-mode) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;; setup brew dependencies | |
(setq brew-list '(ack cfr-decompiler git ghostscript leiningen unoconv)) | |
(defun brew-cmd (brew) | |
(let ((brew (symbol-name brew))) | |
(concat | |
"$(x=\"$(brew ls --versions " brew ")\"; if [ -z \"$x\" ]; then " | |
"$(nohup brew install " brew " >/dev/null 2>&1 &)" | |
"; fi)&echo"))) | |
(defun brew-install () | |
(dolist (brew brew-list) | |
(shell-command (brew-cmd brew)))) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; my customizations | |
;; keybindings | |
(global-set-key (kbd "C-c y") 'bury-buffer) | |
(global-set-key (kbd "C-c b") 'org-iswitchb) | |
(global-set-key (kbd "M-SPC") 'just-one-space) | |
(global-set-key (kbd "<s-return>") 'toggle-frame-fullscreen) | |
;; hooks | |
(add-hook 'after-init-hook 'menu-bar-mode) | |
(add-hook 'before-save-hook 'whitespace-cleanup) | |
;;; adding collapse keys because compojure-api sucks!!! | |
(add-hook 'prog-mode-hook #'hs-minor-mode) | |
(global-set-key (kbd "C-c <right>") 'hs-show-block) | |
(global-set-key (kbd "C-c <left>") 'hs-hide-block) | |
(defun indent-buffer () | |
"Indent current buffer according to major mode." | |
(interactive) | |
(indent-region (point-min) (point-max))) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; customize from packages | |
;; Force GUI emacs to use shell-path from bash | |
(when (package-installed-p 'exec-path-from-shell) | |
(add-hook 'after-init-hook #'exec-path-from-shell-initialize)) | |
;; neotree | |
(when (package-installed-p 'neotree) | |
(global-set-key [f8] 'neotree-toggle)) | |
;; global undo | |
(when (package-installed-p 'undo-tree) | |
(add-hook 'after-init-hook 'global-undo-tree-mode) | |
(setq undo-tree-visualizer-timestamps t)) | |
(when (package-installed-p 'whick-key) | |
(add-hook 'after-init-hook 'which-key-mode)) | |
(when (package-installed-p 'company) | |
(add-hook 'after-init-hook 'global-company-mode) | |
(setq company-tooltip-align-annotations t)) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;; elisp customizations | |
(add-hook 'emacs-lisp-mode-hook #'paredit-mode) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;; Org customizations | |
(when (package-installed-p 'org) | |
(setq org-bullets-bullet-list '("■" "◆" "▲" "▶")) | |
(setq org-hide-emphasis-markers t) | |
(setq org-html-htmlize-output-type 'css) | |
(add-hook 'org-mode-hook #'adaptive-wrap-prefix-mode) | |
(add-hook 'org-mode-hook #'visual-line-mode)) | |
;;; Org-babel setup | |
(with-eval-after-load 'org-mode | |
(require 'ob-clojurescript) | |
(require 'ob-typescript) | |
(org-babel-do-load-languages | |
'org-babel-load-languages | |
'((emacs-lisp . t) | |
(shell . t) | |
(js . t) | |
(typescript . t) | |
(clojurescript . t) | |
(http . t) | |
)) | |
) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;; magit setup | |
(when (package-installed-p 'magit) | |
(global-set-key (kbd "C-x g") 'magit-status) | |
(global-set-key (kbd "C-x M-g") 'magit-dispatch-popup) | |
(global-set-key (kbd "C-x M-b") 'magit-blame)) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;; Clojure customizations | |
(when (package-installed-p 'cider) | |
(add-hook 'clojure-mode-hook #'paredit-mode) | |
(add-hook 'clojure-mode-hook #'subword-mode) | |
(add-hook 'cider-repl-mode-hook #'paredit-mode)) | |
;;; sayid | |
(when (package-installed-p 'sayid) | |
(eval-after-load 'clojure-mode '(sayid-setup-package))) | |
;;; jdecomp | |
(when (package-installed-p 'jdecomp) | |
(defun cfr-jar () | |
"Finds the cfr Java decompiler jar" | |
(let* ((cmd "find $(dirname $(dirname $(realpath $(which cfr-decompiler)))) -name '*.jar'") | |
(j (shell-command-to-string cmd)) | |
(len (length j))) | |
(seq-take j (- len 1)))) | |
(setq jdecomp-decompiler-paths (list (cons 'cfr (cfr-jar)))) | |
(setq jdecomp-mode t)) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;; rust customizations | |
(with-eval-after-load 'rust-mode | |
(add-hook 'rust-mode-hook | |
(lambda () | |
(local-set-key (kbd "C-c <tab>") #'rust-format-buffer))) | |
(add-hook 'flycheck-mode-hook #'flycheck-rust-setup)) | |
(with-eval-after-load 'racer-mode | |
(setq racer-cmd "~/.cargo/bin/racer") ;; Rustup binaries PATH | |
(setq racer-rust-src-path "/Users/agarman/oss/rust/src") ;; Rust source code PATH | |
(add-hook 'rust-mode-hook #'racer-mode) | |
(add-hook 'racer-mode-hook #'eldoc-mode) | |
(add-hook 'racer-mode-hook #'company-mode) | |
(add-hook 'flycheck-mode-hook #'flycheck-rust-setup)) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;; JavaScript / TypeScript setup | |
(defun setup-tide-mode () | |
(interactive) | |
(tide-setup) | |
(flycheck-mode +1) | |
(setq flycheck-check-syntax-automatically '(save mode-enabled)) | |
(eldoc-mode +1) | |
(tide-hl-identifier-mode +1) | |
(company-mode +1)) | |
(when (package-installed-p 'tide) | |
(add-hook 'typescript-mode-hook #'setup-tide-mode) | |
(when (package-installed-p 'js2-mode) | |
(add-hook 'js2-mode-hook #'setup-tide-mode))) | |
(when (package-installed-p 'js2-mode) | |
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode)) | |
(add-to-list 'interpreter-mode-alist '("node" . js2-mode))) | |
(with-eval-after-load 'tide-mode | |
(define-key tide-mode-map (kbd "C-c C-k") 'tide-compile-file)) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;; standard customization | |
(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. | |
'(calendar-hebrew-all-holidays-flag t) | |
'(custom-safe-themes | |
(quote | |
("5f27195e3f4b85ac50c1e2fac080f0dd6535440891c54fcfa62cdcefedf56b1b" default))) | |
'(js-indent-level 2) | |
'(package-selected-packages | |
(quote | |
(ob-clojurescript ob-http ob-typescript typescript-formatter html markdown-mode tide js2-mode flycheck-rust racer cargo rust-mode alchemist sayid jdecomp clj-refactor cider paredit flycheck magit neotree monokai-theme smooth-scrolling better-defaults exec-path-from-shell which-key undo-tree typescript-mode pkg-info org dash company aggressive-indent)))) | |
(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. | |
'(default ((t (:height 120 :family "Fira Code"))))) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; theme | |
(defun load-theme-monokai () | |
(load-theme 'monokai t)) | |
(when (package-installed-p 'monokai-theme) | |
(add-hook 'after-init-hook 'load-theme-monokai)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment