2016-05-14 16:28:57 +00:00
|
|
|
;;; packages.el --- Spacemacs Base Layer packages File
|
2015-09-08 01:16:15 +00:00
|
|
|
;;
|
2016-01-12 02:40:54 +00:00
|
|
|
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
|
2015-09-08 01:16:15 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
2015-09-16 09:24:25 +00:00
|
|
|
(setq spacemacs-base-packages
|
2015-09-08 01:16:15 +00:00
|
|
|
'(
|
2016-05-14 15:41:30 +00:00
|
|
|
(abbrev :location built-in)
|
2016-04-03 04:28:47 +00:00
|
|
|
(bookmark :location built-in)
|
2016-04-05 11:04:51 +00:00
|
|
|
(dired :location built-in)
|
2016-03-26 01:14:53 +00:00
|
|
|
(dired-x :location built-in)
|
2015-09-24 02:02:39 +00:00
|
|
|
(electric-indent-mode :location built-in)
|
2016-04-03 04:28:47 +00:00
|
|
|
(ediff :location built-in)
|
|
|
|
(eldoc :location built-in)
|
2015-09-08 01:16:15 +00:00
|
|
|
evil-escape
|
2016-03-17 01:59:44 +00:00
|
|
|
(evil-evilified-state :location local :step pre :protected t)
|
2015-09-08 01:16:15 +00:00
|
|
|
evil-visualstar
|
|
|
|
exec-path-from-shell
|
2015-11-18 16:37:54 +00:00
|
|
|
help-fns+
|
2016-05-14 15:41:30 +00:00
|
|
|
(hi-lock :location built-in)
|
2015-09-08 01:16:15 +00:00
|
|
|
(holy-mode :location local :step pre)
|
2015-09-10 16:45:34 +00:00
|
|
|
(hybrid-mode :location local :step pre)
|
2016-06-07 17:12:54 +00:00
|
|
|
(image-mode :location built-in)
|
2016-05-21 03:57:32 +00:00
|
|
|
(linum :location built-in)
|
2015-11-10 07:58:41 +00:00
|
|
|
(package-menu :location built-in)
|
2016-06-05 04:04:53 +00:00
|
|
|
;; page-break-lines is shipped with spacemacs core
|
|
|
|
(page-break-lines :location built-in)
|
2015-09-24 03:47:36 +00:00
|
|
|
(process-menu :location built-in)
|
2016-05-20 00:16:27 +00:00
|
|
|
projectile
|
2016-04-03 04:28:47 +00:00
|
|
|
(recentf :location built-in)
|
|
|
|
(savehist :location built-in)
|
|
|
|
(saveplace :location built-in)
|
2015-09-08 01:16:15 +00:00
|
|
|
spacemacs-theme
|
2016-04-03 04:28:47 +00:00
|
|
|
(subword :location built-in)
|
2016-05-20 14:37:02 +00:00
|
|
|
(tar-mode :location built-in)
|
2015-09-24 03:47:36 +00:00
|
|
|
(uniquify :location built-in)
|
2015-10-11 03:54:09 +00:00
|
|
|
(url :location built-in)
|
2016-04-26 04:30:23 +00:00
|
|
|
(visual-line-mode :location built-in)
|
2016-04-03 04:28:47 +00:00
|
|
|
(whitespace :location built-in)
|
|
|
|
(winner :location built-in)
|
2016-05-14 15:54:18 +00:00
|
|
|
))
|
2015-09-08 01:16:15 +00:00
|
|
|
|
|
|
|
;; Initialization of packages
|
|
|
|
|
2016-05-14 15:41:30 +00:00
|
|
|
(defun spacemacs-base/init-abbrev ()
|
|
|
|
(spacemacs|hide-lighter abbrev-mode))
|
|
|
|
|
2015-09-16 09:24:25 +00:00
|
|
|
(defun spacemacs-base/init-bookmark ()
|
2015-09-08 01:16:15 +00:00
|
|
|
(use-package bookmark
|
|
|
|
:defer t
|
|
|
|
:init
|
2016-04-06 09:28:06 +00:00
|
|
|
(progn
|
|
|
|
(setq bookmark-default-file (concat spacemacs-cache-directory "bookmarks")
|
|
|
|
;; autosave each change
|
|
|
|
bookmark-save-flag 1)
|
|
|
|
(spacemacs/set-leader-keys "fb" 'bookmark-jump))))
|
2015-09-08 01:16:15 +00:00
|
|
|
|
2016-04-05 11:04:51 +00:00
|
|
|
(defun spacemacs-base/init-dired ()
|
|
|
|
(spacemacs/set-leader-keys
|
|
|
|
"ad" 'dired
|
|
|
|
"fj" 'dired-jump
|
|
|
|
"jd" 'dired-jump
|
|
|
|
"jD" 'dired-jump-other-window))
|
|
|
|
|
2016-03-26 01:14:53 +00:00
|
|
|
(defun spacemacs-base/init-dired-x ()
|
2016-04-07 22:32:06 +00:00
|
|
|
(use-package dired-x
|
|
|
|
:commands (dired-jump
|
|
|
|
dired-jump-other-window
|
|
|
|
dired-omit-mode)))
|
2016-03-26 01:14:53 +00:00
|
|
|
|
2015-09-24 02:02:39 +00:00
|
|
|
(defun spacemacs-base/init-electric-indent-mode ()
|
2015-09-08 01:16:15 +00:00
|
|
|
(electric-indent-mode))
|
|
|
|
|
2016-04-26 04:30:23 +00:00
|
|
|
(defun spacemacs-base/init-visual-line-mode ()
|
2016-05-06 08:09:44 +00:00
|
|
|
(spacemacs|diminish visual-line-mode " Ⓛ" " L"))
|
2016-04-26 04:30:23 +00:00
|
|
|
|
2015-09-08 01:16:15 +00:00
|
|
|
;; notes from mijoharas
|
|
|
|
;; We currently just set a few variables to make it look nicer.
|
|
|
|
;; Here is my first attempt at evilifying the buffer, does not work correctly, help is very much welcome.
|
|
|
|
|
|
|
|
;; ```
|
|
|
|
;; (defun ediff/setup-ediff-keymaps ()
|
|
|
|
;; "setup the evil ediff keymap"
|
|
|
|
;; (progn
|
|
|
|
;; (add-to-list 'evil-emacs-state-modes 'Ediff)
|
2015-11-05 13:09:00 +00:00
|
|
|
;; (evilified-state-evilify ediff-mode-map)
|
2015-09-08 01:16:15 +00:00
|
|
|
;; (spacemacs/activate-evil-leader-for-map 'ediff-mode-map)
|
|
|
|
;; )
|
|
|
|
;; )
|
|
|
|
|
|
|
|
;; ;; inside the use-package function
|
|
|
|
;; (add-hook 'ediff-keymap-setup-hook 'ediff/setup-ediff-keymaps)
|
|
|
|
;; ```
|
2015-09-16 09:24:25 +00:00
|
|
|
(defun spacemacs-base/init-ediff ()
|
2015-09-08 01:16:15 +00:00
|
|
|
(use-package ediff
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
;; first we set some sane defaults
|
|
|
|
(setq-default
|
|
|
|
ediff-window-setup-function 'ediff-setup-windows-plain
|
|
|
|
;; emacs is evil and decrees that vertical shall henceforth be horizontal
|
|
|
|
ediff-split-window-function 'split-window-horizontally
|
2016-01-30 23:00:50 +00:00
|
|
|
ediff-merge-split-window-function 'split-window-horizontally)
|
|
|
|
;; restore window layout when done
|
|
|
|
(add-hook 'ediff-quit-hook #'winner-undo))))
|
2015-09-08 01:16:15 +00:00
|
|
|
|
2015-09-16 09:24:25 +00:00
|
|
|
(defun spacemacs-base/init-eldoc ()
|
2015-09-08 01:16:15 +00:00
|
|
|
(use-package eldoc
|
|
|
|
:defer t
|
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
;; enable eldoc in `eval-expression'
|
|
|
|
(add-hook 'eval-expression-minibuffer-setup-hook #'eldoc-mode)
|
|
|
|
;; enable eldoc in IELM
|
|
|
|
(add-hook 'ielm-mode-hook #'eldoc-mode)
|
|
|
|
;; don't display eldoc on modeline
|
|
|
|
(spacemacs|hide-lighter eldoc-mode))))
|
|
|
|
|
2015-09-16 09:24:25 +00:00
|
|
|
(defun spacemacs-base/init-evil-escape ()
|
2015-09-08 01:16:15 +00:00
|
|
|
(use-package evil-escape
|
Use evil in holy-mode
Motivation
While disabling Evil in holy-mode makes its implementation shorter and
sounds elegant on the paper, in practice it puts a big burden on the
configuration parts which need to know if Evil is enable or not. This is
a bad separation of concerns and the bunch of fixes that we were forced
to do in the past weeks shows this issue. Those fixes were about
removing the knowledge of the activation of Evil by implementing new
dispatching functions to be used by layers, this is cumbersome and makes
Spacemacs layer configuration more subtle which is not good. There was
additional bad consequences of the removal of Evil state like the
impossibility to use Evil lisp state or iedit states, or we would have
been forced to implement a temporary activation of Evil which is
awkward.
Instead I reintroduce Evil as the central piece of Spacemacs design thus
Evil is now re-enabled in holy-mode. It provides the abstraction we need
to isolate editing styles and be able to grow the Spacemacs
configuration coverage sanely. Layers don't need to check whether the
holy mode is active or not and they don't need to know if Evil is
available (it is always available). We also don't need to write
additional dispatching functions, this is the job of Evil, and I think
it provides everything for this. Ideally configuration layer should be
implemented with only Evil in mind and the holy-mode (and hybrid-mode)
should magically make it work for Emacs style users, for instance we can
freely use `evil-insert-state` anywhere in the code without any guard.
Evil is now even more part of Spacemacs, we can really say that
Spacemacs is Emacs+Evil which is now an indivisible pair. Spacemacs
needed this stable API to continue on the right track.
While these changes should be rather transparent to the user, I'm sorry
for this experimental period, I failed to see all the implications of
such a change, I was just excited about the possibility to make Evil
optional. The reality is that Spacemacs has to embrace it and keep its
strong position on being Emacs+Evil at the core.
Implementation
- insert, motion and normal states are forced to emacs state using an
advice on `evil-insert-state`, `evil-motion-state` and
`evil-normal-state` respectively. These functions can be used freely in
the layer configuration.
- A new general hook `spacemacs-editing-style-hook` allow to hook any
code that need to be configured based on the editing style. Functions
hooked to this hook takes the current style as parameter, this
basically generalize the hook used to setup hjkl navigation bindings.
- ESC has been removed from the emacs state map.
- Revert unneeded changes
- Revert "evil: enter insert-state only from normal-state"
commit bdd702dfbe302206bbc989c7a0832daba087a781.
- Revert "avoid being evil in deft with emacs editing style"
commit f3a16f49ed27cc8cf05f23f93b006d6e04235381.
Additional changes
All editing style packages have been moved to a layer called
`spacemacs-editing-styles`
Notes
I did not have time to attack hybrid mode, I should be able to do it
later.
2016-03-13 23:41:18 +00:00
|
|
|
:init (evil-escape-mode)
|
|
|
|
:config (spacemacs|hide-lighter evil-escape-mode)))
|
2015-09-08 01:16:15 +00:00
|
|
|
|
2016-03-17 01:59:44 +00:00
|
|
|
(defun spacemacs-base/init-evil-evilified-state ()
|
|
|
|
(use-package evil-evilified-state)
|
|
|
|
(define-key evil-evilified-state-map (kbd dotspacemacs-leader-key)
|
|
|
|
spacemacs-default-map))
|
|
|
|
|
2015-09-16 09:24:25 +00:00
|
|
|
(defun spacemacs-base/init-evil-visualstar ()
|
2015-09-08 01:16:15 +00:00
|
|
|
(use-package evil-visualstar
|
|
|
|
:commands (evil-visualstar/begin-search-forward
|
|
|
|
evil-visualstar/begin-search-backward)
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(define-key evil-visual-state-map (kbd "*")
|
|
|
|
'evil-visualstar/begin-search-forward)
|
|
|
|
(define-key evil-visual-state-map (kbd "#")
|
|
|
|
'evil-visualstar/begin-search-backward))))
|
|
|
|
|
2015-09-16 09:24:25 +00:00
|
|
|
(defun spacemacs-base/init-exec-path-from-shell ()
|
2015-09-08 01:16:15 +00:00
|
|
|
(use-package exec-path-from-shell
|
|
|
|
:init (when (memq window-system '(mac ns x))
|
|
|
|
(exec-path-from-shell-initialize))))
|
|
|
|
|
2015-11-18 16:37:54 +00:00
|
|
|
(defun spacemacs-base/init-help-fns+ ()
|
|
|
|
(use-package help-fns+
|
|
|
|
:commands (describe-keymap)
|
2015-11-23 03:31:29 +00:00
|
|
|
:init (spacemacs/set-leader-keys "hdK" 'describe-keymap)))
|
2015-11-18 16:37:54 +00:00
|
|
|
|
2016-05-14 15:41:30 +00:00
|
|
|
(defun spacemacs-base/init-hi-lock ()
|
2016-05-20 13:02:15 +00:00
|
|
|
(with-eval-after-load 'hi-lock
|
|
|
|
(spacemacs|hide-lighter hi-lock-mode)))
|
2015-09-24 03:47:36 +00:00
|
|
|
|
2016-03-17 01:59:44 +00:00
|
|
|
(defun spacemacs-base/init-holy-mode ()
|
|
|
|
(use-package holy-mode
|
|
|
|
:commands holy-mode
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(when (eq 'emacs dotspacemacs-editing-style)
|
|
|
|
(holy-mode))
|
|
|
|
(spacemacs|add-toggle holy-mode
|
|
|
|
:status holy-mode
|
|
|
|
:on (progn (when (bound-and-true-p hybrid-mode)
|
|
|
|
(hybrid-mode -1))
|
|
|
|
(holy-mode))
|
|
|
|
:off (holy-mode -1)
|
|
|
|
:documentation "Globally toggle holy mode."
|
|
|
|
:evil-leader "tEe")
|
|
|
|
(spacemacs|diminish holy-mode " Ⓔe" " Ee"))))
|
|
|
|
|
|
|
|
(defun spacemacs-base/init-hybrid-mode ()
|
|
|
|
(use-package hybrid-mode
|
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(when (eq 'hybrid dotspacemacs-editing-style) (hybrid-mode))
|
|
|
|
(spacemacs|add-toggle hybrid-mode
|
|
|
|
:status hybrid-mode
|
|
|
|
:on (progn (when (bound-and-true-p holy-mode)
|
|
|
|
(holy-mode -1))
|
|
|
|
(hybrid-mode))
|
|
|
|
:off (hybrid-mode -1)
|
|
|
|
:documentation "Globally toggle hybrid mode."
|
|
|
|
:evil-leader "tEh")
|
|
|
|
(spacemacs|diminish hybrid-mode " Ⓔh" " Eh"))))
|
|
|
|
|
2016-06-07 17:12:54 +00:00
|
|
|
(defun spacemacs-base/init-image-mode ()
|
|
|
|
(use-package image-mode
|
|
|
|
:config (evilified-state-evilify-map image-mode-map
|
|
|
|
:mode image-mode)))
|
|
|
|
|
2016-05-21 03:57:32 +00:00
|
|
|
(defun spacemacs-base/init-linum ()
|
|
|
|
(when dotspacemacs-line-numbers
|
|
|
|
(add-hook 'prog-mode-hook 'linum-mode)
|
|
|
|
(add-hook 'text-mode-hook 'linum-mode))
|
|
|
|
(setq linum-format "%4d")
|
|
|
|
(spacemacs|add-toggle line-numbers
|
2016-05-31 13:11:00 +00:00
|
|
|
:mode linum-mode
|
2016-05-21 03:57:32 +00:00
|
|
|
:documentation "Show the line numbers."
|
|
|
|
:evil-leader "tn"))
|
2016-05-12 15:12:13 +00:00
|
|
|
|
2015-11-10 07:58:41 +00:00
|
|
|
(defun spacemacs-base/init-package-menu ()
|
2015-11-19 05:24:27 +00:00
|
|
|
(evilified-state-evilify-map package-menu-mode-map
|
2015-11-10 07:58:41 +00:00
|
|
|
:mode package-menu-mode))
|
|
|
|
|
2016-06-05 04:04:53 +00:00
|
|
|
(defun spacemacs-base/init-page-break-lines ()
|
|
|
|
(require 'page-break-lines)
|
|
|
|
(global-page-break-lines-mode t)
|
|
|
|
(spacemacs|hide-lighter page-break-lines-mode))
|
|
|
|
|
2015-09-24 03:47:36 +00:00
|
|
|
(defun spacemacs-base/init-process-menu ()
|
2015-11-21 10:07:14 +00:00
|
|
|
(evilified-state-evilify process-menu-mode process-menu-mode-map))
|
2015-09-24 03:47:36 +00:00
|
|
|
|
2016-05-20 00:16:27 +00:00
|
|
|
(defun spacemacs-base/init-projectile ()
|
|
|
|
(use-package projectile
|
|
|
|
:commands (projectile-ack
|
|
|
|
projectile-ag
|
|
|
|
projectile-compile-project
|
|
|
|
projectile-dired
|
|
|
|
projectile-find-dir
|
|
|
|
projectile-find-file
|
|
|
|
projectile-find-tag
|
|
|
|
projectile-test-project
|
|
|
|
projectile-grep
|
|
|
|
projectile-invalidate-cache
|
|
|
|
projectile-kill-buffers
|
|
|
|
projectile-multi-occur
|
|
|
|
projectile-project-p
|
|
|
|
projectile-project-root
|
|
|
|
projectile-recentf
|
|
|
|
projectile-regenerate-tags
|
|
|
|
projectile-replace
|
|
|
|
projectile-replace-regexp
|
|
|
|
projectile-run-async-shell-command-in-root
|
|
|
|
projectile-run-shell-command-in-root
|
|
|
|
projectile-switch-project
|
|
|
|
projectile-switch-to-buffer
|
|
|
|
projectile-vc)
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
;; note for Windows: GNU find or Cygwin find must be in path to enable
|
|
|
|
;; fast indexing
|
|
|
|
(when (and (spacemacs/system-is-mswindows) (executable-find "find"))
|
|
|
|
(setq projectile-indexing-method 'alien
|
|
|
|
projectile-generic-command "find . -type f"))
|
|
|
|
(setq projectile-sort-order 'recentf
|
|
|
|
projectile-cache-file (concat spacemacs-cache-directory
|
|
|
|
"projectile.cache")
|
|
|
|
projectile-known-projects-file (concat spacemacs-cache-directory
|
|
|
|
"projectile-bookmarks.eld"))
|
2016-06-01 03:19:54 +00:00
|
|
|
(spacemacs/set-leader-keys
|
|
|
|
"pb" 'projectile-switch-to-buffer
|
|
|
|
"pd" 'projectile-find-dir
|
|
|
|
"pf" 'projectile-find-file
|
|
|
|
"pF" 'projectile-find-file-dwim
|
|
|
|
"ph" 'helm-projectile
|
|
|
|
"pr" 'projectile-recentf
|
|
|
|
"pp" 'projectile-switch-project
|
|
|
|
"pv" 'projectile-vc)
|
2016-05-20 00:16:27 +00:00
|
|
|
(spacemacs/set-leader-keys
|
|
|
|
"p!" 'projectile-run-shell-command-in-root
|
|
|
|
"p&" 'projectile-run-async-shell-command-in-root
|
|
|
|
"p%" 'projectile-replace-regexp
|
|
|
|
"pa" 'projectile-toggle-between-implementation-and-test
|
|
|
|
"pc" 'projectile-compile-project
|
|
|
|
"pD" 'projectile-dired
|
|
|
|
"pG" 'projectile-regenerate-tags
|
|
|
|
"pI" 'projectile-invalidate-cache
|
|
|
|
"pk" 'projectile-kill-buffers
|
|
|
|
"po" 'projectile-multi-occur
|
|
|
|
"pR" 'projectile-replace
|
|
|
|
"pT" 'projectile-test-project
|
|
|
|
"py" 'projectile-find-tag))
|
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(projectile-global-mode)
|
|
|
|
(spacemacs|hide-lighter projectile-mode))))
|
|
|
|
|
2015-09-16 09:24:25 +00:00
|
|
|
(defun spacemacs-base/init-recentf ()
|
2015-09-08 01:16:15 +00:00
|
|
|
(use-package recentf
|
|
|
|
:defer t
|
|
|
|
:init
|
2015-11-03 04:08:22 +00:00
|
|
|
(progn
|
|
|
|
;; lazy load recentf
|
|
|
|
(add-hook 'find-file-hook (lambda () (unless recentf-mode
|
|
|
|
(recentf-mode)
|
|
|
|
(recentf-track-opened-file))))
|
|
|
|
(setq recentf-save-file (concat spacemacs-cache-directory "recentf")
|
|
|
|
recentf-max-saved-items 1000
|
|
|
|
recentf-auto-cleanup 'never
|
|
|
|
recentf-auto-save-timer (run-with-idle-timer 600 t
|
|
|
|
'recentf-save-list)))
|
2015-11-03 00:13:06 +00:00
|
|
|
:config
|
2015-11-03 04:08:22 +00:00
|
|
|
(progn
|
|
|
|
(add-to-list 'recentf-exclude
|
|
|
|
(expand-file-name spacemacs-cache-directory))
|
|
|
|
(add-to-list 'recentf-exclude (expand-file-name package-user-dir))
|
|
|
|
(add-to-list 'recentf-exclude "COMMIT_EDITMSG\\'"))))
|
2015-09-08 01:16:15 +00:00
|
|
|
|
2015-09-16 09:24:25 +00:00
|
|
|
(defun spacemacs-base/init-savehist ()
|
2015-09-08 01:16:15 +00:00
|
|
|
(use-package savehist
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
;; Minibuffer history
|
|
|
|
(setq savehist-file (concat spacemacs-cache-directory "savehist")
|
|
|
|
enable-recursive-minibuffers t ; Allow commands in minibuffers
|
|
|
|
history-length 1000
|
|
|
|
savehist-additional-variables '(mark-ring
|
|
|
|
global-mark-ring
|
|
|
|
search-ring
|
|
|
|
regexp-search-ring
|
|
|
|
extended-command-history)
|
|
|
|
savehist-autosave-interval 60)
|
|
|
|
(savehist-mode t))))
|
|
|
|
|
2015-09-16 09:24:25 +00:00
|
|
|
(defun spacemacs-base/init-saveplace ()
|
2015-09-08 01:16:15 +00:00
|
|
|
(use-package saveplace
|
|
|
|
:init
|
|
|
|
(progn
|
2015-10-09 13:46:10 +00:00
|
|
|
(if (fboundp 'save-place-mode)
|
|
|
|
;; Emacs 25 has a proper mode for `save-place'
|
|
|
|
(save-place-mode)
|
|
|
|
(setq save-place t))
|
2015-09-08 01:16:15 +00:00
|
|
|
;; Save point position between sessions
|
2015-10-09 13:46:10 +00:00
|
|
|
(setq save-place-file (concat spacemacs-cache-directory "places")))))
|
2015-09-08 01:16:15 +00:00
|
|
|
|
2015-09-16 09:24:25 +00:00
|
|
|
(defun spacemacs-base/init-spacemacs-theme ()
|
2015-09-08 01:16:15 +00:00
|
|
|
(use-package spacemacs-theme
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(setq spacemacs-theme-comment-bg t)
|
|
|
|
(setq spacemacs-theme-org-height t))))
|
|
|
|
|
2015-09-16 09:24:25 +00:00
|
|
|
(defun spacemacs-base/init-subword ()
|
2015-09-08 01:16:15 +00:00
|
|
|
(unless (version< emacs-version "24.4")
|
|
|
|
(use-package subword
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(unless (category-docstring ?U)
|
|
|
|
(define-category ?U "Uppercase")
|
|
|
|
(define-category ?u "Lowercase"))
|
|
|
|
(modify-category-entry (cons ?A ?Z) ?U)
|
|
|
|
(modify-category-entry (cons ?a ?z) ?u)
|
|
|
|
(make-variable-buffer-local 'evil-cjk-word-separating-categories)
|
|
|
|
(defun spacemacs//subword-enable-camel-case ()
|
|
|
|
"Add support for camel case to subword."
|
|
|
|
(if subword-mode
|
|
|
|
(push '(?u . ?U) evil-cjk-word-separating-categories)
|
|
|
|
(setq evil-cjk-word-separating-categories
|
|
|
|
(default-value 'evil-cjk-word-separating-categories))))
|
|
|
|
(add-hook 'subword-mode-hook 'spacemacs//subword-enable-camel-case)
|
|
|
|
(spacemacs|add-toggle camel-case-motion
|
2016-05-31 13:11:00 +00:00
|
|
|
:mode subword-mode
|
2015-09-08 01:16:15 +00:00
|
|
|
:documentation "Toggle CamelCase motions."
|
|
|
|
:evil-leader "tc")
|
|
|
|
(spacemacs|add-toggle camel-case-motion-globally
|
2016-05-31 13:11:00 +00:00
|
|
|
:mode global-subword-mode
|
2015-09-08 01:16:15 +00:00
|
|
|
:documentation "Globally toggle CamelCase motions."
|
|
|
|
:evil-leader "t C-c"))
|
|
|
|
:config
|
|
|
|
(spacemacs|diminish subword-mode " ⓒ" " c"))))
|
|
|
|
|
2016-05-20 14:37:02 +00:00
|
|
|
(defun spacemacs-base/init-tar-mode ()
|
|
|
|
(evilified-state-evilify-map tar-mode-map
|
|
|
|
:mode tar-mode
|
|
|
|
:eval-after-load tar-mode))
|
|
|
|
|
2015-09-24 03:47:36 +00:00
|
|
|
(defun spacemacs-base/init-uniquify ()
|
|
|
|
(require 'uniquify)
|
|
|
|
;; When having windows with repeated filenames, uniquify them
|
|
|
|
;; by the folder they are in rather those annoying <2>,<3>,.. etc
|
|
|
|
(setq uniquify-buffer-name-style 'post-forward-angle-brackets
|
|
|
|
;; don't screw special buffers
|
|
|
|
uniquify-ignore-buffers-re "^\\*"))
|
|
|
|
|
2015-10-10 00:04:37 +00:00
|
|
|
(defun spacemacs-base/init-url ()
|
2015-10-11 03:54:09 +00:00
|
|
|
;; gravatars from magit use this to store their cache
|
|
|
|
(setq url-configuration-directory (concat spacemacs-cache-directory "url/")))
|
2015-10-10 00:04:37 +00:00
|
|
|
|
2015-09-16 09:24:25 +00:00
|
|
|
(defun spacemacs-base/init-whitespace ()
|
2015-09-08 01:16:15 +00:00
|
|
|
(use-package whitespace
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(setq spacemacs-show-trailing-whitespace t)
|
|
|
|
(defun spacemacs//show-trailing-whitespace ()
|
|
|
|
(when spacemacs-show-trailing-whitespace
|
|
|
|
(set-face-attribute 'trailing-whitespace nil
|
|
|
|
:background
|
|
|
|
(face-attribute 'font-lock-comment-face
|
|
|
|
:foreground))
|
|
|
|
(setq show-trailing-whitespace 1)))
|
|
|
|
(add-hook 'prog-mode-hook 'spacemacs//show-trailing-whitespace)
|
|
|
|
|
|
|
|
(spacemacs|add-toggle whitespace
|
2016-05-31 13:11:00 +00:00
|
|
|
:mode whitespace-mode
|
2015-09-08 01:16:15 +00:00
|
|
|
:documentation "Display whitespace."
|
|
|
|
:evil-leader "tw")
|
|
|
|
(spacemacs|add-toggle whitespace-globally
|
2016-05-31 13:11:00 +00:00
|
|
|
:mode global-whitespace-mode
|
2015-09-08 01:16:15 +00:00
|
|
|
:documentation "Display whitespace globally."
|
|
|
|
:evil-leader "t C-w")
|
|
|
|
|
|
|
|
(defun spacemacs//set-whitespace-style-for-diff ()
|
|
|
|
"Whitespace configuration for `diff-mode'"
|
|
|
|
(setq-local whitespace-style '(face
|
|
|
|
tabs
|
|
|
|
tab-mark
|
|
|
|
spaces
|
|
|
|
space-mark
|
|
|
|
trailing
|
|
|
|
indentation::space
|
|
|
|
indentation::tab
|
|
|
|
newline
|
|
|
|
newline-mark)))
|
|
|
|
(add-hook 'diff-mode-hook 'whitespace-mode)
|
|
|
|
(add-hook 'diff-mode-hook 'spacemacs//set-whitespace-style-for-diff))
|
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(set-face-attribute 'whitespace-space nil
|
|
|
|
:background nil
|
|
|
|
:foreground (face-attribute 'font-lock-warning-face
|
|
|
|
:foreground))
|
|
|
|
(set-face-attribute 'whitespace-tab nil
|
|
|
|
:background nil)
|
|
|
|
(set-face-attribute 'whitespace-indentation nil
|
|
|
|
:background nil)
|
|
|
|
(spacemacs|diminish whitespace-mode " ⓦ" " w")
|
2016-06-03 00:57:15 +00:00
|
|
|
(spacemacs|diminish global-whitespace-mode " ⓦ" " w"))))
|
2015-09-08 01:16:15 +00:00
|
|
|
|
2015-09-16 09:24:25 +00:00
|
|
|
(defun spacemacs-base/init-winner ()
|
2015-09-08 01:16:15 +00:00
|
|
|
(use-package winner
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(winner-mode t)
|
|
|
|
(setq spacemacs/winner-boring-buffers '("*Completions*"
|
|
|
|
"*Compile-Log*"
|
|
|
|
"*inferior-lisp*"
|
|
|
|
"*Fuzzy Completions*"
|
|
|
|
"*Apropos*"
|
|
|
|
"*Help*"
|
|
|
|
"*cvs*"
|
|
|
|
"*Buffer List*"
|
|
|
|
"*Ibuffer*"
|
|
|
|
"*esh command on file*"
|
|
|
|
))
|
|
|
|
(setq winner-boring-buffers
|
|
|
|
(append winner-boring-buffers spacemacs/winner-boring-buffers))
|
|
|
|
(winner-mode t))))
|