2015-01-14 04:12:56 +00:00
|
|
|
|
;;; config.el --- Spacemacs Layer configuration File
|
|
|
|
|
;;
|
|
|
|
|
;; 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-03-15 02:55:05 +00:00
|
|
|
|
;; We define prefix commands only for the sake of guide-key
|
2014-12-01 02:05:39 +00:00
|
|
|
|
(setq spacemacs/key-binding-prefixes '(("a" . "applications")
|
|
|
|
|
("as" . "applications-shells")
|
|
|
|
|
("b" . "buffers")
|
|
|
|
|
("bm" . "buffers-move")
|
2014-12-18 05:12:04 +00:00
|
|
|
|
("c" . "compile/comments")
|
2015-03-21 01:49:50 +00:00
|
|
|
|
("C" . "colors")
|
2014-12-01 02:05:39 +00:00
|
|
|
|
("e" . "errors")
|
|
|
|
|
("f" . "files")
|
|
|
|
|
("fe" . "files-emacs/spacemacs")
|
|
|
|
|
("g" . "git/versions-control")
|
|
|
|
|
("gc" . "smeargle")
|
|
|
|
|
("h" . "helm/help/highlight")
|
|
|
|
|
("hd" . "help-describe")
|
|
|
|
|
("i" . "insertion")
|
|
|
|
|
("j" . "join/split")
|
2015-02-17 04:36:57 +00:00
|
|
|
|
("k" . "lisp")
|
2015-02-17 05:00:06 +00:00
|
|
|
|
("kd" . "lisp-delete")
|
|
|
|
|
("kD" . "lisp-delete-backward")
|
2014-12-01 02:05:39 +00:00
|
|
|
|
("n" . "narrow/numbers")
|
|
|
|
|
("p" . "projects")
|
2014-12-20 04:57:00 +00:00
|
|
|
|
("q" . "quit")
|
2014-12-01 02:05:39 +00:00
|
|
|
|
("r" . "registers/rings")
|
|
|
|
|
("s" . "search/symbol")
|
|
|
|
|
("S" . "spelling")
|
|
|
|
|
("t" . "toggles")
|
2015-01-27 05:29:31 +00:00
|
|
|
|
("tC" . "toggles-colors")
|
2015-03-25 17:56:11 +00:00
|
|
|
|
("th" . "toggles-highlight")
|
2014-12-01 02:05:39 +00:00
|
|
|
|
("tm" . "toggles-modeline")
|
|
|
|
|
("T" . "themes")
|
|
|
|
|
("w" . "windows")
|
|
|
|
|
("wp" . "windows-popup")
|
2014-12-03 05:20:18 +00:00
|
|
|
|
("wS" . "windows-size")
|
2014-12-01 02:05:39 +00:00
|
|
|
|
("x" . "text")
|
|
|
|
|
("xd" . "text-delete")
|
|
|
|
|
("xg" . "text-google-translate")
|
|
|
|
|
("xm" . "text-move")
|
|
|
|
|
("xt" . "text-transpose")
|
|
|
|
|
("xw" . "text-words")
|
|
|
|
|
("z" . "z")))
|
2014-12-11 16:22:55 +00:00
|
|
|
|
(mapc (lambda (x) (spacemacs/declare-prefix (car x) (cdr x)))
|
|
|
|
|
spacemacs/key-binding-prefixes)
|
|
|
|
|
|
2014-09-01 16:18:34 +00:00
|
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
|
;; Navigation
|
|
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
(ido-mode t)
|
2015-03-15 02:55:05 +00:00
|
|
|
|
(setq ido-save-directory-list-file (concat spacemacs-cache-directory "ido.last")
|
|
|
|
|
;; enable fuzzy matching
|
|
|
|
|
ido-enable-flex-matching t)
|
2014-09-01 16:18:34 +00:00
|
|
|
|
;; Auto refresh buffers
|
|
|
|
|
(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)
|
2014-09-01 16:18:34 +00:00
|
|
|
|
;; activate winner mode use to undo and redo windows layout
|
|
|
|
|
(winner-mode t)
|
|
|
|
|
;; no beep pleeeeeease ! (and no visual blinking too please)
|
|
|
|
|
(custom-set-variables '(ring-bell-function 'ignore))
|
|
|
|
|
(setq visible-bell nil)
|
2015-01-07 05:23:24 +00:00
|
|
|
|
;; required for evil folding
|
|
|
|
|
(defun spacemacs//enable-hs-minor-mode ()
|
|
|
|
|
"Enable hs-minor-mode for code folding."
|
2015-01-16 04:36:18 +00:00
|
|
|
|
(ignore-errors
|
|
|
|
|
(hs-minor-mode)
|
|
|
|
|
(spacemacs|hide-lighter hs-minor-mode)))
|
2015-01-07 05:23:24 +00:00
|
|
|
|
(add-hook 'prog-mode-hook 'spacemacs//enable-hs-minor-mode)
|
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
|
|
|
|
|
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)
|
|
|
|
|
;; whitespace-mode
|
2015-02-24 04:33:18 +00:00
|
|
|
|
(add-hook 'prog-mode-hook (lambda () (setq show-trailing-whitespace 1)))
|
2014-09-01 16:18:34 +00:00
|
|
|
|
;; When point is on paranthesis, highlight the matching one
|
|
|
|
|
(show-paren-mode t)
|
|
|
|
|
;; use only spaces and no tabs
|
2015-03-15 02:55:05 +00:00
|
|
|
|
(setq-default indent-tabs-mode nil
|
|
|
|
|
default-tab-width 2)
|
2014-11-17 12:15:18 +00:00
|
|
|
|
;; turn on electric-indent-mode for both 24.3 and 24.4
|
|
|
|
|
(electric-indent-mode)
|
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
|
|
|
|
|
;; on OS X, install `trash' from `homebrew'
|
|
|
|
|
(setq delete-by-moving-to-trash t)
|
|
|
|
|
(when (system-is-mac)
|
2014-12-11 02:59:59 +00:00
|
|
|
|
;; use trash if installed
|
|
|
|
|
(if (executable-find "trash")
|
|
|
|
|
(defun system-move-file-to-trash (file)
|
|
|
|
|
"Use `trash' to move FILE to the system trash.
|
|
|
|
|
Can be installed with `brew install trash'."
|
|
|
|
|
(call-process (executable-find "trash") nil 0 nil file))
|
|
|
|
|
;; regular move to trash directory
|
|
|
|
|
(setq trash-directory "~/.Trash/emacs")))
|
2014-11-29 03:47:03 +00:00
|
|
|
|
|
2015-03-08 04:09:37 +00:00
|
|
|
|
;; auto fill breaks line beyond current-fill-column
|
2015-03-14 15:08:31 +00:00
|
|
|
|
(setq-default default-fill-column 80)
|
2015-03-08 04:09:37 +00:00
|
|
|
|
(spacemacs|diminish auto-fill-function " ⓕ" " f")
|
|
|
|
|
|
2014-09-01 16:18:34 +00:00
|
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
|
;; UI
|
|
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
;; 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)
|
|
|
|
|
;; 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)
|
2014-09-01 16:18:34 +00:00
|
|
|
|
;; When emacs asks for "yes" or "no", let "y" or "n" sufficide
|
|
|
|
|
(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)
|
2014-09-01 16:18:34 +00:00
|
|
|
|
;; setup right and left margins
|
|
|
|
|
;; (add-hook 'window-configuration-change-hook
|
|
|
|
|
;; (lambda ()
|
|
|
|
|
;; (set-window-margins (car (get-buffer-window-list (current-buffer) nil t)) 0 0)))
|
|
|
|
|
|
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))))
|
2014-10-24 23:35:13 +00:00
|
|
|
|
|
2014-09-01 16:18:34 +00:00
|
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
|
;; Session
|
|
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
|
|
2014-10-25 03:51:52 +00:00
|
|
|
|
;; save custom variables in ~/.spacemacs
|
2014-11-22 02:19:50 +00:00
|
|
|
|
(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)
|
2013-01-01 04:41:59 +00:00
|
|
|
|
;; don't create backup~ or #auto-save# files
|
2015-03-15 02:55:05 +00:00
|
|
|
|
(setq backup-by-copying t
|
|
|
|
|
make-backup-files nil
|
|
|
|
|
auto-save-default nil
|
|
|
|
|
create-lockfiles nil)
|
2013-05-07 01:34:17 +00:00
|
|
|
|
(require 'uniquify)
|
2013-05-07 01:08:10 +00:00
|
|
|
|
;; When having windows with repeated filenames, uniquify them
|
|
|
|
|
;; by the folder they are in rather those annoying <2>,<3>,.. etc
|
2015-03-15 02:55:05 +00:00
|
|
|
|
(setq uniquify-buffer-name-style 'post-forward-angle-brackets
|
|
|
|
|
;; don't screw special buffers
|
|
|
|
|
uniquify-ignore-buffers-re "^\\*")
|
|
|
|
|
;; remove annoying ellipsis when printing sexp in message buffer
|
|
|
|
|
(setq eval-expression-print-length nil
|
|
|
|
|
eval-expression-print-level nil)
|
2013-01-01 04:41:59 +00:00
|
|
|
|
;; Save point position between sessions
|
|
|
|
|
(require 'saveplace)
|
2015-03-15 02:55:05 +00:00
|
|
|
|
(setq save-place t
|
|
|
|
|
save-place-file (concat spacemacs-cache-directory "places"))
|
2014-11-08 07:14:44 +00:00
|
|
|
|
|
|
|
|
|
;; minibuffer history
|
|
|
|
|
(require 'savehist)
|
|
|
|
|
(setq savehist-file (concat spacemacs-cache-directory "savehist")
|
|
|
|
|
enable-recursive-minibuffers t ; Allow commands in minibuffers
|
|
|
|
|
history-length 1000
|
2014-12-21 22:40:04 +00:00
|
|
|
|
savehist-additional-variables '(kill-ring mark-ring global-mark-ring search-ring regexp-search-ring extended-command-history)
|
2014-11-08 07:14:44 +00:00
|
|
|
|
savehist-autosave-interval 60)
|
|
|
|
|
(savehist-mode +1)
|
|
|
|
|
|
2015-03-15 02:55:05 +00:00
|
|
|
|
;; auto-save
|
2014-12-13 22:56:53 +00:00
|
|
|
|
(let
|
|
|
|
|
((autosave-dir (expand-file-name (concat spacemacs-cache-directory "autosave"))))
|
|
|
|
|
(unless (file-exists-p autosave-dir)
|
|
|
|
|
(make-directory autosave-dir))
|
|
|
|
|
(setq auto-save-list-file-prefix (concat autosave-dir "/")
|
|
|
|
|
auto-save-file-name-transforms `((".*" ,autosave-dir t))))
|
|
|
|
|
|
2015-03-15 02:55:05 +00:00
|
|
|
|
;; cache files
|
2014-11-08 07:14:44 +00:00
|
|
|
|
;; bookmarks
|
2015-03-15 02:55:05 +00:00
|
|
|
|
(setq bookmark-default-file (concat spacemacs-cache-directory "bookmarks")
|
|
|
|
|
;; save after every change
|
|
|
|
|
bookmark-save-flag 1
|
|
|
|
|
url-configuration-directory (concat spacemacs-cache-directory "url")
|
|
|
|
|
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
|
|
|
|
|
2014-09-21 03:07:44 +00:00
|
|
|
|
;; increase memory threshold for GC
|
|
|
|
|
(setq gc-cons-threshold 20000000)
|
2013-01-01 04:41:59 +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)
|
|
|
|
|
|
|
|
|
|
;; The following code is kept as reference -----------------------------------
|
|
|
|
|
|
2014-01-07 14:40:20 +00:00
|
|
|
|
;; ;; save a bunch of variables to the desktop file
|
|
|
|
|
;; ;; for lists specify the len of the maximal saved data also
|
|
|
|
|
;; (setq desktop-globals-to-save
|
|
|
|
|
;; (append '((extended-command-history . 30)
|
|
|
|
|
;; (file-name-history . 100)
|
|
|
|
|
;; (grep-history . 30)
|
|
|
|
|
;; (compile-history . 30)
|
|
|
|
|
;; (minibuffer-history . 50)
|
|
|
|
|
;; (query-replace-history . 60)
|
|
|
|
|
;; (read-expression-history . 60)
|
|
|
|
|
;; (regexp-history . 60)
|
|
|
|
|
;; (regexp-search-ring . 20)
|
|
|
|
|
;; (search-ring . 20)
|
|
|
|
|
;; (shell-command-history . 50)
|
|
|
|
|
;; (evil-ex .100)
|
|
|
|
|
;; tags-file-name
|
|
|
|
|
;; register-alist)))
|
2013-01-03 06:53:00 +00:00
|
|
|
|
|
2014-01-07 14:40:20 +00:00
|
|
|
|
;; ;; Make emacs open all files in last emacs session (taken from ergoemacs).
|
2013-01-01 04:41:59 +00:00
|
|
|
|
|
2014-01-07 14:40:20 +00:00
|
|
|
|
;; ;; This functionality is provided by desktop-save-mode
|
|
|
|
|
;; ;; (“feature” name: “desktop”).
|
|
|
|
|
;; ;;
|
|
|
|
|
;; ;; The mode is not on by default in emacs 23.1, and has a lot options.
|
|
|
|
|
;; ;; The following is init settings for the mode for ErgoEmacs.
|
|
|
|
|
;; ;; Goal: have emacs always auto open the set of opened files in last session,
|
|
|
|
|
;; ;; even if emacs crashed in last session or the OS crashed in last session.
|
|
|
|
|
;; ;; Also, don't bother users by asking questions like “do you want to save
|
|
|
|
|
;; ;; desktop?” or “do you want to override last session file?”, because these are
|
|
|
|
|
;; ;; annoying and terms like “session” or “desktop” are confusing to most users
|
|
|
|
|
;; ;; because it can have many meanings.
|
|
|
|
|
;; ;;
|
|
|
|
|
;; ;; Some tech detail: set the desktop session file 〔.emacs.desktop〕
|
|
|
|
|
;; ;; at the variable “user-emacs-directory” (default value is “~/.emacs.d/”).
|
|
|
|
|
;; ;; This file is our desktop file. It will be auto created and or over-written.
|
|
|
|
|
;; ;; If a emacs expert has other desktop session files elsewhere, he can still use
|
|
|
|
|
;; ;; or manage those.
|
2013-01-01 04:41:59 +00:00
|
|
|
|
|
2014-01-07 14:40:20 +00:00
|
|
|
|
;; (require 'desktop)
|
2013-01-01 04:41:59 +00:00
|
|
|
|
|
2014-01-07 14:40:20 +00:00
|
|
|
|
;; (defun desktop-settings-setup ()
|
|
|
|
|
;; "Some settings setup for desktop-save-mode."
|
|
|
|
|
;; (interactive)
|
2013-01-01 04:41:59 +00:00
|
|
|
|
|
2014-01-07 14:40:20 +00:00
|
|
|
|
;; ;; At this point the desktop.el hook in after-init-hook was
|
|
|
|
|
;; ;; executed, so (desktop-read) is avoided.
|
|
|
|
|
;; (when (not (eq (emacs-pid) (desktop-owner))) ; Check that emacs did not load a desktop yet
|
|
|
|
|
;; ;; Here we activate the desktop mode
|
|
|
|
|
;; (desktop-save-mode 1)
|
|
|
|
|
;; ;; The default desktop is saved always
|
|
|
|
|
;; (setq desktop-save t)
|
|
|
|
|
;; ;; The default desktop is loaded anyway if it is locked
|
|
|
|
|
;; (setq desktop-load-locked-desktop t)
|
|
|
|
|
;; ;; Set the location to save/load default desktop
|
|
|
|
|
;; (setq desktop-dirname user-emacs-directory)
|
|
|
|
|
;; ;; Make sure that even if emacs or OS crashed, emacs
|
|
|
|
|
;; ;; still have last opened files.
|
|
|
|
|
;; (add-hook 'find-file-hook
|
|
|
|
|
;; (lambda ()
|
|
|
|
|
;; (run-with-timer 5 nil
|
|
|
|
|
;; (lambda ()
|
|
|
|
|
;; ;; Reset desktop modification time so the user is not bothered
|
|
|
|
|
;; (setq desktop-file-modtime (nth 5 (file-attributes (desktop-full-file-name))))
|
|
|
|
|
;; (desktop-save user-emacs-directory)))))
|
|
|
|
|
;; ;; Read default desktop
|
|
|
|
|
;; (if (file-exists-p (concat desktop-dirname desktop-base-file-name))
|
|
|
|
|
;; (desktop-read desktop-dirname))
|
|
|
|
|
;; ;; Add a hook when emacs is closed to we reset the desktop
|
|
|
|
|
;; ;; modification time (in this way the user does not get a warning
|
|
|
|
|
;; ;; message about desktop modifications)
|
|
|
|
|
;; (add-hook 'kill-emacs-hook
|
|
|
|
|
;; (lambda ()
|
|
|
|
|
;; ;; Reset desktop modification time so the user is not bothered
|
|
|
|
|
;; (setq desktop-file-modtime (nth 5 (file-attributes (desktop-full-file-name))))))
|
|
|
|
|
;; )
|
|
|
|
|
;; )
|
2013-01-01 04:41:59 +00:00
|
|
|
|
|
2014-09-07 01:38:02 +00:00
|
|
|
|
;; (add-hook 'after-init-hook
|
|
|
|
|
;; ;; 'desktop-settings-setup
|
|
|
|
|
;; (lambda ()
|
|
|
|
|
;; ;; No splash screen
|
|
|
|
|
;; (setq inhibit-startup-screen t)
|
|
|
|
|
;; ;; ;; If the *scratch* buffer is the current one, then create a new
|
|
|
|
|
;; ;; ;; empty untitled buffer to hide *scratch*
|
|
|
|
|
;; ;; (if (string= (buffer-name) "*scratch*")
|
|
|
|
|
;; ;; (new-empty-buffer))
|
|
|
|
|
;; )
|
|
|
|
|
;; t) ;; append this hook to the tail
|