Skip to content

Instantly share code, notes, and snippets.

@curtiswilkinson
Last active November 13, 2017 10:02
Show Gist options
  • Save curtiswilkinson/c0961f815bd503cd8e34d951321e06c9 to your computer and use it in GitHub Desktop.
Save curtiswilkinson/c0961f815bd503cd8e34d951321e06c9 to your computer and use it in GitHub Desktop.
Emacs Config
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
dotspacemacs-distribution 'spacemacs
dotspacemacs-enable-lazy-installation 'unused
dotspacemacs-ask-for-lazy-installation t
dotspacemacs-configuration-layer-path '()
dotspacemacs-configuration-layers
'(
sql
ocaml
rust
(colors :variables colors-enable-nyan-cat-progress-bar t)
haskell
html
reason
idris
yaml
python
(elm :variables
elm-format-command "elm-format-0.17")
javascript
typescript
helm
auto-completion
better-defaults
emacs-lisp
git
markdown
org
themes-megapack
(shell :variables
shell-default-height 30
shell-default-position 'bottom)
syntax-checking
version-control
games
)
dotspacemacs-additional-packages '(
prettier-js
evil-easymotion
)
dotspacemacs-frozen-packages '()
dotspacemacs-excluded-packages '()
dotspacemacs-install-packages 'used-only))
(defun my-setup-indent (n)
(setq c-basic-offset n)
(setq coffee-tab-width n) ; coffeescript
(setq javascript-indent-level n) ; javascript-mode
(setq js-indent-level n) ; js-mode
(setq js2-basic-offset n) ; js2-mode, in latest js2-mode, it's alias of js-indent-level
(setq web-mode-markup-indent-offset n) ; web-mode, html tag in html file
(setq web-mode-css-indent-offset n) ; web-mode, css in html file
(setq web-mode-code-indent-offset n) ; web-mode, js code in html file
(setq css-indent-offset n) ; css-mode
(setq typescript-indent-level n)
)
(defun dotspacemacs/init ()
"Initialization function.
This function is called at the very startup of Spacemacs initialization
before layers configuration.
You should not put any user code in there besides modifying the variable
values."
(setq-default
dotspacemacs-elpa-https t
dotspacemacs-elpa-timeout 5
dotspacemacs-check-for-update nil
dotspacemacs-elpa-subdirectory nil
dotspacemacs-editing-style 'vim
dotspacemacs-verbose-loading nil
dotspacemacs-startup-banner 'official
dotspacemacs-startup-lists '((recents . 5)
(projects . 7))
dotspacemacs-startup-buffer-responsive t
dotspacemacs-scratch-mode 'text-mode
dotspacemacs-themes '(darkokai
)
dotspacemacs-colorize-cursor-according-to-state t
dotspacemacs-default-font '("Source Code Pro"
:size 14
:weight normal
:width normal
:powerline-scale 1.2)
dotspacemacs-leader-key "SPC"
dotspacemacs-emacs-command-key "SPC"
dotspacemacs-ex-command-key ":"
dotspacemacs-emacs-leader-key "M-m"
dotspacemacs-major-mode-leader-key ","
dotspacemacs-major-mode-emacs-leader-key "C-M-m"
dotspacemacs-distinguish-gui-tab nil
dotspacemacs-remap-Y-to-y$ nil
dotspacemacs-retain-visual-state-on-shift t
dotspacemacs-visual-line-move-text nil
dotspacemacs-ex-substitute-global nil
dotspacemacs-default-layout-name "Default"
dotspacemacs-display-default-layout nil
dotspacemacs-auto-resume-layouts nil
dotspacemacs-large-file-size 1
dotspacemacs-auto-save-file-location 'cache
dotspacemacs-max-rollback-slots 5
dotspacemacs-helm-resize nil
dotspacemacs-helm-no-header nil
dotspacemacs-helm-position 'bottom
dotspacemacs-helm-use-fuzzy 'always
dotspacemacs-enable-paste-transient-state nil
dotspacemacs-which-key-delay 0.4
dotspacemacs-which-key-position 'bottom
dotspacemacs-loading-progress-bar t
dotspacemacs-fullscreen-at-startup nil
dotspacemacs-fullscreen-use-non-native nil
dotspacemacs-maximized-at-startup 't
dotspacemacs-active-transparency 90
dotspacemacs-inactive-transparency 90
dotspacemacs-show-transient-state-title t
dotspacemacs-show-transient-state-color-guide t
dotspacemacs-mode-line-unicode-symbols t
dotspacemacs-smooth-scrolling t
dotspacemacs-line-numbers 't
dotspacemacs-folding-method 'evil
dotspacemacs-smartparens-strict-mode nil
dotspacemacs-smart-closing-parenthesis nil
dotspacemacs-highlight-delimiters 'all
dotspacemacs-persistent-server nil
dotspacemacs-search-tools '("ag" "pt" "ack" "grep")
dotspacemacs-default-package-repository nil
dotspacemacs-whitespace-cleanup nil
))
(defun dotspacemacs/user-init ()
(my-setup-indent 2) ; indent 2 spaces width
)
(defun dotspacemacs/user-config ()
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")
(load-theme 'zest t)
(require 'prettier-js)
"Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration. You are free to put any user code."
;;; scroll one line at a time (less "jumpy" than defaults)
(defun shell-cmd (cmd)
"Returns the stdout output of a shell command or nil if the command returned
an error"
(car (ignore-errors (apply 'process-lines (split-string cmd)))))
(setq mouse-wheel-scroll-amount '(2 ((shift) . 1))) ;; two lines at a time
(setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
(setq-default tab-width 2)
(setq indent-line-function 'insert-tab)
(defun add-column-fill ()
(spacemacs/toggle-fill-column-indicator))
(add-hook 'js2-mode-hook 'prettier-js-mode)
(add-hook 'typescript-mode-hook 'prettier-js-mode)
(add-hook 'web-mode-hook 'prettier-js-mode)
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . web-mode))
(add-hook 'reason-mode-hook (lambda ()
(add-hook 'before-save-hook 'refmt-before-save)))
(add-hook 'web-mode-hook
(lambda ()
(when (string-equal "tsx" (file-name-extension buffer-file-name))
(tide-setup)
(flycheck-mode +1)
(setq flycheck-check-syntax-automatically '(save mode-enabled))
(eldoc-mode +1)
(company-mode-on)))))
(add-hook 'web-mode-hook #'(lambda ()
(enable-minor-mod
'("\\.jsx?\\'" . prettier-js-mode))))
;; Do not write anything past this comment. This is where Emacs will
;; auto-generate custom variable definitions.
(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 "#cccccc" "#f2777a" "#99cc99" "#ffcc66" "#6699cc" "#cc99cc" "#66cccc" "#515151"))
'(custom-safe-themes
(quote
("6f444032c5f42a12ce47eaaf9ed62d3c8e1281dd9ea19248ff4ef7814c915478" "9f99b8b16934642f57728ce90b642091f4ea68f5826e39f98bc76aa35e4bd0a4" "b1167ce4e3d9da7c4665f29414c78a788b071abc8d82f326899c5deeb9ff1bcb" "91161b762f6120e9f585b9ea60a8bd9ac41ad19c4cb8b3942e0fc5c7b9896d24" "4ac99cd491805f04c16b156fca2fb5b48370bd1ead79ac0efb300a8fda84ce6a" default)))
'(evil-want-Y-yank-to-eol nil)
'(fci-rule-color "#515151" t)
'(flycheck-color-mode-line-face-to-color (quote mode-line-buffer-id))
'(standard-indent 2)
'(vc-annotate-background nil)
'(vc-annotate-color-map
(quote
((20 . "#f2777a")
(40 . "#f99157")
(60 . "#ffcc66")
(80 . "#99cc99")
(100 . "#66cccc")
(120 . "#6699cc")
(140 . "#cc99cc")
(160 . "#f2777a")
(180 . "#f99157")
(200 . "#ffcc66")
(220 . "#99cc99")
(240 . "#66cccc")
(260 . "#6699cc")
(280 . "#cc99cc")
(300 . "#f2777a")
(320 . "#f99157")
(340 . "#ffcc66")
(360 . "#99cc99"))))
'(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.
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment