This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/!distribution/spacemacs-core/config.el
syl20bnr 6b33031dc5 core: dotspacemacs-distribution, spacemacs-core layer and rename contrib
- Rename contrib directory to layers
- Add new variable dotspacemacs-distribution
- Move spacemacs layer to layers/!distribution
- New layer spacemacs-core in layers/!distribution
- User can now set dotspacemacs-distribution to spacemacs or
  spacemacs-core (default spacemacs)

spacemacs-core is very lightweight layer sufficient to build upon
spacemacs.
2015-09-07 23:44:43 -04:00

241 lines
10 KiB
EmacsLisp

;;; config.el --- Spacemacs Core 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
;; ---------------------------------------------------------------------------
;; Prefixes
;; ---------------------------------------------------------------------------
;; We define prefix commands only for the sake of which-key
(setq spacemacs/key-binding-prefixes '(("a" "applications")
("ai" "applications-irc")
("as" "applications-shells")
("b" "buffers")
("bm" "buffers-move")
("c" "compile/comments")
("C" "capture/colors")
("e" "errors")
("E" "editing-modes")
("f" "files")
("fC" "files/convert")
("fe" "files-emacs/spacemacs")
("g" "git/versions-control")
("h" "helm/help/highlight")
("hd" "help-describe")
("i" "insertion")
("j" "join/split")
("k" "lisp")
("kd" "lisp-delete")
("kD" "lisp-delete-backward")
("k`" "lisp-hybrid")
("n" "narrow/numbers")
("p" "projects")
("p$" "projects/shell")
("q" "quit")
("r" "registers/rings")
("s" "search/symbol")
("sa" "search-ag")
("sg" "search-grep")
("sk" "search-ack")
("st" "search-pt")
("sw" "search-web")
("t" "toggles")
("tC" "toggles-colors")
("th" "toggles-highlight")
("tm" "toggles-modeline")
("T" "toggles/themes")
("w" "windows")
("wp" "windows-popup")
("x" "text")
("xa" "text-align")
("xd" "text-delete")
("xg" "text-google-translate")
("xl" "text-lines")
("xm" "text-move")
("xt" "text-transpose")
("xw" "text-words")
("z" "zoom")))
(mapc (lambda (x) (apply #'spacemacs/declare-prefix x))
spacemacs/key-binding-prefixes)
;; ---------------------------------------------------------------------------
;; Navigation
;; ---------------------------------------------------------------------------
;; Auto refresh
(global-auto-revert-mode 1)
;; Also auto refresh dired, but be quiet about it
(setq global-auto-revert-non-file-buffers t
auto-revert-verbose nil)
;; 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'.")
;; no beep pleeeeeease ! (and no visual blinking too please)
(setq ring-bell-function 'ignore
visible-bell nil)
;; 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))
;; Mouse cursor in terminal mode
(xterm-mouse-mode 1)
;; 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)
;; ---------------------------------------------------------------------------
;; 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)
;; use only spaces and no tabs
(setq-default indent-tabs-mode nil
default-tab-width 2)
;; Text
(setq longlines-show-hard-newlines t)
;; Use system trash for file deletion
;; should work on Windows and Linux distros
;; on OS X, see contrib/osx layer
(setq delete-by-moving-to-trash t)
;; auto fill breaks line beyond current-fill-column
(setq-default default-fill-column 80)
(spacemacs|diminish auto-fill-function "" " F")
;; persistent abbreviation file
(setq abbrev-file-name (concat spacemacs-cache-directory "abbrev_defs"))
;; Save clipboard contents into kill-ring before replace them
(setq save-interprogram-paste-before-kill t)
;; Single space between sentences is more widespread than double
(setq-default sentence-end-double-space nil)
;; 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
(eval-after-load 'comint
'(define-key comint-mode-map (kbd "C-d") nil))
;; ---------------------------------------------------------------------------
;; 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
(blink-cursor-mode 0)
;; When emacs asks for "yes" or "no", let "y" or "n" sufficide
(fset 'yes-or-no-p 'y-or-n-p)
;; draw underline lower
(setq x-underline-at-descent-line t)
;; 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))
;; Emacs 24.4 new features
(unless (version< emacs-version "24.4")
(if dotspacemacs-fullscreen-at-startup
(spacemacs/toggle-frame-fullscreen)
(if dotspacemacs-maximized-at-startup
(add-hook 'window-setup-hook 'toggle-frame-maximized))))
(defvar spacemacs--global-mode-line-excludes nil
"List of elements to exclude from the global modeline string.
These should have their own segments in the modeline.")
;; ---------------------------------------------------------------------------
;; Session
;; ---------------------------------------------------------------------------
;; save custom variables in ~/.spacemacs
(setq custom-file (dotspacemacs/location))
;; scratch buffer empty
(setq initial-scratch-message nil)
;; don't create backup~ files
(setq backup-by-copying t
make-backup-files nil
create-lockfiles nil)
;; 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
(case dotspacemacs-auto-save-file-location
(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)))
;; remove annoying ellipsis when printing sexp in message buffer
(setq eval-expression-print-length nil
eval-expression-print-level nil)
;; cache files
(setq 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"))
;; increase memory threshold for GC
(setq gc-cons-threshold 20000000)
;; 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)