Skip to content

Instantly share code, notes, and snippets.

@wkf
Created July 10, 2015 13:21
Show Gist options
  • Select an option

  • Save wkf/d66bbd9c492541ea6f20 to your computer and use it in GitHub Desktop.

Select an option

Save wkf/d66bbd9c492541ea6f20 to your computer and use it in GitHub Desktop.
;; -*- 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."
(setq-default
;; List of additional paths where to look for configuration layers.
;; Paths must have a trailing slash (ie. `~/.mycontribs/')
dotspacemacs-configuration-layer-path '()
;; List of configuration layers to load. If it is the symbol `all' instead
;; of a list then all discovered layers will be installed.
dotspacemacs-configuration-layers
'(
;; ----------------------------------------------------------------
;; Example of useful layers you may want to use right away.
;; Uncomment some layer names and press <SPC f e R> (Vim style) or
;; <M-m f e R> (Emacs style) to install them.
;; ----------------------------------------------------------------
;; auto-completion
;; better-defaults
osx
dash
floobits
go
org
lua
sql
rust
ruby
html
c-c++
scala
python
racket
haskell
clojure
javascript
emacs-lisp
shell-scripts
extra-langs
evil-commentary
syntax-checking
git
github
version-control
(auto-completion :variables
auto-completion-tab-key-behavior 'complete)
(shell :variables
shell-default-shell 'eshell)
)
;; List of additional packages that will be installed wihout being
;; wrapped in a layer. If you need some configuration for these
;; packages then consider to create a layer, you can also put the
;; configuration in `dotspacemacs/config'.
dotspacemacs-additional-packages '(
docker
fringe-helper
evil-smartparens
flycheck-clojure
flycheck-pos-tip
clojure-quick-repls
dockerfile-mode
eshell-prompt-extras
)
;; A list of packages and/or extensions that will not be install and loaded.
dotspacemacs-excluded-packages '(
evil-jumper
)
;; If non-nil spacemacs will delete any orphan packages, i.e. packages that
;; are declared in a layer which is not a member of
;; the list `dotspacemacs-configuration-layers'
dotspacemacs-delete-orphan-packages t))
(defun dotspacemacs/init ()
"Initialization function.
This function is called at the very startup of Spacemacs initialization
before layers configuration."
;; This setq-default sexp is an exhaustive list of all the supported
;; spacemacs settings.
(setq-default
;; Either `vim' or `emacs'. Evil is always enabled but if the variable
;; is `emacs' then the `holy-mode' is enabled at startup.
dotspacemacs-editing-style 'vim
;; If non nil output loading progress in `*Messages*' buffer.
dotspacemacs-verbose-loading nil
;; Specify the startup banner. Default value is `official', it displays
;; the official spacemacs logo. An integer value is the index of text
;; banner, `random' chooses a random text banner in `core/banners'
;; directory. A string value must be a path to an image format supported
;; by your Emacs build.
;; If the value is nil then no banner is displayed.
dotspacemacs-startup-banner 'official
;; List of items to show in the startup buffer. If nil it is disabled.
;; Possible values are: `recents' `bookmarks' `projects'."
dotspacemacs-startup-lists '(recents projects)
;; List of themes, the first of the list is loaded when spacemacs starts.
;; Press <SPC> T n to cycle to the next theme in the list (works great
;; with 2 themes variants, one dark and one light)
dotspacemacs-themes '(base16-eighties-dark
base16-eighties-light)
;; If non nil the cursor color matches the state color.
dotspacemacs-colorize-cursor-according-to-state t
;; Default font. `powerline-scale' allows to quickly tweak the mode-line
;; size to make separators look not too crappy.
dotspacemacs-default-font '("Anonymous Pro for Powerline"
:size 14
:weight normal
:width normal
:powerline-scale 1.5)
;; The leader key
dotspacemacs-leader-key ","
;; The leader key accessible in `emacs state' and `insert state'
dotspacemacs-emacs-leader-key "M-m"
;; Major mode leader key is a shortcut key which is the equivalent of
;; pressing `<leader> m`. Set it to `nil` to disable it.
dotspacemacs-major-mode-leader-key ","
;; Major mode leader key accessible in `emacs state' and `insert state'
dotspacemacs-major-mode-emacs-leader-key "C-M-m"
;; The command key used for Evil commands (ex-commands) and
;; Emacs commands (M-x).
;; By default the command key is `:' so ex-commands are executed like in Vim
;; with `:' and Emacs commands are executed with `<leader> :'.
dotspacemacs-command-key ":"
;; If non nil then `ido' replaces `helm' for some commands. For now only
;; `find-files' (SPC f f) is replaced.
dotspacemacs-use-ido nil
;; If non nil the paste micro-state is enabled. When enabled pressing `p`
;; several times cycle between the kill ring content.
dotspacemacs-enable-paste-micro-state nil
;; Guide-key delay in seconds. The Guide-key is the popup buffer listing
;; the commands bound to the current keystrokes.
dotspacemacs-guide-key-delay 0.4
;; If non nil a progress bar is displayed when spacemacs is loading. This
;; may increase the boot time on some systems and emacs builds, set it to
;; nil ;; to boost the loading time.
dotspacemacs-loading-progress-bar t
;; If non nil the frame is fullscreen when Emacs starts up.
;; (Emacs 24.4+ only)
dotspacemacs-fullscreen-at-startup nil
;; If non nil `spacemacs/toggle-fullscreen' will not use native fullscreen.
;; Use to disable fullscreen animations in OSX."
dotspacemacs-fullscreen-use-non-native t
;; If non nil the frame is maximized when Emacs starts up.
;; Takes effect only if `dotspacemacs-fullscreen-at-startup' is nil.
;; (Emacs 24.4+ only)
dotspacemacs-maximized-at-startup nil
;; A value from the range (0..100), in increasing opacity, which describes
;; the transparency level of a frame when it's active or selected.
;; Transparency can be toggled through `toggle-transparency'.
dotspacemacs-active-transparency 80
;; A value from the range (0..100), in increasing opacity, which describes
;; the transparency level of a frame when it's inactive or deselected.
;; Transparency can be toggled through `toggle-transparency'.
dotspacemacs-inactive-transparency 85
;; If non nil unicode symbols are displayed in the mode line.
dotspacemacs-mode-line-unicode-symbols t
;; If non nil smooth scrolling (native-scrolling) is enabled. Smooth
;; scrolling overrides the default behavior of Emacs which recenters the
;; point when it reaches the top or bottom of the screen.
dotspacemacs-smooth-scrolling t
;; If non-nil smartparens-strict-mode will be enabled in programming modes.
dotspacemacs-smartparens-strict-mode t
;; Select a scope to highlight delimiters. Possible value is `all',
;; `current' or `nil'. Default is `all'
dotspacemacs-highlight-delimiters 'all
;; If non nil advises quit functions to keep server open when quitting.
dotspacemacs-persistent-server nil
;; List of search tool executable names. Spacemacs uses the first installed
;; tool of the list. Supported tools are `ag', `pt', `ack' and `grep'.
dotspacemacs-search-tools '("ag" "pt" "ack" "grep")
;; The default package repository used if no explicit repository has been
;; specified with an installed package.
;; Not used for now.
dotspacemacs-default-package-repository nil
)
(setq
magit-repo-dirs '("~/Dropbox/Projects/"))
)
(defun dotspacemacs/config ()
"Configuration function.
This function is called at the very end of Spacemacs initialization after
layers configuration."
(global-linum-mode 1)
(setq frame-resize-pixelwise t
window-resize-pixelwise t)
;; (add-to-list 'initial-frame-alist `(alpha 95 95))
(add-to-list 'initial-frame-alist `(fullscreen . fullheight))
;; (add-to-list 'default-frame-alist `(alpha 95 95))
(add-to-list 'default-frame-alist `(fullscreen . fullheight))
(setq evil-cross-lines nil)
(setq evil-lisp-state-major-modes '(clojure-mode emacs-lisp-mode))
(setenv "MARATHON_USER" "mojo")
(setenv "MARATHON_PASS" "mojojojo")
(setenv "MARATHON_HOST" "https://marathon.withmojo.com")
(setenv "BUNSEN_ES" "bunsen:s6nFTwtbZP3wHh@e9ba949eb3f55a49001.qbox.io")
(setenv "DOCKER_TLS_VERIFY" "1")
(setenv "DOCKER_HOST" "tcp://192.168.59.103:2376")
(setenv "DOCKER_CERT_PATH" "/Users/will/.boot2docker/certs/boot2docker-vm")
(use-package helm
:config
(progn
(require 'helm-config)
(setq helm-display-header-line nil)
(define-key helm-map (kbd "TAB") 'helm-execute-persistent-action)))
(use-package flycheck
:config
(progn
(global-flycheck-mode 1)
(flycheck-clojure-setup)
(setq-default
flycheck-disabled-checkers '(emacs-lisp-checkdoc)
flycheck-emacs-lisp-load-path 'inherit
flycheck-emacs-lisp-initialize-packages t)))
(use-package flycheck-pos-tip
:config
(setq
flycheck-display-errors-function #'flycheck-pos-tip-error-messages))
(use-package auto-complete
:config
(progn
(require 'auto-complete-config)
(define-key ac-completing-map (kbd "C-n") 'ac-next)
(define-key ac-completing-map (kbd "C-p") 'ac-previous)))
(use-package company
:config
(progn
(define-key company-active-map (kbd "C-n") 'company-select-next)
(define-key company-active-map (kbd "C-p") 'company-select-previous)))
;; (use-package clojure-quick-repls
;; :config
;; (progn
;; (require 'cider)
;; (setq
;; cider-switch-to-repl-command 'clojure-quick-repls-switch-to-relevant-repl)))
(defun my-diff-hl-fringe-bmp-from-type (type _pos)
(cl-case type
(unknown 'question-mark)
(ignored 'diff-hl-bmp-i)
(t (intern (format "diff-hl-bmp-%s" type)))))
(use-package diff-hl
:config
(progn
(require 'fringe-helper)
(fringe-helper-define 'diff-hl-bmp-create nil
"..X...."
"..X...."
"XXXXX.."
"..X...."
"..X....")
(fringe-helper-define 'diff-hl-bmp-delete nil
"......."
"......."
"XXXXX.."
"......."
".......")
(fringe-helper-define 'diff-hl-bmp-change nil
".XXX..."
"XXXXX.."
"XXXXX.."
"XXXXX.."
".XXX...")))
(defun my-epe-theme ()
(concat
(when (epe-remote-p)
(epe-colorize-with-face
(concat (epe-remote-user) "@" (epe-remote-host) " ")
'eshell-ls-clutter-face))
(epe-colorize-with-face
(epe-abbrev-dir-name (eshell/pwd)) 'eshell-prompt-face)
(if (or (and (epe-remote-p)
(equal (epe-remote-user) "root"))
(= (user-uid) 0))
(epe-colorize-with-face " #" 'eshell-ls-missing-face)
(epe-colorize-with-face " $" 'eshell-ls-executable-face))
" "))
(use-package eshell
:config
(progn
(require 'eshell-prompt-extras)
(setq eshell-prompt-regexp "^[^#$\n]* [#$] "
eshell-prompt-function 'my-epe-theme)))
(defadvice eshell-gather-process-output (before absolute-cmd (command args) act)
(setq command (file-truename command)))
(defun my-eshell-mode-keys ()
(dolist (m (list evil-normal-state-local-map
evil-insert-state-local-map))
(define-key m (kbd "C-n") 'eshell-next-input)
(define-key m (kbd "C-p") 'eshell-previous-input)
(define-key m (kbd "C-r") 'helm-eshell-history)))
(add-hook 'eshell-mode-hook 'my-eshell-mode-keys)
(add-hook 'eshell-preoutput-filter-functions 'ansi-color-apply)
;;; Lisp configuration
(setq sp-navigate-consider-symbols t
sp-navigate-consider-stringlike-symbols t)
(defun my-evil-move-sexp (fun)
"Smartparens doesn't consider the opening paren to be part of a form, but I do, so make it so."
(lexical-let ((fun fun))
(lambda (count)
(interactive "p")
(if (string-match-p
"[{([]"
(string (char-after)))
(progn
(forward-char)
(funcall fun count)
(backward-char))
(funcall fun count)))))
(evil-define-motion my-backward-begin-sexp (count)
:type exclusive
(sp-backward-sexp count))
(evil-define-motion my-forward-end-sexp (count)
:type exclusive
(forward-char)
(sp-forward-sexp count)
(backward-char))
(evil-define-motion my-forward-begin-sexp (count)
:type exclusive
(sp-forward-sexp count)
(sp-skip-forward-to-symbol t nil nil))
(defun my-lisp-mode-keys ()
(define-key evil-operator-state-local-map "E" 'sp-forward-sexp)
(define-key evil-operator-state-local-map "W" 'sp-forward-sexp)
(define-key evil-operator-state-local-map "B" 'sp-backward-sexp)
(define-key evil-motion-state-local-map "E" 'my-forward-end-sexp)
(define-key evil-motion-state-local-map "W" 'my-forward-begin-sexp)
(define-key evil-motion-state-local-map "B" 'my-backward-begin-sexp)
(define-key evil-normal-state-local-map "gj" 'sp-join-sexp)
(define-key evil-normal-state-local-map "gs" 'sp-split-sexp)
(define-key evil-normal-state-local-map "gr" 'sp-raise-sexp)
(define-key evil-normal-state-local-map "gt" 'sp-transpose-sexp)
(define-key evil-normal-state-local-map (kbd "(") 'sp-beginning-of-sexp)
(define-key evil-normal-state-local-map (kbd ")") 'sp-end-of-sexp)
(define-key evil-normal-state-local-map (kbd ">") nil)
(define-key evil-normal-state-local-map (kbd "<") nil)
(define-key evil-normal-state-local-map (kbd "> >") (my-evil-move-sexp 'sp-forward-slurp-sexp))
(define-key evil-normal-state-local-map (kbd "> <") (my-evil-move-sexp 'sp-backward-barf-sexp))
(define-key evil-normal-state-local-map (kbd "< >") (my-evil-move-sexp 'sp-forward-barf-sexp))
(define-key evil-normal-state-local-map (kbd "< <") (my-evil-move-sexp 'sp-backward-slurp-sexp))
(define-key evil-normal-state-local-map (kbd "> (") 'sp-down-sexp)
(define-key evil-normal-state-local-map (kbd "> )") 'sp-up-sexp)
(define-key evil-normal-state-local-map (kbd "< )") 'sp-backward-down-sexp)
(define-key evil-normal-state-local-map (kbd "< (") 'sp-backward-up-sexp)
(define-key evil-normal-state-local-map (kbd "< i")
(lambda (count) (interactive "p") (sp-beginning-of-sexp count) (evil-insert-state)))
(define-key evil-normal-state-local-map (kbd "> i")
(lambda (count) (interactive "p") (sp-end-of-sexp count) (evil-insert-state))))
;; call this now because the emacs-lisp-mode-hook has already fired...
(my-lisp-mode-keys)
(add-hook 'clojure-mode-hook 'my-lisp-mode-keys)
(add-hook 'emacs-lisp-mode-hook 'my-lisp-mode-keys)
(evil-leader/set-key-for-mode 'emacs-lisp-mode
"mes" 'eval-sexp-fu-eval-sexp-inner-sexp)
(evil-leader/set-key-for-mode 'clojure-mode
"mes" 'eval-sexp-fu-cider-eval-sexp-inner-sexp)
(defun my-cider-repl-mode-keys ()
(dolist (m (list evil-normal-state-local-map
evil-insert-state-local-map))
(define-key m (kbd "C-n")
(lambda (count)
(interactive "p") (cider-repl-next-input)))
(define-key m (kbd "C-p")
(lambda (count)
(interactive "p") (cider-repl-previous-input)))))
(add-hook 'cider-repl-mode-hook 'my-cider-repl-mode-keys)
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(add-hook 'smartparens-enabled-hook 'evil-smartparens-mode)
(add-hook 'hack-local-variables-hook (lambda () (setq truncate-lines t)))
(dolist (m (list evil-normal-state-map
evil-insert-state-map))
(define-key m (kbd "C-h") 'windmove-left)
(define-key m (kbd "C-l") 'windmove-right)
(define-key m (kbd "C-k") 'windmove-up)
(define-key m (kbd "C-j") 'windmove-down))
;; like vim-unimpared, but more evil
(define-key evil-normal-state-map (kbd "[ SPC")
(lambda (count)
(interactive "p")
(save-excursion
(dotimes (i count)
(evil-insert-newline-above)))))
(define-key evil-normal-state-map (kbd "] SPC")
(lambda (count)
(interactive "p")
(save-excursion
(dotimes (i count)
(evil-insert-newline-below)))))
(setq vc-ignore-dir-regexp
(format "\\(%s\\)\\|\\(%s\\)"
vc-ignore-dir-regexp
tramp-file-name-regexp))
)
;; 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.
'(ac-quick-help-delay 1)
'(ahs-case-fold-search nil)
'(ahs-default-range (quote ahs-range-whole-buffer))
'(ahs-idle-interval 0.25)
'(ahs-idle-timer 0 t)
'(ahs-inhibit-face-list nil)
'(clean-aindent-mode t)
'(clojure-quick-repls-cljs-setup
"(require 'weasel.repl.websocket 'cemerick.piggieback)
(cemerick.piggieback/cljs-repl
:repl-env (weasel/repl-env :port 3451 :ip \"0.0.0.0\"))")
'(diff-hl-draw-borders nil)
'(diff-hl-fringe-bmp-function (quote my-diff-hl-fringe-bmp-from-type))
'(diff-hl-side (quote right))
'(eshell-directory-name "/Users/will/.emacs.d/.cache/eshell")
'(git-gutter:added-sign "+ ")
'(git-gutter:deleted-sign "- ")
'(git-gutter:modified-sign "| ")
'(global-diff-hl-mode t)
'(indent-tabs-mode nil)
'(ispell-highlight-face (quote flyspell-incorrect))
'(js-indent-level 2)
'(org-startup-indented t)
'(ring-bell-function (quote ignore) t)
'(standard-indent 2)
'(tab-always-indent (quote complete)))
(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.
'(clojure-keyword-face ((t (:inherit font-lock-keyword-face))))
'(company-tooltip-common ((t (:inherit company-tooltip :weight bold :underline nil))))
'(company-tooltip-common-selection ((t (:inherit company-tooltip-selection :weight bold :underline nil))))
'(diff-hl-change ((t (:foreground "#ffcc66"))))
'(diff-hl-delete ((t (:foreground "#f2777a"))))
'(diff-hl-insert ((t (:foreground "#99cc99"))))
'(eshell-ls-archive ((t (:foreground "#cc99cc"))))
'(eshell-ls-backup ((t (:foreground "#ffcc66"))))
'(eshell-ls-clutter ((t (:foreground "#f99157"))))
'(eshell-ls-directory ((t (:foreground "#6699cc"))))
'(eshell-ls-executable ((t (:foreground "#99cc99"))))
'(eshell-ls-missing ((t (:foreground "#f2777a"))))
'(eshell-ls-product ((t (:foreground "#ffcc66"))))
'(eshell-ls-readonly ((t (:foreground "#a09f93"))))
'(eshell-ls-special ((t (:foreground "#cc99cc"))))
'(eshell-ls-symlink ((t (:foreground "#66cccc"))))
'(eshell-ls-unreadable ((t (:foreground "#515151"))))
'(eshell-prompt ((t (:foreground "#cc99cc" :weight bold))))
'(fringe ((t (:background "#2d2d2d"))))
'(helm-source-header ((t (:background "#22083397778B" :foreground "white" :weight bold))))
'(linum ((t (:background "#2d2d2d" :foreground "#515151"))))
'(vertical-border ((t (:foreground "#515151"))))
'(window-divider ((t (:foreground "#515151")))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment