2015-09-16 09:24:25 +00:00
|
|
|
;;; config.el --- Spacemacs Base Layer configuration File
|
2015-01-14 04:12:56 +00:00
|
|
|
;;
|
|
|
|
;; Copyright (c) 2012-2014 Sylvain Benner
|
|
|
|
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
|
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
2014-12-11 16:22:55 +00:00
|
|
|
;; ---------------------------------------------------------------------------
|
2015-03-15 02:55:05 +00:00
|
|
|
;; Prefixes
|
2014-12-11 16:22:55 +00:00
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
|
2015-08-15 17:11:35 +00:00
|
|
|
;; We define prefix commands only for the sake of which-key
|
|
|
|
(setq spacemacs/key-binding-prefixes '(("a" "applications")
|
2015-09-26 15:06:16 +00:00
|
|
|
("ai" "irc")
|
|
|
|
("as" "shells")
|
2015-08-15 17:11:35 +00:00
|
|
|
("b" "buffers")
|
2015-09-26 15:06:16 +00:00
|
|
|
("bm" "move")
|
2015-08-15 17:11:35 +00:00
|
|
|
("c" "compile/comments")
|
|
|
|
("C" "capture/colors")
|
|
|
|
("e" "errors")
|
|
|
|
("f" "files")
|
2015-09-07 01:48:14 +00:00
|
|
|
("fC" "files/convert")
|
2015-09-26 15:06:16 +00:00
|
|
|
("fe" "emacs(spacemacs)")
|
2015-11-28 00:23:42 +00:00
|
|
|
("fv" "variables")
|
2015-08-15 17:11:35 +00:00
|
|
|
("g" "git/versions-control")
|
|
|
|
("h" "helm/help/highlight")
|
|
|
|
("hd" "help-describe")
|
|
|
|
("i" "insertion")
|
|
|
|
("j" "join/split")
|
|
|
|
("k" "lisp")
|
2015-09-26 15:06:16 +00:00
|
|
|
("kd" "delete")
|
|
|
|
("kD" "delete-backward")
|
|
|
|
("k`" "hybrid")
|
2015-08-15 17:11:35 +00:00
|
|
|
("n" "narrow/numbers")
|
|
|
|
("p" "projects")
|
|
|
|
("p$" "projects/shell")
|
|
|
|
("q" "quit")
|
|
|
|
("r" "registers/rings")
|
2015-11-28 00:23:42 +00:00
|
|
|
("Re" "elisp")
|
|
|
|
("Rp" "pcre")
|
2015-08-15 17:11:35 +00:00
|
|
|
("s" "search/symbol")
|
2015-09-26 15:06:16 +00:00
|
|
|
("sa" "ag")
|
|
|
|
("sg" "grep")
|
|
|
|
("sk" "ack")
|
|
|
|
("st" "pt")
|
|
|
|
("sw" "web")
|
2015-08-15 17:11:35 +00:00
|
|
|
("t" "toggles")
|
2015-09-26 15:06:16 +00:00
|
|
|
("tC" "colors")
|
|
|
|
("tE" "editing-styles")
|
|
|
|
("th" "highlight")
|
|
|
|
("tm" "modeline")
|
2015-12-09 23:53:29 +00:00
|
|
|
("T" "UI toggles/themes")
|
|
|
|
("C-t" "other toggles")
|
2015-08-15 17:11:35 +00:00
|
|
|
("w" "windows")
|
2015-09-26 15:06:16 +00:00
|
|
|
("wp" "popup")
|
2015-08-15 17:11:35 +00:00
|
|
|
("x" "text")
|
2015-09-26 15:06:16 +00:00
|
|
|
("xa" "align")
|
|
|
|
("xd" "delete")
|
|
|
|
("xg" "google-translate")
|
|
|
|
("xl" "lines")
|
|
|
|
("xm" "move")
|
|
|
|
("xt" "transpose")
|
|
|
|
("xw" "words")
|
2015-08-15 17:11:35 +00:00
|
|
|
("z" "zoom")))
|
|
|
|
(mapc (lambda (x) (apply #'spacemacs/declare-prefix x))
|
2014-12-11 16:22:55 +00:00
|
|
|
spacemacs/key-binding-prefixes)
|
|
|
|
|
2014-09-01 16:18:34 +00:00
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
;; Navigation
|
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
|
2015-09-08 01:16:15 +00:00
|
|
|
;; Auto refresh
|
2014-09-01 16:18:34 +00:00
|
|
|
(global-auto-revert-mode 1)
|
|
|
|
;; Also auto refresh dired, but be quiet about it
|
2015-03-15 02:55:05 +00:00
|
|
|
(setq global-auto-revert-non-file-buffers t
|
|
|
|
auto-revert-verbose nil)
|
2015-09-08 01:16:15 +00:00
|
|
|
|
2015-11-16 13:58:54 +00:00
|
|
|
;; Make dired "guess" target directory for some operations, like copy to
|
|
|
|
;; directory visited in other split buffer.
|
|
|
|
(setq dired-dwim-target t)
|
|
|
|
|
2015-04-13 19:29:46 +00:00
|
|
|
;; Regexp for useful and useless buffers for smarter buffer switching
|
|
|
|
(defvar spacemacs-useless-buffers-regexp '("*\.\+")
|
|
|
|
"Regexp used to determine if a buffer is not useful.")
|
|
|
|
(defvar spacemacs-useful-buffers-regexp '("\\*\\(scratch\\|terminal\.\+\\|ansi-term\\|eshell\\)\\*")
|
|
|
|
"Regexp used to define buffers that are useful despite matching
|
|
|
|
`spacemacs-useless-buffers-regexp'.")
|
2015-04-23 08:34:59 +00:00
|
|
|
|
2014-09-01 16:18:34 +00:00
|
|
|
;; no beep pleeeeeease ! (and no visual blinking too please)
|
2015-08-08 20:32:36 +00:00
|
|
|
(setq ring-bell-function 'ignore
|
|
|
|
visible-bell nil)
|
2014-09-01 16:18:34 +00:00
|
|
|
|
2014-12-11 04:23:51 +00:00
|
|
|
;; Hack to fix a bug with tabulated-list.el
|
|
|
|
;; see: http://redd.it/2dgy52
|
|
|
|
(defun tabulated-list-revert (&rest ignored)
|
|
|
|
"The `revert-buffer-function' for `tabulated-list-mode'.
|
|
|
|
It runs `tabulated-list-revert-hook', then calls `tabulated-list-print'."
|
|
|
|
(interactive)
|
|
|
|
(unless (derived-mode-p 'tabulated-list-mode)
|
|
|
|
(error "The current buffer is not in Tabulated List mode"))
|
|
|
|
(run-hooks 'tabulated-list-revert-hook)
|
|
|
|
;; hack is here
|
|
|
|
;; (tabulated-list-print t)
|
|
|
|
(tabulated-list-print))
|
|
|
|
|
2015-02-18 06:26:07 +00:00
|
|
|
;; Mouse cursor in terminal mode
|
2015-02-23 14:20:56 +00:00
|
|
|
(xterm-mouse-mode 1)
|
2015-02-18 06:26:07 +00:00
|
|
|
|
2015-03-29 12:24:59 +00:00
|
|
|
;; Highlight and allow to open http link at point in programming buffers
|
|
|
|
;; goto-address-prog-mode only highlights links in strings and comments
|
|
|
|
(add-hook 'prog-mode-hook 'goto-address-prog-mode)
|
2015-10-08 08:58:58 +00:00
|
|
|
;; Highlight and follow bug references in comments and strings
|
|
|
|
(add-hook 'prog-mode-hook 'bug-reference-prog-mode)
|
2015-03-29 12:24:59 +00:00
|
|
|
|
2015-10-07 19:05:45 +00:00
|
|
|
;; Keep focus while navigating help buffers
|
|
|
|
(setq help-window-select 't)
|
|
|
|
|
2015-10-25 09:46:47 +00:00
|
|
|
;; Scroll compilation to first error or end
|
|
|
|
(setq compilation-scroll-output 'first-error)
|
|
|
|
|
2014-09-01 16:18:34 +00:00
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
;; Edit
|
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
;; start scratch in text mode (usefull to get a faster Emacs load time
|
|
|
|
;; because it avoids autoloads of elisp modes)
|
|
|
|
(setq initial-major-mode 'text-mode)
|
2015-03-31 06:33:12 +00:00
|
|
|
|
2014-09-01 16:18:34 +00:00
|
|
|
;; use only spaces and no tabs
|
2015-03-15 02:55:05 +00:00
|
|
|
(setq-default indent-tabs-mode nil
|
2015-10-10 11:29:03 +00:00
|
|
|
tab-width 2)
|
2015-09-08 01:16:15 +00:00
|
|
|
|
2014-10-04 04:28:42 +00:00
|
|
|
;; Text
|
2014-09-01 16:18:34 +00:00
|
|
|
(setq longlines-show-hard-newlines t)
|
|
|
|
|
2014-11-29 03:47:03 +00:00
|
|
|
;; Use system trash for file deletion
|
|
|
|
;; should work on Windows and Linux distros
|
2015-07-06 13:43:20 +00:00
|
|
|
;; on OS X, see contrib/osx layer
|
2014-11-29 03:47:03 +00:00
|
|
|
(setq delete-by-moving-to-trash t)
|
|
|
|
|
2015-12-11 12:22:50 +00:00
|
|
|
;; auto fill breaks line beyond buffer's fill-column
|
|
|
|
(setq-default fill-column 80)
|
2015-04-06 20:02:14 +00:00
|
|
|
(spacemacs|diminish auto-fill-function " Ⓕ" " F")
|
2015-03-08 04:09:37 +00:00
|
|
|
|
2015-04-11 03:31:33 +00:00
|
|
|
;; persistent abbreviation file
|
|
|
|
(setq abbrev-file-name (concat spacemacs-cache-directory "abbrev_defs"))
|
|
|
|
|
2015-03-31 08:01:02 +00:00
|
|
|
;; Save clipboard contents into kill-ring before replace them
|
|
|
|
(setq save-interprogram-paste-before-kill t)
|
|
|
|
|
2015-06-27 12:04:38 +00:00
|
|
|
;; Single space between sentences is more widespread than double
|
2015-05-10 05:30:43 +00:00
|
|
|
(setq-default sentence-end-double-space nil)
|
|
|
|
|
2015-06-24 16:45:08 +00:00
|
|
|
;; The C-d rebinding that most shell-like buffers inherit from
|
|
|
|
;; comint-mode assumes non-evil configuration with its
|
|
|
|
;; `comint-delchar-or-maybe-eof' function, so we disable it
|
2015-09-29 05:07:57 +00:00
|
|
|
(with-eval-after-load 'comint
|
|
|
|
(define-key comint-mode-map (kbd "C-d") nil))
|
2015-06-24 16:45:08 +00:00
|
|
|
|
2015-10-16 16:56:57 +00:00
|
|
|
;; whitespace-cleanup configuration
|
|
|
|
(pcase dotspacemacs-whitespace-cleanup
|
|
|
|
(`all (add-hook 'before-save-hook 'whitespace-cleanup))
|
|
|
|
(`trailing (add-hook 'before-save-hook 'delete-trailing-whitespace)))
|
|
|
|
|
2015-11-17 10:30:11 +00:00
|
|
|
;; Thanks to `editorconfig-emacs' for many of these
|
|
|
|
(defvar spacemacs--indent-variable-alist
|
|
|
|
'(((awk-mode c-mode c++-mode java-mode groovy-mode
|
|
|
|
idl-mode java-mode objc-mode pike-mode) . c-basic-offset)
|
|
|
|
(python-mode . python-indent-offset)
|
|
|
|
(cmake-mode . cmake-tab-width)
|
|
|
|
(coffee-mode . coffee-tab-width)
|
|
|
|
(cperl-mode . cperl-indent-level)
|
|
|
|
(css-mode . css-indent-offset)
|
|
|
|
(elixir-mode . elixir-smie-indent-basic)
|
|
|
|
((emacs-lisp-mode lisp-mode) . lisp-indent-offset)
|
|
|
|
(enh-ruby-mode . enh-ruby-indent-level)
|
|
|
|
(erlang-mode . erlang-indent-level)
|
|
|
|
((js-mode json-mode) . js-indent-level)
|
|
|
|
(js2-mode . js2-basic-offset)
|
|
|
|
(js3-mode . js3-indent-level)
|
|
|
|
(latex-mode . (LaTeX-indent-level tex-indent-basic))
|
|
|
|
(livescript-mode . livescript-tab-width)
|
|
|
|
(mustache-mode . mustache-basic-offset)
|
|
|
|
(nxml-mode . nxml-child-indent)
|
|
|
|
(perl-mode . perl-indent-level)
|
|
|
|
(puppet-mode . puppet-indent-level)
|
|
|
|
(ruby-mode . ruby-indent-level)
|
|
|
|
(scala-mode . scala-indent:step)
|
|
|
|
(sgml-mode . sgml-basic-offset)
|
|
|
|
(sh-mode . sh-basic-offset)
|
|
|
|
(web-mode . web-mode-markup-indent-offset)
|
|
|
|
(yaml-mode . yaml-indent-offset))
|
|
|
|
"An alist where each key is either a symbol corresponding
|
|
|
|
to a major mode, a list of such symbols, or the symbol t,
|
|
|
|
acting as default. The values are either integers, symbols
|
|
|
|
or lists of these.")
|
|
|
|
|
2014-09-01 16:18:34 +00:00
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
;; UI
|
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
|
2015-10-22 17:01:49 +00:00
|
|
|
(defface face-of-god
|
|
|
|
`((t (:background "SkyBlue2"
|
|
|
|
:foreground ,(face-background 'mode-line)
|
|
|
|
:box ,(face-attribute 'mode-line :box)
|
|
|
|
:inherit 'mode-line)))
|
|
|
|
"Face to use when `evil-mode' is disabled or `evil-state' is
|
|
|
|
nil."
|
|
|
|
:group 'spacemacs)
|
|
|
|
|
2014-09-01 16:18:34 +00:00
|
|
|
;; important for golden-ratio to better work
|
|
|
|
(setq window-combination-resize t)
|
|
|
|
;; fringes
|
|
|
|
(setq-default fringe-indicator-alist
|
|
|
|
'((truncation . nil) (continuation . nil)))
|
|
|
|
;; Show column number in mode line
|
|
|
|
(setq column-number-mode t)
|
2015-10-26 17:12:41 +00:00
|
|
|
;; Activate linum-mode in all prog-mode and text-mode buffers if the setting is
|
|
|
|
;; enabled.
|
2015-11-03 04:29:16 +00:00
|
|
|
(when dotspacemacs-line-numbers
|
2015-10-26 17:12:41 +00:00
|
|
|
(add-hook 'prog-mode-hook 'linum-mode)
|
|
|
|
(add-hook 'text-mode-hook 'linum-mode))
|
2014-09-01 16:18:34 +00:00
|
|
|
;; line number
|
|
|
|
(setq linum-format "%4d")
|
|
|
|
;; highlight current line
|
|
|
|
(global-hl-line-mode t)
|
|
|
|
;; no blink
|
2014-09-13 03:19:36 +00:00
|
|
|
(blink-cursor-mode 0)
|
2015-09-18 20:44:39 +00:00
|
|
|
;; When emacs asks for "yes" or "no", let "y" or "n" suffice
|
2014-09-01 16:18:34 +00:00
|
|
|
(fset 'yes-or-no-p 'y-or-n-p)
|
2014-09-17 19:42:59 +00:00
|
|
|
;; draw underline lower
|
|
|
|
(setq x-underline-at-descent-line t)
|
2015-04-03 22:16:18 +00:00
|
|
|
;; don't let the cursor go into minibuffer prompt
|
|
|
|
;; Tip taken from Xah Lee: http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html
|
|
|
|
(setq minibuffer-prompt-properties
|
|
|
|
'(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt))
|
2014-10-24 23:35:13 +00:00
|
|
|
;; Emacs 24.4 new features
|
|
|
|
(unless (version< emacs-version "24.4")
|
2014-12-16 02:13:01 +00:00
|
|
|
(if dotspacemacs-fullscreen-at-startup
|
2015-01-12 17:22:17 +00:00
|
|
|
(spacemacs/toggle-frame-fullscreen)
|
2014-12-16 02:13:01 +00:00
|
|
|
(if dotspacemacs-maximized-at-startup
|
2014-12-16 02:29:22 +00:00
|
|
|
(add-hook 'window-setup-hook 'toggle-frame-maximized))))
|
2015-08-01 10:52:08 +00:00
|
|
|
|
2014-09-01 16:18:34 +00:00
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
;; Session
|
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
|
2014-10-25 03:51:52 +00:00
|
|
|
;; save custom variables in ~/.spacemacs
|
2015-10-19 15:08:39 +00:00
|
|
|
(unless (bound-and-true-p custom-file)
|
|
|
|
(setq custom-file (dotspacemacs/location)))
|
2013-01-01 04:41:59 +00:00
|
|
|
;; scratch buffer empty
|
2013-01-11 03:29:46 +00:00
|
|
|
(setq initial-scratch-message nil)
|
2015-05-04 12:12:39 +00:00
|
|
|
;; don't create backup~ files
|
2015-12-24 00:29:04 +00:00
|
|
|
(setq make-backup-files nil)
|
2015-05-04 12:12:39 +00:00
|
|
|
|
2015-06-19 03:54:07 +00:00
|
|
|
;; Auto-save file
|
|
|
|
(setq auto-save-default (not (null dotspacemacs-auto-save-file-location)))
|
|
|
|
(setq auto-save-list-file-prefix (concat spacemacs-auto-save-directory))
|
|
|
|
;; always save TRAMP URLs to cache directory no matter what is the value
|
|
|
|
;; of `dotspacemacs-auto-save-file-location'
|
|
|
|
(let ((autosave-dir (concat spacemacs-auto-save-directory "dist/")))
|
|
|
|
(setq auto-save-file-name-transforms
|
|
|
|
`(("\\`/[^/]*:\\([^/]*/\\)*\\([^/]*\\)\\'" ,autosave-dir t)))
|
|
|
|
(unless (or (file-exists-p autosave-dir)
|
|
|
|
(null dotspacemacs-auto-save-file-location))
|
|
|
|
(make-directory autosave-dir t)))
|
|
|
|
;; Choose auto-save location
|
2015-10-05 07:22:35 +00:00
|
|
|
(cl-case dotspacemacs-auto-save-file-location
|
2015-06-19 03:54:07 +00:00
|
|
|
(cache (let ((autosave-dir (concat spacemacs-auto-save-directory "site/")))
|
|
|
|
(add-to-list 'auto-save-file-name-transforms
|
|
|
|
`(".*" ,autosave-dir t) 'append)
|
|
|
|
(unless (file-exists-p autosave-dir)
|
|
|
|
(make-directory autosave-dir t))))
|
|
|
|
(original (setq auto-save-visited-file-name t))
|
|
|
|
(_ (setq auto-save-default nil
|
|
|
|
auto-save-list-file-prefix nil)))
|
2015-05-04 12:12:39 +00:00
|
|
|
|
2015-03-15 02:55:05 +00:00
|
|
|
;; remove annoying ellipsis when printing sexp in message buffer
|
|
|
|
(setq eval-expression-print-length nil
|
|
|
|
eval-expression-print-level nil)
|
2014-11-08 07:14:44 +00:00
|
|
|
|
2015-03-15 02:55:05 +00:00
|
|
|
;; cache files
|
2015-08-09 19:09:32 +00:00
|
|
|
(setq url-configuration-directory (concat spacemacs-cache-directory "url")
|
2015-03-15 02:55:05 +00:00
|
|
|
eshell-directory-name (concat spacemacs-cache-directory "eshell" )
|
|
|
|
tramp-persistency-file-name (concat spacemacs-cache-directory "tramp"))
|
2014-11-08 07:14:44 +00:00
|
|
|
|
2015-03-15 02:55:05 +00:00
|
|
|
;; seems pointless to warn. There's always undo.
|
|
|
|
(put 'narrow-to-region 'disabled nil)
|
|
|
|
(put 'upcase-region 'disabled nil)
|
|
|
|
(put 'downcase-region 'disabled nil)
|
|
|
|
(put 'erase-buffer 'disabled nil)
|
|
|
|
(put 'scroll-left 'disabled nil)
|
|
|
|
(put 'dired-find-alternate-file 'disabled nil)
|
|
|
|
;; remove prompt if the file is opened in other clients
|
|
|
|
(defun server-remove-kill-buffer-hook ()
|
|
|
|
(remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function))
|
|
|
|
(add-hook 'server-visit-hook 'server-remove-kill-buffer-hook)
|