diff --git a/README.md b/README.md index f6e8cafcac32..97a987d8c1a2 100644 --- a/README.md +++ b/README.md @@ -171,9 +171,12 @@ Details can be found on the emacs-mac-port [README][emacs-mac-port-server]. 3. Launch Emacs. Spacemacs will automatically install the packages it requires. -4. Restart Emacs to complete the installation. - -See the [troubleshooting][troubleshoot] guide if you have any issues. +4. Restart Emacs to complete the installation. If you see something like this: +``` +Loading............................................................Ready! +[121 packages loaded in 3.208s] +``` +You should be good to go! Otherwise, see the [troubleshooting][troubleshoot] guide. # Update diff --git a/contrib/ace-window/README.md b/contrib/ace-window/README.md deleted file mode 100644 index 4382e45b1be8..000000000000 --- a/contrib/ace-window/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# Ace-window contribution layer for Spacemacs - - -**Table of Contents** - -- [Ace-window contribution layer for Spacemacs](#ace-window-contribution-layer-for-spacemacs) - - [Description](#description) - - [Install](#install) - - [Key bindings](#key-bindings) - - - -## Description - -This layer adds support for [ace-window][]. - -## Install - -To use this contribution add it to your `~/.spacemacs` - -```elisp -(setq-default dotspacemacs-configuration-layers '(ace-window)) -``` - -## Key bindings - -Key Binding | Description -----------------------|------------------------------------------------------------ -SPC b m m | swap a buffer with another -SPC w c | delete a window (replace `delete-window`) -SPC w m | maximize a window (replace `toggle-maximize-buffer`) -SPC w w | switch to a window (replace `other-window`) - -[ace-window]: https://github.com/abo-abo/ace-window diff --git a/contrib/ace-window/packages.el b/contrib/ace-window/packages.el deleted file mode 100644 index 17d70137751d..000000000000 --- a/contrib/ace-window/packages.el +++ /dev/null @@ -1,39 +0,0 @@ -;;; packages.el --- ace-window Layer packages File for Spacemacs -;; -;; Copyright (c) 2012-2014 Sylvain Benner -;; Copyright (c) 2014-2015 Sylvain Benner & Contributors -;; -;; Author: Sylvain Benner -;; URL: https://github.com/syl20bnr/spacemacs -;; -;; This file is not part of GNU Emacs. -;; -;;; License: GPLv3 - -(defvar ace-window-packages '(ace-window) - "List of all packages to install and/or initialize. Built-in packages -which require an initialization must be listed explicitly in the list.") - -(defvar ace-window-excluded-packages '() - "List of packages to exclude.") - -(defun ace-window/init-ace-window () - (use-package ace-window - :defer t - :init - (evil-leader/set-key - "bmm" 'ace-swap-window - "wc" 'ace-delete-window - "wm" 'ace-maximize-window - "ww" 'ace-window) - :config - (progn - ;; add support for golden-ratio - (eval-after-load 'golden-ratio - '(setq golden-ratio-extra-commands - (append golden-ratio-extra-commands - '(ace-window - ace-delete-window - ace-select-window - ace-swap-window - ace-maximize-window))))))) diff --git a/contrib/evil-snipe/README.md b/contrib/evil-snipe/README.md index 9c60db79f5ae..5be385ff5132 100644 --- a/contrib/evil-snipe/README.md +++ b/contrib/evil-snipe/README.md @@ -19,6 +19,10 @@ The package [evil-snipe](https://github.com/hlissner/evil-snipe) - enables more efficient searches with `f/F/t/T`. - adds a new, more precise search with `s/S` +Evil-snipe allows you to search more quickly and precisely in the buffer. +It does so by improving on the built in `f`/`F`/`t`/`T` searches and +adding another search command, namely `s`/`S`. + `evil-snipe` changes `s/S` behavior in order to search forward/backwards in the buffer with two chars. @@ -32,7 +36,12 @@ To use this contribution add it to your `~/.spacemacs` (setq-default dotspacemacs-configuration-layers '(evil-snipe)) ``` -### Alternate behavior for `f/F` and `t/T` +### Improved f and t search behavior + +With evil-snipe you can define your own search scope for `f` and `t` searches +which means that you won't have to jump to the correct line before searching +with `f`/`t`/`F`/`T`. And after you have found a match, you can just press `f` +or `t` again afterwards to continue the search. No need to use `;`/`,`. This alternate behavior is disabled by default, to enable it set the layer variable `evil-snipe-enable-alternate-f-and-t-behaviors` to `t`: @@ -42,8 +51,16 @@ layer variable `evil-snipe-enable-alternate-f-and-t-behaviors` to `t`: '(evil-snipe :variables evil-snipe-enable-alternate-f-and-t-behaviors t )) ``` -Instead of repeating searches with `,/;` you can just press `f/t` again to -continue the search (`F/T` to go the opposite direction). +### Two-character search with s + +With the `s`/`S` keys you can do a simple search like `f`/`t`, but instead +of searching for one character, you search for two. This makes the search a lot +more precise than regular `f`/`t` searches. While you can search +forward or backwards in the buffer with `/` and `?`, `s`/`S` are much easier +to reach, don't require you to press enter and they are precise enough for +many common purposes. + +### More scopes Evil-snipe also adds several scope options for searches (set `evil-snipe-scope` and `evil-snipe-repeat-scope` to one of these, the default @@ -62,6 +79,29 @@ If you do not want to replace the regular `f/F/t/T` behavior, just remove this line from `evil-snipe/packages.el`: `(evil-snipe-replace-evil)` +### Symbol groups + +With symbol groups you can let a character stand for a regex, for example a +group of characters. By adding a pair of `'(CHAR REGEX)` to the list +`'evil-snipe-symbol-groups` you can search for a regex very simply: + +- Here we set the `[` character to mean `all characters "[({"` so a search +with `sa[` would find `a[`, `a{` or `a(`. + +```elisp +;; Alias [ and ] to all types of brackets +(add-to-list 'evil-snipe-symbol-groups '(?\\[ \"[[{(]\")) +``` + +- Here we set the char `:` to mean `a regex matching python function +definitions` so by searching with `f:fff` you can quickly cycle through +all function definitions in a buffer! + +```elisp +;; For python style functions +(add-to-list 'evil-snipe-symbol-groups '(?\\: \"def .+:\"\)) +``` + ## Key bindings TODO diff --git a/contrib/evil-snipe/packages.el b/contrib/evil-snipe/packages.el index 9075cc72c676..b01f7ccb7ecf 100644 --- a/contrib/evil-snipe/packages.el +++ b/contrib/evil-snipe/packages.el @@ -16,6 +16,6 @@ which require an initialization must be listed explicitly in the list.") evil-snipe-show-prompt nil evil-snipe-smart-case t) - (when evil-snipe-enable-alternate-f-and-t-behaviors - (evil-snipe-replace-evil) - (setq evil-snipe-repeat-scope 'whole-buffer))) + (when evil-snipe-enable-alternate-f-and-t-behaviors + (evil-snipe-override-mode t) + (setq evil-snipe-repeat-scope 'whole-buffer))) diff --git a/contrib/fasd/README.md b/contrib/fasd/README.md index 00738bf4a1db..b32ef490e556 100644 --- a/contrib/fasd/README.md +++ b/contrib/fasd/README.md @@ -42,9 +42,10 @@ $ brew install fasd ## Keybindings -Key Binding | Description ---------------------|------------------------------------------------------------------ -SPC f z | find a file with fasd +Key Binding | Description +--------------------------|------------------------------------------------------------------ +SPC f z | find a file or directory with fasd +SPC u SPC f z | find a directory with fasd [fasd]: https://github.com/clvv/fasd [fasd-install]: https://github.com/clvv/fasd#install diff --git a/contrib/lang/clojure/README.md b/contrib/lang/clojure/README.md index 3e7bfdf35461..f7d7ded2e601 100644 --- a/contrib/lang/clojure/README.md +++ b/contrib/lang/clojure/README.md @@ -72,7 +72,8 @@ Or set this variable when loading the configuration layer: ```clj {:user {:plugins [[cider/cider-nrepl "0.9.0-SNAPSHOT"] - [refactor-nrepl "0.3.0-SNAPSHOT"]]}} + [refactor-nrepl "0.3.0-SNAPSHOT"]] + :dependencies [[alembic "0.3.2"]]}} ``` #### More details diff --git a/contrib/lang/clojure/packages.el b/contrib/lang/clojure/packages.el index ef1e794cf253..03cf510774f9 100644 --- a/contrib/lang/clojure/packages.el +++ b/contrib/lang/clojure/packages.el @@ -43,7 +43,9 @@ which require an initialization must be listed explicitly in the list.") cider-prompt-save-file-on-load nil cider-repl-use-clojure-font-lock t) (add-hook 'clojure-mode-hook 'cider-mode) - (add-hook 'cider-mode-hook 'cider-turn-on-eldoc-mode)) + (add-hook 'cider-mode-hook 'cider-turn-on-eldoc-mode) + (if dotspacemacs-smartparens-strict-mode + (add-hook 'cider-repl-mode-hook #'smartparens-strict-mode))) :config (progn ;; add support for golden-ratio @@ -154,7 +156,7 @@ the focus." "mss" 'cider-switch-to-repl-buffer "mtt" 'cider-test-run-tests) - (when clojure-enable-fancify-symbols + (when clojure-enable-fancify-symbols (clojure/fancify-symbols 'cider-repl-mode))))) (defun clojure/init-clj-refactor () diff --git a/contrib/lang/html/README.md b/contrib/lang/html/README.md index aa69d57264b1..7798558685c0 100644 --- a/contrib/lang/html/README.md +++ b/contrib/lang/html/README.md @@ -9,6 +9,8 @@ - [Description](#description) - [Install](#install) - [Key Bindings](#key-bindings) + - [Web mode](#web-mode) + - [CSS/Scss](#cssscss) @@ -32,11 +34,46 @@ To use this contribution add it to your `~/.spacemacs` ## Key Bindings -### commands +### Web mode Key Binding | Description ---------------------|------------------------------------------------------------ -SPC m h | quick navigate CSS rules using helm +SPC m g p | quickly navigate CSS rules using `helm` +SPC m e h | highlight DOM errors +SPC m g b | go to the beginning of current element +SPC m g c | go to the first child element +SPC m g p | go to the parent element +SPC m g s | go to next sibling +SPC m h p | show xpath of the current element +SPC m r c | clone the current element +SPC m r d | delete the current element (does not delete the children) +SPC m r r | rename current element +SPC m r w | wrap current element +SPC m z | fold/unfold current element + +A micro-state is also defined, start it with SPC m . or +, . + + Key Binding | Description +---------------------|------------------------------------------------------------ +? | Toggle full help +c | clone current element +d | delete (vanish) current element (does not delete the children) +h | previous element +l | next element +L | next sibling element +k | parent element +j | first child element +p | show xpath of current element +r | rename current element +q | leave the micro-state +w | wrap current element + +### CSS/Scss + + Key Binding | Description +---------------------|------------------------------------------------------------ +SPC m g h | quickly navigate CSS rules using `helm` [web-mode]: http://web-mode.org/ [emmet-mode]: https://github.com/smihica/emmet-mode diff --git a/contrib/lang/html/packages.el b/contrib/lang/html/packages.el index e74e3e59660d..e8a313319a62 100644 --- a/contrib/lang/html/packages.el +++ b/contrib/lang/html/packages.el @@ -37,17 +37,72 @@ which require an initialization must be listed explicitly in the list.") (defun html/init-web-mode () (use-package web-mode :defer t - :mode (("\\.phtml\\'" . web-mode) - ("\\.tpl\\.php\\'" . web-mode) - ("\\.html\\'" . web-mode) - ("\\.htm\\'" . web-mode) - ("\\.[gj]sp\\'" . web-mode) - ("\\.as[cp]x\\'" . web-mode) - ("\\.erb\\'" . web-mode) - ("\\.mustache\\'" . web-mode) - ("\\.handlebars\\'" . web-mode) - ("\\.hbs\\'" . web-mode) - ("\\.djhtml\\'" . web-mode)))) + :config + (progn + + (evil-leader/set-key-for-mode 'web-mode + "meh" 'web-mode-dom-errors-show + "mgb" 'web-mode-element-beginning + "mgc" 'web-mode-element-child + "mgp" 'web-mode-element-parent + "mgs" 'web-mode-element-sibling-next + "mhp" 'web-mode-dom-xpath + "mrc" 'web-mode-element-clone + "mrd" 'web-mode-element-vanish + "mrr" 'web-mode-element-rename + "mrw" 'web-mode-element-wrap + "mz" 'web-mode-fold-or-unfold + ;; TODO element close would be nice but broken with evil. + ) + + (defvar spacemacs--web-mode-ms-doc-toggle 0 + "Display a short doc when nil, full doc otherwise.") + + (defun spacemacs//web-mode-ms-doc () + (if (equal 0 spacemacs--web-mode-ms-doc-toggle) + "[?] for help" + " + [?] display this help + [h] previous [l] next [L] sibling [k] parent [j] child + [c] clone [d] delete [r] rename [w] wrap [p] xpath + [q] quit")) + + (defun spacemacs//web-mode-ms-toggle-doc () + (interactive) + (setq spacemacs--web-mode-ms-doc-toggle + (logxor spacemacs--web-mode-ms-doc-toggle 1))) + + (spacemacs|define-micro-state web-mode + :doc (spacemacs//web-mode-ms-doc) + :persistent t + :evil-leader-for-mode (web-mode . "m.") + :bindings + ("" nil :exit t) + ("?" spacemacs//web-mode-ms-toggle-doc) + ("c" web-mode-element-clone) + ("d" web-mode-element-vanish) + ("h" web-mode-element-previous) + ("l" web-mode-element-next) + ("L" web-mode-element-sibling-next) + ("k" web-mode-element-parent) + ("j" web-mode-element-child) + ("p" web-mode-dom-xpath) + ("r" web-mode-element-rename) + ("q" nil :exit t) + ("w" web-mode-element-wrap))) + + :mode + (("\\.phtml\\'" . web-mode) + ("\\.tpl\\.php\\'" . web-mode) + ("\\.html\\'" . web-mode) + ("\\.htm\\'" . web-mode) + ("\\.[gj]sp\\'" . web-mode) + ("\\.as[cp]x\\'" . web-mode) + ("\\.erb\\'" . web-mode) + ("\\.mustache\\'" . web-mode) + ("\\.handlebars\\'" . web-mode) + ("\\.hbs\\'" . web-mode) + ("\\.djhtml\\'" . web-mode)))) (defun html/init-emmet-mode () (use-package emmet-mode diff --git a/contrib/lang/ruby/packages.el b/contrib/lang/ruby/packages.el index b179afe2acfa..ddfc1af7805e 100644 --- a/contrib/lang/ruby/packages.el +++ b/contrib/lang/ruby/packages.el @@ -150,5 +150,9 @@ (use-package ruby-test-mode :defer t :init (add-hook 'ruby-mode-hook 'ruby-test-mode) - :config (progn (evil-leader/set-key "mtb" 'ruby-test-run) - (evil-leader/set-key "mtt" 'ruby-test-run-at-point)))) + :config + (progn + (spacemacs|hide-lighter ruby-test-mode) + (evil-leader/set-key + "mtb" 'ruby-test-run + "mtt" 'ruby-test-run-at-point)))) diff --git a/contrib/slime/README.md b/contrib/slime/README.md new file mode 100644 index 000000000000..8d164030b7f1 --- /dev/null +++ b/contrib/slime/README.md @@ -0,0 +1,58 @@ +# SLIME contribution layer for Spacemacs + +![slime](img/slime.png) + + +**Table of Contents** + +- [SLIME contribution layer for Spacemacs](#slime-contribution-layer-for-spacemacs) + - [Description](#description) + - [Install](#install) + - [Key Bindings](#key-bindings) + - [Future Work](#future-work) + + + +## Description + +A Spacemacs contribution layer for [SLIME][]. + +## Install + +To use this contribution, add it to your `~/.spacemacs` + +```elisp +(setq-default dotspacemacs-configuration-layers '(slime)) +``` + +This layer defaults to using [sbcl][]. If you wan to use a different +implementation of Common Lisp, you can specify it in your `~/.spacemacs`: + +```elisp +(defun dotspacemacs/config () + (setq inferior-lisp-program "/path/to/your/lisp")) +``` + +## Key Bindings + +This layer doesn't yet include Spacemacsy keybindings. +The following is a list of some of SLIME's default keybindings. + + Key Binding | Description +------------------|------------------------------------------------------------ +C-c | Prefix Command +C-c C-k | Compile and load the current buffer's file. +C-c C-c | Compile the top-level form at point. +C-c C-d C-d | Describe symbol. +C-c C-d C-a | Apropos search. +M-n | slime-repl-next-input +M-p | slime-repl-previous-input +C-M-x | lisp-eval-defun +C-h m | check emacs mode help for all of SLIME's keybindings + +## Future Work + +- Add proper Spacemacs keybindings + +[SLIME]: https://github.com/slime/slime +[sbcl]: http://www.sbcl.org/ diff --git a/contrib/ace-window/extensions.el b/contrib/slime/extensions.el similarity index 63% rename from contrib/ace-window/extensions.el rename to contrib/slime/extensions.el index ddddb483a9aa..39a2c01e29d6 100644 --- a/contrib/ace-window/extensions.el +++ b/contrib/slime/extensions.el @@ -1,4 +1,4 @@ -;;; extensions.el --- ace-window Layer extensions File for Spacemacs +;;; extensions.el --- slime Layer extensions File for Spacemacs ;; ;; Copyright (c) 2012-2014 Sylvain Benner ;; Copyright (c) 2014-2015 Sylvain Benner & Contributors @@ -10,21 +10,21 @@ ;; ;;; License: GPLv3 -(defvar ace-window-pre-extensions +(defvar slime-pre-extensions '( - ;; pre extension ace-windows go here + ;; pre extension slimes go here ) "List of all extensions to load before the packages.") -(defvar ace-window-post-extensions +(defvar slime-post-extensions '( - ;; post extension ace-windows go here + ;; post extension slimes go here ) "List of all extensions to load after the packages.") -;; For each extension, define a function ace-window/init- +;; For each extension, define a function slime/init- ;; -;; (defun ace-window/init-my-extension () +;; (defun slime/init-my-extension () ;; "Initialize my extension" ;; ) ;; diff --git a/contrib/slime/img/slime.png b/contrib/slime/img/slime.png new file mode 100644 index 000000000000..dc430816719a Binary files /dev/null and b/contrib/slime/img/slime.png differ diff --git a/contrib/slime/packages.el b/contrib/slime/packages.el new file mode 100644 index 000000000000..27b03a2c1e9c --- /dev/null +++ b/contrib/slime/packages.el @@ -0,0 +1,33 @@ +;;; packages.el --- slime Layer packages File for Spacemacs +;; +;; Copyright (c) 2012-2014 Sylvain Benner +;; Copyright (c) 2014-2015 Sylvain Benner & Contributors +;; +;; Author: Sylvain Benner +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + +(defvar slime-packages + '(slime) + "List of all packages to install and/or initialize. Built-in packages +which require an initialization must be listed explicitly in the list.") + +(defvar slime-excluded-packages '() + "List of packages to exclude.") + +(defun slime/init-slime () + (use-package slime + :commands slime-mode + :init + (progn + (setq slime-contribs '(slime-fancy) + inferior-lisp-program "sbcl") + (add-to-hooks 'slime-mode '(lisp-mode-hook + emacs-lisp-mode-hook + scheme-mode-hook))) + :config + (message "loading slime...") + (slime-setup))) diff --git a/contrib/vagrant/README.md b/contrib/vagrant/README.md new file mode 100644 index 000000000000..b7e253f14eb7 --- /dev/null +++ b/contrib/vagrant/README.md @@ -0,0 +1,69 @@ +# Vagrant contribution layer for Spacemacs + +![vagrant](img/vagrant.png) + + +**Table of Contents** + +- [Vagrant contribution layer for Spacemacs](#vagrant-contribution-layer-for-spacemacs) + - [Description](#description) + - [Install](#install) + - [Layer](#layer) + - [Vagrant](#vagrant) + - [Testing](#testing) + - [Keybindings](#keybindings) + + + +## Description + +This layer adds support for working with Vagrant using [vagrant.el][] and +[vagrant-tramp][]. + +Features: + - manage boxes (under the SPC V prefix) + - remote editing on Vagrant boxes via Tramp + +## Install + +### Layer + +To use this contribution add it to your `~/.spacemacs` + +```elisp +(setq-default dotspacemacs-configuration-layers '(ruby vagrant)) +``` + +**Note** Since vagrant files are written in `ruby` it is recommended +to install the `ruby` layer as well. + +### Vagrant + +Follow the [Installing Vagrant][] and [Getting Started][] guides in +Vagrant's documentation. + +### Testing + +If you'd like to test this layer out in a simple way (for example to +make sure you have Vagrant configured correctly) there is a [Vagrantfile][] +in this directory. + +## Keybindings + +Key Binding | Description +-------------------|----------------------------------------------------------------------------------------------- +SPC V D | destroy a box +SPC V e | edit the `Vagrantfile` +SPC V H | halt (shut down) a box +SPC V p | (re)provision a box that is already up +SPC V r | resume a suspended box (you can also use `SPC V V` for this) +SPC V s | view the status of running boxes in the current project +SPC V S | suspend a box +SPC V t | start a `vagrant-tramp-term` session - after start, edit files at `/vagrant:box_name:filename` +SPC V V | bring up a Vagrant box + +[vagrant.el]: https://github.com/ottbot/vagrant.el +[vagrant-tramp]: https://github.com/dougm/vagrant-tramp +[Installing Vagrant]: http://docs.vagrantup.com/v2/installation/index.html +[Getting Started]: http://docs.vagrantup.com/v2/getting-started/index.html +[Vagrantfile]: Vagrantfile diff --git a/contrib/vagrant/Vagrantfile b/contrib/vagrant/Vagrantfile new file mode 100644 index 000000000000..245438d786a8 --- /dev/null +++ b/contrib/vagrant/Vagrantfile @@ -0,0 +1,14 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# This file is provided for testing this layer - it doesn't really do +# very much! + +# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! +VAGRANTFILE_API_VERSION = "2" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + config.vm.box = "ubuntu/trusty64" + + config.vm.provision :shell, inline: "echo provisioned" +end diff --git a/contrib/vagrant/img/vagrant.png b/contrib/vagrant/img/vagrant.png new file mode 100644 index 000000000000..3d25444425e8 Binary files /dev/null and b/contrib/vagrant/img/vagrant.png differ diff --git a/contrib/vagrant/packages.el b/contrib/vagrant/packages.el new file mode 100644 index 000000000000..8189af55c258 --- /dev/null +++ b/contrib/vagrant/packages.el @@ -0,0 +1,42 @@ +;;; packages.el --- Vagrant Layer extensions File for Spacemacs +;; +;; Copyright (c) 2012-2014 Sylvain Benner +;; Copyright (c) 2015 Brian Hicks & Contributors +;; +;; Author: Brian Hicks +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 +(defvar vagrant-packages '(vagrant + vagrant-tramp)) + +(defun vagrant/init-vagrant () + (use-package vagrant + :defer t + :init + (progn + (spacemacs/declare-prefix "V" "vagrant") + (evil-leader/set-key + "VD" 'vagrant-destroy + "Ve" 'vagrant-edit + "VH" 'vagrant-halt + "Vp" 'vagrant-provision + "Vr" 'vagrant-resume + "Vs" 'vagrant-status + "VS" 'vagrant-suspend + "VV" 'vagrant-up)))) + +(defun vagrant/init-vagrant-tramp () + (use-package vagrant-tramp + :defer t + :init + (progn + (defvar spacemacs--vagrant-tramp-loaded nil) + (defadvice vagrant-tramp-term (before spacemacs//load-vagrant activate) + "Lazy load vagrant-tramp." + (unless spacemacs--vagrant-tramp-loaded + (vagrant-tramp-enable) + (setq spacemacs--vagrant-tramp-loaded t))) + (evil-leader/set-key "Vt" 'vagrant-tramp-term)))) diff --git a/core/core-dotspacemacs.el b/core/core-dotspacemacs.el index d2ba5917d09a..d6784f064232 100644 --- a/core/core-dotspacemacs.el +++ b/core/core-dotspacemacs.el @@ -18,10 +18,11 @@ Paths must have a trailing slash (ie. `~/.mycontribs/')") (defvar dotspacemacs-startup-banner 'random - "Specify the startup banner. If the value is an integer then the -banner with the corresponding index is used, if the value is `random' -then the banner is chosen randomly among the available banners, if -the value is nil then no banner is displayed.") + "Specify the startup banner. If the value is an integer then the + text banner with the corresponding index is used, if the value is + `random' then the banner is chosen randomly among the available banners, + if the value is a string then it must be a path to a .PNG file, + if the value is nil then no banner is displayed.") (defvar dotspacemacs-configuration-layers '() "List of configuration layers to load. If it is the symbol `all' instead @@ -44,7 +45,7 @@ with 2 themes variants, one dark and one light") (defvar dotspacemacs-major-mode-leader-key "," "Major mode leader key is a shortcut key which is the equivalent of -pressing ` m`") +pressing ` m`. Set it to `nil` to disable it.") (defvar dotspacemacs-default-font '("Source Code Pro" :size 13 @@ -137,7 +138,7 @@ NOT USED FOR NOW :-)") (evil-leader/set-key-for-mode 'dotspacemacs-mode "mcc" 'dotspacemacs/sync-configuration-layers) (run-at-time - "2 sec" nil + "1 sec" nil (lambda () (message "SPC m c c (or C-c C-c) to apply your changes.")))) (defun dotspacemacs/sync-configuration-layers (arg) @@ -146,6 +147,7 @@ NOT USED FOR NOW :-)") If ARG is non nil then `dotspacemacs/config' is skipped." (interactive "P") (let ((dotspacemacs-loading-progress-bar nil)) + (save-buffer) (load-file buffer-file-name) (dotspacemacs|call-func dotspacemacs/init "Calling dotfile init...") (configuration-layer/sync) diff --git a/core/core-micro-state.el b/core/core-micro-state.el index 5ec6ba2097b4..19c2172f4dcf 100644 --- a/core/core-micro-state.el +++ b/core/core-micro-state.el @@ -51,11 +51,15 @@ Available PROPS: Evaluate SEXP when leaving the micro-state. `:doc STRING or SEXP' - A STRING or a SEXP that evaluates to a string + A STRING or a SEXP that evaluates to a string. + +`:use-minibuffer BOOLEAN' + If non nil then the minibuffer is used to display the documenation + strings. Default is nil. `:persistent BOOLEAN' - If BOOLEAN in non nil then the micro-state never exits. A binding - with an explicitly set `exit t' property is required. + If BOOLEAN is non nil then the micro-state never exits. A binding + with an explicitly set `exit t' property is required. Default is nil. `:bindings EXPRESSIONS' One or several EXPRESSIONS with the form @@ -64,7 +68,7 @@ Available PROPS: :post SEXP :exit SYMBOL) where: - - STRING1 is a key to bound to the function SYMBOL1. + - STRING1 is a key to be bound to the function SYMBOL1. - :doc STRING or SEXP is a STRING or an SEXP that evalutes to a string - :pre is an SEXP evaluated before the bound action @@ -78,11 +82,13 @@ used." (let* ((func (spacemacs//micro-state-func-name name)) (doc (spacemacs/mplist-get props :doc)) (persistent (plist-get props :persistent)) + (msg-func (if (plist-get props :use-minibuffer) 'message 'lv-message)) (exec-binding (plist-get props :execute-binding-on-enter)) (on-enter (spacemacs/mplist-get props :on-enter)) (on-exit (spacemacs/mplist-get props :on-exit)) (bindings (spacemacs/mplist-get props :bindings)) - (wrappers (spacemacs//micro-state-create-wrappers name doc bindings)) + (wrappers (spacemacs//micro-state-create-wrappers + name doc msg-func bindings)) (keymap-body (spacemacs//micro-state-fill-map-sexps wrappers)) (bindkeys (spacemacs//create-key-binding-form props func))) `(progn (defun ,func () @@ -90,8 +96,8 @@ used." (interactive) (let ((doc ,@doc)) (when doc - (lv-message (spacemacs//micro-state-propertize-doc - (format "%S: %s" ',name doc))))) + (apply ',msg-func (list (spacemacs//micro-state-propertize-doc + (format "%S: %s" ',name doc)))))) ,(when exec-binding (spacemacs//micro-state-auto-execute bindings)) ,@on-enter @@ -115,15 +121,16 @@ used." (when binding (call-interactively (cadr binding))))) -(defun spacemacs//micro-state-create-wrappers (name doc bindings) +(defun spacemacs//micro-state-create-wrappers (name doc msg-func bindings) "Return an alist (key wrapper) for each binding in BINDINGS." - (mapcar (lambda (x) (spacemacs//micro-state-create-wrapper name doc x)) + (mapcar (lambda (x) (spacemacs//micro-state-create-wrapper + name doc msg-func x)) (append bindings ;; force SPC to quit the micro-state to avoid a edge case ;; with evil-leader (list '("SPC" nil :exit t))))) -(defun spacemacs//micro-state-create-wrapper (name default-doc binding) +(defun spacemacs//micro-state-create-wrapper (name default-doc msg-func binding) "Create a wrapper of FUNC and return a tuple (key wrapper BINDING)." (let* ((key (car binding)) (wrapped (cadr binding)) @@ -134,12 +141,14 @@ used." (doc-body `((let ((bdoc ,@binding-doc) (defdoc ,@default-doc)) (if bdoc - (lv-message (spacemacs//micro-state-propertize-doc - (format "%S: %s" ',name bdoc))) + (apply ',msg-func + (list (spacemacs//micro-state-propertize-doc + (format "%S: %s" ',name bdoc)))) (when (and defdoc ',wrapped (not (plist-get ',binding :exit))) - (lv-message (spacemacs//micro-state-propertize-doc - (format "%S: %s" ',name defdoc)))))))) + (apply ',msg-func + (list (spacemacs//micro-state-propertize-doc + (format "%S: %s" ',name defdoc))))))))) (wrapper-func (eval `(defun ,wrapper-name () "Auto-generated function" @@ -148,7 +157,8 @@ used." (let ((throwp t)) (catch 'exit (when ',wrapped - (call-interactively ',wrapped)) + (call-interactively ',wrapped) + (setq last-command ',wrapped)) (setq throwp nil)) ,@binding-post (when throwp (throw 'exit nil))) @@ -179,7 +189,7 @@ micro-state." (defun spacemacs//get-current-wrapper (name wrappers) "Return the wrapper being executed. -Returns nil if no wrapper is being executed (i.e. an unbound key has been +Return nil if no wrapper is being executed (i.e. an unbound key has been pressed)." (let ((micro-state-fun (spacemacs//micro-state-func-name name))) (catch 'found @@ -199,18 +209,18 @@ pressed)." (pheader (when header (propertize (concat " " header " ") 'face 'spacemacs-micro-state-header-face))) - (tail (spacemacs//micro-state-propertize-doc-1 + (tail (spacemacs//micro-state-propertize-doc-rec (match-string 2 doc)))) (concat pheader tail)))) -(defun spacemacs//micro-state-propertize-doc-1 (doc) +(defun spacemacs//micro-state-propertize-doc-rec (doc) "Recursively propertize keys" (if (string-match "^\\([[:ascii:]]*?\\)\\(\\[.+?\\]\\)\\([[:ascii:]]*\\)$" doc) (let* ((head (match-string 1 doc)) (key (match-string 2 doc)) (pkey (when key (propertize key 'face 'spacemacs-micro-state-binding-face))) - (tail (spacemacs//micro-state-propertize-doc-1 + (tail (spacemacs//micro-state-propertize-doc-rec (match-string 3 doc)))) (concat head pkey tail)) doc)) diff --git a/core/core-spacemacs-buffer.el b/core/core-spacemacs-buffer.el index e71357cf0911..88ffa49d9dfe 100644 --- a/core/core-spacemacs-buffer.el +++ b/core/core-spacemacs-buffer.el @@ -17,24 +17,43 @@ Doge special banner can be reachable via `999', `doge' or `random*'. `random' ignore special banners whereas `random*' does not." - (let ((banner (cond - ((eq 'random dotspacemacs-startup-banner) - (spacemacs//choose-random-banner)) - ((eq 'random* dotspacemacs-startup-banner) - (spacemacs//choose-random-banner t)) - ((eq 'doge dotspacemacs-startup-banner) - (spacemacs//get-banner-path 999)) - ((integerp dotspacemacs-startup-banner) - (spacemacs//get-banner-path dotspacemacs-startup-banner)))) + (let ((banner (spacemacs//choose-banner)) (buffer-read-only nil)) (when banner (spacemacs/message (format "Banner: %s" banner)) - (insert-file-contents banner) - (spacemacs//inject-version-in-buffer) - (spacemacs/insert-buttons) - (spacemacs//redisplay)))) + (if (string-match "\\.png\\'" banner) + (progn + (insert " ") + (insert-image (create-image banner)) + (insert (format "%s" spacemacs-version)) + (insert "\n")) + (progn + (insert-file-contents banner) + (spacemacs//inject-version-in-buffer))) + (spacemacs/insert-buttons) + (spacemacs//redisplay)))) + +(defun spacemacs//choose-banner () + "Return the full path of a banner based on the dotfile value." + (cond + ((eq 'random dotspacemacs-startup-banner) + (spacemacs//choose-random-text-banner)) + ((eq 'random* dotspacemacs-startup-banner) + (spacemacs//choose-random-text-banner t)) + ((eq 'doge dotspacemacs-startup-banner) + (spacemacs//get-banner-path 999)) + ((integerp dotspacemacs-startup-banner) + (spacemacs//get-banner-path dotspacemacs-startup-banner)) + ((string-match "\\.png\\'" dotspacemacs-startup-banner) + (if (image-type-available-p 'png) + (if (file-exists-p dotspacemacs-startup-banner) + dotspacemacs-startup-banner + (spacemacs/message (format "Warning: could not find banner %s" + dotspacemacs-startup-banner)) + (spacemacs//get-banner-path 1)) + (spacemacs//get-banner-path 1))))) -(defun spacemacs//choose-random-banner (&optional all) +(defun spacemacs//choose-random-text-banner (&optional all) "Return the full path of a banner chosen randomly. If ALL is non-nil then truly all banners can be selected." diff --git a/core/templates/.spacemacs.template b/core/templates/.spacemacs.template index e43efad2f33f..8987a823dadc 100644 --- a/core/templates/.spacemacs.template +++ b/core/templates/.spacemacs.template @@ -26,9 +26,10 @@ before layers configuration." ;; spacemacs settings. (setq-default ;; Specify the startup banner. If the value is an integer then the - ;; banner with the corresponding index is used, if the value is `random' - ;; then the banner is chosen randomly among the available banners, if - ;; the value is nil then no banner is displayed. + ;; text banner with the corresponding index is used, if the value is + ;; `random' then the banner is chosen randomly among the available banners, + ;; if the value is a string then it must be a path to a .PNG file, + ;; if the value is nil then no banner is displayed. dotspacemacs-startup-banner 'random ;; List of themes, the first of the list is loaded when spacemacs starts. ;; Press T n to cycle to the next theme in the list (works great @@ -50,7 +51,7 @@ before layers configuration." ;; The leader key dotspacemacs-leader-key "SPC" ;; Major mode leader key is a shortcut key which is the equivalent of - ;; pressing ` m` + ;; pressing ` m`. Set it to `nil` to disable it. dotspacemacs-major-mode-leader-key "," ;; The command key used for Evil commands (ex-commands) and ;; Emacs commands (M-x). diff --git a/doc/DOCUMENTATION.md b/doc/DOCUMENTATION.md index 809286645318..4d5d8426cdc2 100644 --- a/doc/DOCUMENTATION.md +++ b/doc/DOCUMENTATION.md @@ -31,7 +31,7 @@ - [Using a personal branch](#using-a-personal-branch) - [Dotfile Configuration](#dotfile-configuration) - [Installation](#installation) - - [Synchronization of doftile changes](#synchronization-of-doftile-changes) + - [Synchronization of dotfile changes](#synchronization-of-dotfile-changes) - [Content](#content) - [Using configuration layers](#using-configuration-layers) - [Setting configuration layers variables](#setting-configuration-layers-variables) @@ -103,6 +103,7 @@ - [Listing symbols by semantic](#listing-symbols-by-semantic) - [Helm-swoop](#helm-swoop) - [Editing](#editing) + - [Paste text](#paste-text) - [Text manipulation commands](#text-manipulation-commands) - [Smartparens Strict mode](#smartparens-strict-mode) - [Zooming](#zooming) @@ -128,7 +129,7 @@ - [Lisp Key Bindings](#lisp-key-bindings) - [Lisp state key bindings](#lisp-state-key-bindings) - [Emacs lisp specific key bindings](#emacs-lisp-specific-key-bindings) - - [Managing projects](#managing-projects) + - [Managing projects](#managing-projects) - [Registers](#registers) - [Errors handling](#errors-handling) - [Compiling](#compiling) @@ -212,7 +213,7 @@ dotfile. It is even possible to exclude _any_ unwanted packages. **keep your fingers on the home row** as much as possible, no matter the mode you are in. -- **Crowed-configured**: Contribute easily your improvements and new +- **Crowd-configured**: Contribute easily your improvements and new configuration layers. - **Minimalistic and nice graphical UI**, keep your available screen space for @@ -450,7 +451,7 @@ manually from the template file `~/.emacs.d/core/templates/.spacemacs.template` $ cp ~/.emacs.d/core/templates/.spacemacs.template ~/.spacemacs ``` -## Synchronization of doftile changes +## Synchronization of dotfile changes To apply the modifications made in `~/.spacemacs` press SPC m c c. It will re-execute the `Spacemacs` initialization process. @@ -912,6 +913,7 @@ display ASCII characters instead (may be useful in terminal). `Ⓒ` | C | [centered-cursor][centered-cursor] mode `Ⓔ` | E | [evil-org][evil-org-mode] mode `Ⓕ` | F | flycheck mode +`ⓕ` | f | auto-fill mode `Ⓚ` | K | guide-key mode `Ⓘ` | I | aggressive indent mode `(Ⓟ)` | (P) | paredit mode @@ -961,6 +963,9 @@ to `jj` (it is important set the variable in `dotspacemacs/init`): sequences are not optimal for `Spacemacs`. Indeed it is very easy in `visual state` to press quickly `jj` and inadvertently escape to `normal state`. +**Important Note** One caveat of `evil-escape` is that you must not use it +while recording macros. Use `escape` key instead. + ### Executing Vim and Emacs ex/M-x commands Command | Key Binding @@ -1191,7 +1196,7 @@ Key Binding | Description ------------------------------------------|---------------------------------------------------------------- SPC w b | force the focus back to the minibuffer (usefull with `helm` popups) SPC w c | close a window -SPC w C | close other windows +SPC w C | delete another window using [ace-delete-window][ace-window] SPC w d | toggle window dedication (dedicated window cannot be reused by a mode) SPC w h | move to window on the left SPC w H | move window to the left @@ -1201,7 +1206,7 @@ Key Binding | Description SPC w K | move window to the top SPC w l | move to window on the right SPC w L | move window to the right -SPC w m | maximize/minimize a window +SPC w m | maximize/minimize a window (maximize is equivalent to delete otehr windows) SPC w M | maximize/minimize a window, when maximized the buffer is centered SPC w o | cycle and focus between frames SPC w p m | open messages buffer in a popup window @@ -1214,6 +1219,7 @@ Key Binding | Description SPC w v or SPC w - | vertical split SPC w V | vertical split and focus new window SPC w w | cycle and focus between windows +SPC w W | select window using [ace-window][ace-window] #### Window manipulation micro-state @@ -1296,6 +1302,7 @@ Key Binding | Description SPC b m j | move a buffer to the bottom SPC b m k | move a buffer to the top SPC b m l | move a buffer to the right +SPC b M | swap windows using [ace-swap-window][ace-window] SPC b n | switch to next buffer SPC b p | switch to previous buffer SPC b r | rename the current buffer @@ -1644,6 +1651,23 @@ Key Binding | Description ## Editing +### Paste text + +Whenever you paste some text a `paste` micro-state is initiated. Pressing +p again will replace the pasted text with the previous +yanked (copied) text on the kill ring. + +For example if you copy `foo` and `bar` then press p the text `bar` +will be pasted, pressing p again will replace `bar` with `foo`. + +Key Binding | Description +------------------------------|---------------------------------------------------------------- +p or P | paste the text before or after point and initiate the `paste` micro-state +p | in micro-state: replace paste text with the previously copied one +P | in micro-state: replace paste text with the next copied one +. | paste the same text and leave the micro-state +Any other key | leave the micro-state + ### Text manipulation commands Text related commands (start with `x`): @@ -2015,7 +2039,7 @@ Key Binding | Function SPC m t b | execute buffer tests SPC m t q | ask for test function to execute -### Managing projects +## Managing projects Projects in `Spacemacs` are managed with [projectile][projectile]. In `projectile` projects are defined implicitly, for instance the root of a @@ -2294,6 +2318,7 @@ developers to elisp hackers! [keychords]: http://www.emacswiki.org/emacs/KeyChord [centered-cursor]: http://www.emacswiki.org/emacs/centered-cursor-mode.el [ace-jump]: https://github.com/winterTTr/ace-jump-mode +[ace-window]: https://github.com/abo-abo/ace-window [helm-link]: https://github.com/emacs-helm/helm [helm-doc]: https://github.com/emacs-helm/helm/wiki [popwin]: http://www.emacswiki.org/emacs/PopWin diff --git a/init.el b/init.el index 770a867c8565..94d226315de8 100644 --- a/init.el +++ b/init.el @@ -9,7 +9,7 @@ ;; This file is not part of GNU Emacs. ;; ;;; License: GPLv3 -(defconst spacemacs-version "0.64.2" "Spacemacs version.") +(defconst spacemacs-version "0.65.0" "Spacemacs version.") (defconst spacemacs-emacs-min-version "24.3" "Minimal version of Emacs.") (defun spacemacs/emacs-version-ok () diff --git a/spacemacs/config.el b/spacemacs/config.el index a849bc200d15..dd52d7518e76 100644 --- a/spacemacs/config.el +++ b/spacemacs/config.el @@ -132,6 +132,10 @@ Can be installed with `brew install trash'." ;; regular move to trash directory (setq trash-directory "~/.Trash/emacs"))) +;; auto fill breaks line beyond current-fill-column +(setq-default default-fill-column 78) +(spacemacs|diminish auto-fill-function " ⓕ" " f") + ;; --------------------------------------------------------------------------- ;; UI ;; --------------------------------------------------------------------------- diff --git a/spacemacs/keybindings.el b/spacemacs/keybindings.el index 9a82c4b9aafd..2143c167b0af 100644 --- a/spacemacs/keybindings.el +++ b/spacemacs/keybindings.el @@ -180,6 +180,17 @@ :on (toggle-transparency) :documentation "Make the current frame non-opaque." :evil-leader "tt") +(spacemacs|add-toggle auto-fill-mode + :status auto-fill-function + :on (auto-fill-mode) + :off (auto-fill-mode -1) + :documentation "Break line beyond `current-fill-column` while editing." + :evil-leader "t C-f") +(spacemacs|add-toggle debug-on-error + :status nil + :on (toggle-debug-on-error) + :documentation "Toggle display of backtrace when an error happens." + :evil-leader "t D") (spacemacs|add-toggle tool-bar :if window-system :status tool-bar-mode @@ -229,7 +240,7 @@ "w2" 'layout-double-columns "w3" 'layout-triple-columns "wb" 'switch-to-minibuffer-window - "wC" 'delete-other-windows + "wc" 'delete-window "wd" 'toggle-current-window-dedication "wH" 'evil-window-move-far-left "wh" 'evil-window-left @@ -239,6 +250,7 @@ "wk" 'evil-window-up "wL" 'evil-window-move-far-right "wl" 'evil-window-right + "wm" 'toggle-maximize-buffer "wM" 'toggle-maximize-centered-buffer "wo" 'other-frame "wR" 'rotate-windows @@ -249,12 +261,8 @@ "wu" 'winner-undo "wv" 'split-window-right "wV" 'split-window-right-and-focus + "ww" 'other-window "w/" 'split-window-right) -(unless (configuration-layer/package-declaredp 'ace-window) - (evil-leader/set-key - "wc" 'delete-window - "wm" 'toggle-maximize-buffer - "ww" 'other-window)) ;; text ----------------------------------------------------------------------- (evil-leader/set-key "zx=" 'spacemacs/reset-font-size diff --git a/spacemacs/packages.el b/spacemacs/packages.el index 5536e7f811e6..80311543a2c3 100644 --- a/spacemacs/packages.el +++ b/spacemacs/packages.el @@ -14,6 +14,7 @@ '( ac-ispell ace-jump-mode + ace-window ag aggressive-indent async @@ -161,6 +162,27 @@ which require an initialization must be listed explicitly in the list.") (setq ace-jump-mode-scope 'global) (evil-leader/set-key "`" 'ace-jump-mode-pop-mark)))) +(defun spacemacs/init-ace-window () + (use-package ace-window + :defer t + :init + (evil-leader/set-key + "bM" 'ace-swap-window + "wC" 'ace-delete-window + "wW" 'ace-window) + :config + (progn + ;; add support for golden-ratio + (eval-after-load 'golden-ratio + '(setq golden-ratio-extra-commands + (append golden-ratio-extra-commands + '(ace-window + ace-delete-window + ace-select-window + ace-swap-window + ace-maximize-window + ))))))) + (defun spacemacs/init-aggressive-indent () (use-package aggressive-indent :defer t @@ -647,6 +669,28 @@ which require an initialization must be listed explicitly in the list.") ("<" spacemacs/scroll-half-page-up) (">" spacemacs/scroll-half-page-down)) + ;; pasting micro-state + (defadvice evil-paste-before (after spacemacs/evil-paste-before activate) + "Initate the paste micro-state after the execution of evil-paste-before" + (spacemacs/paste-micro-state)) + (defadvice evil-paste-after (after spacemacs/evil-paste-after activate) + "Initate the paste micro-state after the execution of evil-paste-after" + (spacemacs/paste-micro-state)) + (defadvice evil-visual-paste (after spacemacs/evil-visual-paste activate) + "Initate the paste micro-state after the execution of evil-visual-paste" + (spacemacs/paste-micro-state)) + (defun spacemacs//paste-ms-doc () + "The documentation for the paste micro-state." + (format (concat "[%s/%s] Type [p] or [P] to paste the previous or " + "next copied text, [.] to paste the same text") + (length kill-ring-yank-pointer) (length kill-ring))) + (spacemacs|define-micro-state paste + :doc (spacemacs//paste-ms-doc) + :use-minibuffer t + :bindings + ("p" evil-paste-pop) + ("P" evil-paste-pop-next)) + ;; define text objects (defmacro spacemacs|define-and-bind-text-object (key name start-regex end-regex) (let ((inner-name (make-symbol (concat "evil-inner-" name))) @@ -1499,8 +1543,8 @@ which require an initialization must be listed explicitly in the list.") "hgc" 'hl-unhighlight-all-global "hgh" 'hl-highlight-thingatpt-global "hh" 'hl-highlight-thingatpt-local - "hn" 'hl-find-thing-forwardly - "hN" 'hl-find-thing-backwardly + "hn" 'hl-find-next-thing + "hN" 'hl-find-prev-thing "hp" 'hl-paren-mode "hr" 'hl-restore-highlights "hs" 'hl-save-highlights))