Skip to content

Instantly share code, notes, and snippets.

@khebbie
Last active May 26, 2017 13:21
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khebbie/fd2fcfd4416387709dda to your computer and use it in GitHub Desktop.
Save khebbie/fd2fcfd4416387709dda to your computer and use it in GitHub Desktop.
(defun dotspacemacs/layers ()
(setq-default
dotspacemacs-configuration-layer-path '()
dotspacemacs-delete-orphan-packages t
dotspacemacs-distribution 'spacemacs
dotspacemacs-configuration-layers
`((auto-completion :variables
auto-completion-return-key-behavior nil
auto-completion-tab-key-behavior 'cycle
:disabled-for org erc)
c-c++
clojure
csharp
django
emacs-lisp
emoji
erc
ess
extra-langs
erlang
elixir
eyebrowse
games
git
github
haskell
html
(ibuffer :variables ibuffer-group-buffers-by nil)
javascript
latex
markdown
org
python
ranger
ruby
semantic
(shell :variables shell-default-shell 'eshell)
shell-scripts
(syntax-checking :variables syntax-checking-enable-by-default nil)
unimpaired
version-control
yaml
erc
fsharp
csharp
,@(unless (string= system-type "windows-nt")
'(
gtags
(spell-checking :variables
spell-checking-enable-by-default nil)
spotify))
)
dotspacemacs-additional-packages
'(flycheck-package
helm-flx
helm-flycheck
help-fns+
nameless
nginx-mode
lorem-ipsum)
dotspacemacs-excluded-packages
`(julia-mode
,@(when (string= system-type "windows-nt")
'(evil-mc)))))
(defun dotspacemacs/init ()
(setq-default
dotspacemacs-editing-style 'vim
dotspacemacs-startup-banner nil
dotspacemacs-startup-lists '(recents bookmarks projects)
dotspacemacs-default-font '("SourceCode Pro"
:size 18
:weight normal
:width normal
:powerline-offset 2)
dotspacemacs-themes
'(monokai material spacemacs-dark spacemacs-light solarized-dark leuven zenburn)
dotspacemacs-colorize-cursor-according-to-state t
dotspacemacs-leader-key "SPC"
dotspacemacs-emacs-leader-key "M-m"
dotspacemacs-major-mode-leader-key ","
dotspacemacs-major-mode-emacs-leader-key "C-M-m"
dotspacemacs-command-key ":"
dotspacemacs-remap-Y-to-y$ t
dotspacemacs-auto-save-file-location 'cache
dotspacemacs-use-ido nil
dotspacemacs-helm-resize t
dotspacemacs-helm-no-header nil
dotspacemacs-helm-position 'bottom
dotspacemacs-enable-paste-micro-state nil
dotspacemacs-which-key-delay 0.4
dotspacemacs-loading-progress-bar t
dotspacemacs-fullscreen-at-startup nil
dotspacemacs-fullscreen-use-non-native nil
dotspacemacs-maximized-at-startup nil
dotspacemacs-active-transparency 90
dotspacemacs-inactive-transparency 90
dotspacemacs-mode-line-unicode-symbols nil
dotspacemacs-smooth-scrolling t
dotspacemacs-smartparens-strict-mode nil
dotspacemacs-highlight-delimiters 'all
dotspacemacs-persistent-server nil
dotspacemacs-search-tools '("ag" "pt" "ack" "grep")
dotspacemacs-default-package-repository nil))
(defun dotspacemacs/user-init ()
(setq-default
;; Miscellaneous
vc-follow-symlinks t
ring-bell-function 'ignore
indent-tabs-mode nil
system-time-locale "C"
;; Backups
backup-directory-alist `((".*" . ,temporary-file-directory))
auto-save-file-name-transforms `((".*" ,temporary-file-directory t))
backup-by-copying t
delete-old-versions t
kept-new-versions 6
kept-old-versions 2
make-backup-files nil
;; Evil
evil-shift-round nil
;; Whitespace mode
whitespace-style '(face tabs tab-mark)
whitespace-display-mappings
'((newline-mark 10 [172 10])
(tab-mark 9 [9655 9]))
;; Smartparens
sp-highlight-pair-overlay nil
sp-highlight-wrap-overlay nil
sp-highlight-wrap-tag-overlay nil
;; Magit
magit-push-always-verify nil
;; Flycheck
flycheck-check-syntax-automatically '(save mode-enabled)
;; Avy
avy-all-windows 'all-frames
;; LaTeX
font-latex-fontify-script nil
TeX-newline-function 'reindent-then-newline-and-indent
shell-default-term-shell "/bin/zsh"
;; Web
web-mode-markup-indent-offset 2
web-mode-css-indent-offset 2
;; Emacs Lisp
nameless-global-aliases
'(("sm" . "spacemacs")
("dsm" . "dotspacemacs")
("cfl" . "configuration-layer")
("sl" . "spaceline"))
nameless-discover-current-name nil
nameless-prefix ""
nameless-separator nil
;; Org
org-tags-column -80
org-clock-into-drawer "LOGBOOK"
org-log-into-drawer "LOGBOOK"
org-startup-align-all-tables t
org-footnote-auto-adjust t
org-footnote-auto-label 'confirm
org-M-RET-may-split-line
'((headline . nil) (item . nil) (table . nil))
org-directory "~/org"
org-default-notes-file "~/org/capture.org"
org-capture-templates
'(("t" "Tasks")
("tg" "General" entry (file+headline "" "Tasks")
"* TODO %?\n%i\n%T"
:empty-lines 1)
("tl" "Location" entry (file+headline "" "Tasks")
"* TODO %?\n%i\n%T\n%a"
:empty-lines 1)
("n" "Notes")
("ng" "General" entry (file+headline "" "Notes")
"* %?\n%i\n%T"
:empty-lines 1)
("nl" "Location" entry (file+headline "" "Notes")
"* %?\n%i\n%T\n%a"
:empty-lines 1))
;; IRC
erc-autojoin-channels-alist
'(("1\\.0\\.0" "#syl20bnr/spacemacs") ; Gitter
("freenode\\.net" "#emacs, #elixir-lang, #ruby, #csharp"))
erc-timestamp-format-left "\n%A %B %e, %Y\n\n"
erc-timestamp-format-right "%HH:%MM"
erc-timestamp-right-column 80
erc-prompt-for-nickserv-password nil
erc-image-inline-rescale 300
erc-hide-list '("JOIN" "PART" "QUIT" "NICK")
erc-foolish-content
'("\\[Github\\].* starred"
"\\[Github\\].* forked"
"\\[Github\\].* synchronize a Pull Request"
"\\[Github\\].* labeled an issue in"
"\\[Github\\].* unlabeled an issue in")
;; Theme modifications
modify-theme-modifications
'((monokai
(company-tooltip-annotation
((t (:foreground "#ff9eb8" :background "#49483e"))))
(erc-timestamp-face
((t (:inherit font-lock-comment-face :foreground nil))))
(evil-search-highlight-persist-highlight-face
((t (:background "#fc5fef" :foreground "#000000"))))
(font-lock-comment-face ((t (:slant italic))))
(font-lock-string-face ((t (:slant italic))))
(font-lock-doc-face ((t (:slant italic))))
(font-lock-keyword-face ((t (:weight bold))))
(font-lock-builtin-face ((t (:foreground "#ff9eb8"))))
(font-lock-warning-face ((t (:underline nil))))
(region ((t (:background "#998f84"))))
(term ((t (:foreground nil :background nil))))
(web-mode-html-attr-value-face
((t (:inherit font-lock-string-face :foreground nil))))
(web-mode-html-attr-name-face
((t (:inherit font-lock-variable-name-face :foreground nil))))
(web-mode-html-tag-face
((t (:inherit font-lock-builtin-face :foreground nil :weight bold))))
(web-mode-html-tag-bracket-face
((t (:inherit web-mode-html-tag-face :foreground nil))))
(web-mode-comment-face
((t (:inherit font-lock-comment-face :foreground nil)))))
(t
(font-latex-slide-title-face
((t (:inherit font-lock-type-face :height 1.0 :weight bold)))))))
)
(defun dotspacemacs/user-config ()
;; Utility functions
(defun bb/define-key (keymap &rest bindings)
(declare (indent 1))
(while bindings
(define-key keymap (pop bindings) (pop bindings))))
(defmacro bb/remove-from-list (list-var element)
`(setq ,list-var (remove ,element ,list-var)))
;; Settings
(setq-default
tab-width 8
evil-move-beyond-eol nil
helm-echo-input-in-header-line nil
auto-mode-alist
(append '(("\\.xml\\'" . web-mode)
("\\.xinp\\'" . web-mode)
("\\.C\\'" . c++-mode)
("\\.h\\'" . c++-mode))
auto-mode-alist))
;; Keybindings
(bb/define-key evil-normal-state-map
"+" 'spacemacs/evil-numbers-increase
"_" 'spacemacs/evil-numbers-decrease
"\\" 'evil-repeat-find-char-reverse
"[s" (lambda (n) (interactive "p") (dotimes (c n nil) (insert " ")))
"]s" (lambda (n) (interactive "p")
(forward-char) (dotimes (c n nil) (insert " ")) (backward-char (1+ n))))
(bb/define-key evil-motion-state-map
(kbd "<backspace>") 'helm-M-x)
(evil-leader/set-key
"ec" 'flycheck-clear
"os" 'just-one-space
"ot" 'helm-etags-select
"ov" 'evilmi-select-items
"oh" (defun bb/highlight ()
(interactive)
(hlt-highlight-region)
(keyboard-quit))
"oH" (defun bb/unhighlight ()
(interactive)
(hlt-unhighlight-region)
(keyboard-quit)))
(bb/define-key company-active-map
(kbd "C-w") 'evil-delete-backward-word)
;; Miscellaneous
(add-hook 'text-mode-hook 'auto-fill-mode)
(add-hook 'dired-mode-hook 'deer)
(add-hook 'makefile-mode-hook 'whitespace-mode)
;; Diminish
(when (eq 'hybrid dotspacemacs-editing-style)
(diminish 'hybrid-mode))
(with-eval-after-load 'emoji-cheat-sheet-plus
(diminish 'emoji-cheat-sheet-plus-display-mode))
(unless (spacemacs/system-is-mswindows)
(with-eval-after-load 'helm-gtags
(diminish 'helm-gtags-mode)))
;; Disable smartparens highlighting
(with-eval-after-load 'smartparens
(show-smartparens-global-mode -1))
;; Semantic fucks up scrolling
(with-eval-after-load 'semantic
(bb/remove-from-list semantic-submode-list 'global-semantic-stickyfunc-mode))
;; Some fixes for comint-style buffers
(dolist (mode '(erc-mode comint-mode term-mode eshell-mode inferior-emacs-lisp-mode))
(bb/remove-from-list evil-insert-state-modes mode))
(let ((comint-hooks '(eshell-mode-hook
term-mode-hook
erc-mode-hook
messages-buffer-mode-hook
inferior-emacs-lisp-mode-hook
inferior-python-mode-hook)))
(spacemacs/add-to-hooks (defun bb/no-hl-line-mode ()
(setq-local global-hl-line-mode nil))
comint-hooks)
(spacemacs/add-to-hooks (defun bb/no-scroll-margin ()
(setq-local scroll-margin 0))
comint-hooks))
(add-hook 'inferior-emacs-lisp-mode-hook 'smartparens-mode)
;; Org
(add-hook 'org-mode-hook 'auto-fill-mode)
(evil-leader/set-key-for-mode 'org-mode
"m*" 'org-ctrl-c-star
"m RET" 'org-ctrl-c-ret
"m-" 'org-ctrl-c-minus)
;; IRC
(add-hook 'erc-insert-pre-hook
(defun bb/erc-foolish-filter (msg)
"Ignores messages matching `erc-foolish-content'."
(when (erc-list-match erc-foolish-content msg)
(setq erc-insert-this nil))))
(defun bb/erc-github-filter ()
"Shortens messages from gitter."
(interactive)
(when (and (< 18 (- (point-max) (point-min)))
(string= (buffer-substring (point-min)
(+ (point-min) 18))
"<gitter> [Github] "))
(dolist (regexp '(" \\[Github\\]"
" \\(?:in\\|to\\) [^ /]+/[^ /:]+"))
(goto-char (point-min))
(when (re-search-forward regexp (point-max) t)
(replace-match "")))
(goto-char (point-min))
(when (re-search-forward
"https?://github\\.com/[^/]+/[^/]+/[^/]+/\\([[:digit:]]+\\)\\([^[:space:]]*\\)?"
(point-max) t)
(let* ((url (match-string 0))
(number (match-string 1))
(start (+ 1 (match-beginning 0)))
(end (+ 1 (length number) start)))
(replace-match (format "(#%s)" (match-string 1)))
(erc-button-add-button start end 'browse-url nil (list url)))
)))
(with-eval-after-load 'erc
(setq erc-insert-modify-hook
'(erc-controls-highlight
erc-button-add-buttons
bb/erc-github-filter
erc-fill
erc-match-message
erc-add-timestamp
erc-hl-nicks)))
(add-hook 'erc-mode-hook 'emoji-cheat-sheet-plus-display-mode)
(dolist (module '(track youtube image))
(bb/remove-from-list erc-modules module))
(with-eval-after-load 'erc
(erc-track-mode -1))
(evil-leader/set-key
"aiq" 'erc-quit-server
"aig" (defun bb/gitter ()
(interactive)
(erc-tls :server "irc.gitter.im"
:port "6667"
:nick "TheBB"
:password bb/gitter-pwd
:full-name bb/full-name))
"aif" (defun bb/freenode ()
(interactive)
(erc :server "irc.freenode.net"
:port "6667"
:nick "TheBB"
:full-name bb/full-name)))
;; Modeline separators
(setq powerline-default-separator 'alternate)
;; Evilification
(spacemacs|evilify-map package-menu-mode-map
:mode package-menu-mode)
(with-eval-after-load 'haskell-mode
(spacemacs|evilify-map haskell-error-mode-map
:mode haskell-error-mode))
;; Additional packages
(use-package flycheck-package
:defer t
:init
(with-eval-after-load 'flycheck
(flycheck-package-setup)))
(use-package helm-flx
:config
(helm-flx-mode))
(use-package helm-flycheck
:defer t
:init
(evil-leader/set-key "eh" 'helm-flycheck))
(require 'help-fns+)
(use-package lorem-ipsum
:defer t)
(use-package nginx-mode
:defer t
:mode ("nginx\\.conf\\'" "/etc/nginx/.*\\'"))
(use-package nameless
:defer t
:init
(progn
(add-hook 'emacs-lisp-mode-hook 'nameless-mode-from-hook)
(spacemacs|add-toggle nameless
:status nameless-mode
:on (nameless-mode)
:off (nameless-mode -1)
:evil-leader-for-mode (emacs-lisp-mode . "mo:"))))
(use-package warnings
:defer t
:config
(push '(undo discard-info) warning-suppress-types))
;; Load local
(when (file-exists-p "~/local.el")
(load "~/local.el"))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment