diff --git a/CHANGELOG.next b/CHANGELOG.next index 2091a63f6d29e..d456294c18c25 100644 --- a/CHANGELOG.next +++ b/CHANGELOG.next @@ -110,7 +110,7 @@ This file containes the change log for the next major version of Spacemacs. location in the line) - ~SPC j $~ to go to the end of line (and set a mark at the previous location in the line) - - ~SPC j b~ to jump to a bookmark + - ~SPC j b~ to undo a jump (go back to previous location) - ~SPC j d~ to jump to a listing of the current directory - ~SPC j D~ to jump to a listing of the current directory (other window) - ~SPC j f~ to jump to the definition of the function around point @@ -123,8 +123,7 @@ This file containes the change log for the next major version of Spacemacs. - ~SPC j n~ to split the current line at point, insert a new line and auto-indent - ~SPC j s~ to split a quoted string or s-expression in place - ~SPC j S~ to split a quoted string or s-expression, insert a new line and auto-indent - - ~SPC j u~ to undo a jump (go back to previous location) - - ~SPC j U~ to jump to a URL in the current buffer + - ~SPC j u~ to jump to a URL in the current buffer - ~SPC j v~ to jump to the definition/declaration of the variable around point - ~SPC j w~ to jump to a word in the current buffer (works as an evil motion) (thanks to justbur) diff --git a/CONTRIBUTING.org b/CONTRIBUTING.org index 56a23efb81349..c0a0929fbe0ee 100644 --- a/CONTRIBUTING.org +++ b/CONTRIBUTING.org @@ -154,6 +154,10 @@ Contributed configuration layers are stored in the =layers/= folder. The =layers/= folder also contains categories prefixed with =+= to put your layers in. For example a layer for a language would go in the =layers/+lang/= folder. +Layer with no associated configuration will be rejected. For instance a layer +with just a package and a hook can be easily replace by the usage of the +variable =dotspacemacs-additional-packages=. + *** File header The file header for =elisp= files should look like the following template: diff --git a/README.md b/README.md index c8b28e4a97a46..9d530650a36c7 100644 --- a/README.md +++ b/README.md @@ -3,21 +3,19 @@ ***

Spacemacs

-philosophy +philosophy | -goals +for whom? | -for whom? +screenshots | -screenshots -| -documentation +documentation | contribute | -achievements +achievements | -FAQ +FAQ

***

@@ -134,8 +132,9 @@ XEmacs is an old fork of Emacs. The X in its name is unrelated to X11. Both Emacs and XEmacs have graphical support. **Note:** Ubuntu LTS 12.04 and 14.04 repositories have only Emacs 24.3 -available. You are advised to [build from source](https://www.gnu.org/software/emacs/manual/html_node/efaq/Installing-Emacs.html) Emacs 24.4 or greater, as most packages require -this version. The same may be true for other distributions as well. +available. You are advised to [build from source][build_source] Emacs 24.4 or +greater, as most packages require this version. The same may be true for other +distributions as well. ### OS X @@ -227,8 +226,7 @@ For efficient searches we recommend to install `pt` ([the platinum searcher][]). 4. Restart Emacs to complete the installation. -If the mode-line turns red then be sure to visit the -[troubleshooting][troubleshoot] guide and consult the [FAQ][FAQ.org]. +If the mode-line turns red then be sure to consult the [FAQ][FAQ.org]. ## Installation alongside another configuration @@ -372,14 +370,13 @@ Thank you! [Twitter]: http://i.imgur.com/tXSoThF.png [CONTRIBUTING.org]: CONTRIBUTING.org -[CONVENTIONS.org]: doc/CONVENTIONS.org -[DOCUMENTATION.org]: doc/DOCUMENTATION.org -[QUICK_START.org]: doc/QUICK_START.org -[FAQ.org]: doc/FAQ.org -[VIMUSERS.org]: doc/VIMUSERS.org -[dotfile]: doc/DOCUMENTATION.org#dotfile-configuration -[troubleshoot]: doc/DOCUMENTATION.org#troubleshoot -[osx layer]: layers/osx/README.org +[CONVENTIONS.org]: http://spacemacs.org/doc/CONVENTIONS +[DOCUMENTATION.org]: http://spacemacs.org/doc/DOCUMENTATION +[QUICK_START.org]: http://spacemacs.org/doc/QUICK_START +[FAQ.org]: http://spacemacs.org/doc/FAQ +[VIMUSERS.org]: http://spacemacs.org/doc/VIMUSERS +[dotfile]: http://spacemacs.org/doc/DOCUMENTATION#orgheadline45 +[osx layer]: http://spacemacs.org/layers/osx/README [Gitter Chat]: https://gitter.im/syl20bnr/spacemacs [Gitter Chat IRC server]: https://irc.gitter.im/ [emacs-mac-port]: https://github.com/railwaycat/homebrew-emacsmacport @@ -395,4 +392,5 @@ Thank you! [Stack Exchange]: http://emacs.stackexchange.com/questions/tagged/spacemacs [Reddit]: https://www.reddit.com/r/spacemacs [quote01]: https://gitter.im/syl20bnr/spacemacs?at=568e627a0cdaaa62045a7df6 +[build_source]: https://www.gnu.org/software/emacs/manual/html_node/efaq/Installing-Emacs.html [Bountysource]: https://salt.bountysource.com/teams/spacemacs diff --git a/core/core-configuration-layer.el b/core/core-configuration-layer.el index 8a29527fa6b94..a21e7ca35b71e 100644 --- a/core/core-configuration-layer.el +++ b/core/core-configuration-layer.el @@ -8,10 +8,6 @@ ;; This file is not part of GNU Emacs. ;; ;;; License: GPLv3 -;; -;;; Commentary: -;; -;;; Code: (require 'cl-lib) (require 'eieio) @@ -281,26 +277,40 @@ refreshed during the current session." (package-read-all-archive-contents) (unless quiet (spacemacs-buffer/append "\n"))))) -(defun configuration-layer/sync () - "Synchronize declared layers in dotfile with spacemacs." +(defun configuration-layer/sync (&optional no-install) + "Synchronize declared layers in dotfile with spacemacs. +If NO-INSTALL is non nil then install steps are skipped." (dotspacemacs|call-func dotspacemacs/layers "Calling dotfile layers...") (when (spacemacs-buffer//choose-banner) (spacemacs-buffer//inject-version t)) ;; layers (setq configuration-layer--layers (configuration-layer//declare-layers)) (configuration-layer//configure-layers configuration-layer--layers) + (when dotspacemacs-enable-lazy-installation + (configuration-layer/load-auto-layer-file)) ;; packages (setq configuration-layer--packages (configuration-layer//declare-packages configuration-layer--layers)) (setq configuration-layer--used-distant-packages (configuration-layer//get-distant-used-packages configuration-layer--packages)) - (configuration-layer//install-packages - (configuration-layer/filter-objects configuration-layer--used-distant-packages - (lambda (x) (not (oref x :lazy-install))))) - (configuration-layer//configure-packages configuration-layer--packages) - (when dotspacemacs-delete-orphan-packages - (configuration-layer/delete-orphan-packages configuration-layer--packages))) + (unless no-install + (configuration-layer//install-packages + (configuration-layer/filter-objects + configuration-layer--used-distant-packages + (lambda (x) + (not (oref x :lazy-install))))) + (configuration-layer//configure-packages configuration-layer--packages) + (when dotspacemacs-delete-orphan-packages + (configuration-layer/delete-orphan-packages + configuration-layer--packages)))) + +(defun configuration-layer/load-auto-layer-file () + "Load `auto-layer.el' file" + (let ((file (concat configuration-layer-directory "auto-layer.el"))) + (when (file-exists-p file) + (spacemacs-buffer/message "Loading auto-layer file...") + (load-file file)))) (defun configuration-layer/create-layer () "Ask the user for a configuration layer name and the layer @@ -369,17 +379,18 @@ layer directory." "Make `cfgl-layer' objects from the passed layer SYMBOLS." (delq nil (mapcar 'configuration-layer/make-layer symbols))) -(defun configuration-layer/make-package (pkg &optional obj) +(defun configuration-layer/make-package (pkg &optional obj togglep) "Return a `cfgl-package' object based on PKG. If OBJ is non nil then copy PKG properties into OBJ, otherwise create a new object. -Properties that can be copied are `:location', `:step' and `:excluded'." +Properties that can be copied are `:location', `:step' and `:excluded'. +If TOGGLEP is non nil then `:toggle' parameter is ignored." (let* ((name-sym (if (listp pkg) (car pkg) pkg)) (name-str (symbol-name name-sym)) (location (when (listp pkg) (plist-get (cdr pkg) :location))) (step (when (listp pkg) (plist-get (cdr pkg) :step))) (excluded (when (listp pkg) (plist-get (cdr pkg) :excluded))) - (toggle (when (listp pkg) (plist-get (cdr pkg) :toggle))) + (toggle (when (and togglep (listp pkg)) (plist-get (cdr pkg) :toggle))) (protected (when (listp pkg) (plist-get (cdr pkg) :protected))) (copyp (not (null obj))) (obj (if obj obj (cfgl-package name-str :name name-sym)))) @@ -602,14 +613,15 @@ Properties that can be copied are `:location', `:step' and `:excluded'." name pkg-name))) (post-init-func (intern (format "%S/post-init-%S" name pkg-name))) + (ownerp (fboundp init-func)) (obj (object-assoc pkg-name :name result))) (cl-pushnew pkg-name (oref layer :packages)) (if obj - (setq obj (configuration-layer/make-package pkg obj)) - (setq obj (configuration-layer/make-package pkg)) + (setq obj (configuration-layer/make-package pkg obj ownerp)) + (setq obj (configuration-layer/make-package pkg nil ownerp)) (push obj result)) (oset obj :lazy-install lazy-install) - (when (fboundp init-func) + (when ownerp ;; last owner wins over the previous one, ;; still warn about mutliple owners (when (oref obj :owner) @@ -617,8 +629,14 @@ Properties that can be copied are `:location', `:step' and `:excluded'." (format (concat "More than one init function found for " "package %S. Previous owner was %S, " "replacing it with layer %S.") - pkg (oref obj :owner) name))) + pkg-name (oref obj :owner) name))) (oset obj :owner name)) + (when (and (not ownerp) + (listp pkg) + (spacemacs/mplist-get pkg :toggle)) + (spacemacs-buffer/warning + (format (concat "Ignoring :toggle for package %s because " + "layer %S does not own it.") pkg-name name))) (when (fboundp pre-init-func) (push name (oref obj :pre-layers))) (when (fboundp post-init-func) @@ -629,8 +647,8 @@ Properties that can be copied are `:location', `:step' and `:excluded'." (let* ((pkg-name (if (listp pkg) (car pkg) pkg)) (obj (object-assoc pkg-name :name result))) (if obj - (setq obj (configuration-layer/make-package pkg obj)) - (setq obj (configuration-layer/make-package pkg)) + (setq obj (configuration-layer/make-package pkg obj t)) + (setq obj (configuration-layer/make-package pkg nil t)) (push obj result) (oset obj :owner 'dotfile)))) (dolist (xpkg dotspacemacs-excluded-packages) @@ -649,23 +667,24 @@ Properties that can be copied are `:location', `:step' and `:excluded'." (defun configuration-layer/lazy-install (layer-name &rest props) "Configure auto-installation of layer with name LAYER-NAME." (declare (indent 1)) - (when dotspacemacs-enable-lazy-installation - (let ((layer (object-assoc layer-name :name configuration-layer--layers)) - (extensions (spacemacs/mplist-get props :extensions))) - (oset layer :lazy-install t) - (dolist (x extensions) - (let ((ext (car x)) - (mode (cadr x))) - (add-to-list 'configuration-layer--lazy-mode-alist (cons mode ext)) - (add-to-list - 'auto-mode-alist - `(,ext . (lambda () - (configuration-layer//auto-mode - ',layer-name ',mode))))))))) + (let ((extensions (spacemacs/mplist-get props :extensions))) + (when (configuration-layer/layer-usedp layer-name) + (let ((layer (object-assoc layer-name + :name configuration-layer--layers))) + (oset layer :lazy-install t))) + (dolist (x extensions) + (let ((ext (car x)) + (mode (cadr x))) + (add-to-list 'configuration-layer--lazy-mode-alist (cons mode ext)) + (add-to-list + 'auto-mode-alist + `(,ext . (lambda () + (configuration-layer//auto-mode + ',layer-name ',mode)))))))) (defun configuration-layer//auto-mode (layer-name mode) "Auto mode support of lazily installed layers." - (when (configuration-layer//lazy-install-packages layer-name) + (when (configuration-layer//lazy-install-packages layer-name mode) (funcall mode))) (defun configuration-layer/filter-objects (objects ffunc) @@ -951,24 +970,32 @@ path." (format (concat "\nAn error occurred while installing %s " "(error: %s)\n") pkg-name err))))))) -(defun configuration-layer//lazy-install-packages (layer-name) - "Install packages of a lazily installed layer. +(defun configuration-layer//lazy-install-p (layer-name) + "Return non nil if the layer with LAYER-NAME should be lazy installed." + (or (not (memq layer-name configuration-layer--layers)) + (let ((layer (object-assoc layer-name :name configuration-layer--layers))) + (oref layer :lazy-install)))) + +(defun configuration-layer//lazy-install-packages (layer-name mode) + "Install layer with LAYER-NAME to support MODE. Returns non-nil if the packages have been installed." - (let* ((layer (object-assoc layer-name :name configuration-layer--layers)) - (packages (delq nil (mapcar (lambda (x) - (object-assoc - x :name configuration-layer--packages)) - (oref layer :packages)))) - (pkg-count (length packages))) - (when (and (oref layer :lazy-install) - (yes-or-no-p (format - (concat "Support for %s requires installation of " - "%s package(s), do you want to install?") - layer-name pkg-count))) + (when (and (configuration-layer//lazy-install-p layer-name) + (yes-or-no-p (format + (concat "Support for %s requires installation of " + "layer %s, do you want to install it?") + mode layer-name))) + (when (dotspacemacs/add-layer layer-name) + (configuration-layer/sync 'no-install)) + (let* ((layer (object-assoc layer-name :name configuration-layer--layers)) + (packages (delq nil + (mapcar (lambda (x) + (object-assoc + x :name configuration-layer--packages)) + (oref layer :packages))))) (configuration-layer//install-packages packages) (configuration-layer//configure-packages packages) (oset layer :lazy-install nil)) - (not (oref layer :lazy-install)))) + t)) (defun configuration-layer//install-packages (packages) "Install PACKAGES which are not lazy installed." @@ -1566,28 +1593,32 @@ to select one." (when ext (push (cons mode ext) result))))) result)) -(defun configuration-layer//insert-lazy-install-form (mode ext) +(defun configuration-layer//insert-lazy-install-form (layer-name mode ext) "Insert a configuration form for lazy installation of MODE." (let ((str (concat "(configuration-layer/lazy-install '" - (symbol-name mode) + (symbol-name layer-name) " :extensions '(" (let ((print-quoted t)) (prin1-to-string ext)) + " " + (symbol-name mode) "))\n"))) (insert str))) (defun configuration-layer/insert-lazy-install-configuration () "Prompt for a layer and insert the forms to configure lazy installation." (interactive) - (let ((layer-sym - (completing-read - "Choose a used layer" - (sort (object-assoc-list :name configuration-layer--layers) - (lambda (x y) - (string< (oref (cdr x) :name) (oref (cdr y) :name))))))) + (let ((layer-name + (intern (completing-read + "Choose a used layer" + (sort (object-assoc-list :name configuration-layer--layers) + (lambda (x y) + (string< (oref (cdr x) :name) + (oref (cdr y) :name)))))))) (let ((mode-exts (configuration-layer//lazy-install-extensions-for-layer - (intern layer-sym)))) + layer-name))) (dolist (x mode-exts) - (configuration-layer//insert-lazy-install-form (car x) (cdr x)))))) + (configuration-layer//insert-lazy-install-form + layer-name (car x) (cdr x)))))) (defun configuration-layer//increment-error-count () "Increment the error counter." diff --git a/core/core-documentation.el b/core/core-documentation.el index 9f8cea37b8dba..5057d06067fd6 100644 --- a/core/core-documentation.el +++ b/core/core-documentation.el @@ -20,8 +20,10 @@ (defvar spacemacs--category-names '(("config-files" . "Configuration files") ("email" . "E-mail") - ("irc" . "IRC") - ("lang" . "Programming and markup languages")) + ("intl" . "International support") + ("lang" . "Programming and markup languages") + ("os" . "Operating systems") + ("spacemacs" . "Spacemacs distribution layers")) "Special names for categories. Used to generate the layers list.") (defun spacemacs//generate-layers-from-path (path level) diff --git a/core/core-dotspacemacs.el b/core/core-dotspacemacs.el index a95c3a4e13066..9e5a3cd17eb48 100644 --- a/core/core-dotspacemacs.el +++ b/core/core-dotspacemacs.el @@ -65,7 +65,7 @@ environment, otherwise it is strongly recommended to let it set to t.") "List of additional paths where to look for configuration layers. Paths must have a trailing slash (ie. `~/.mycontribs/')") -(defvar dotspacemacs-enable-lazy-installation nil +(defvar dotspacemacs-enable-lazy-installation t "If non-nil layers with lazy install support are lazy installed.") (defvar dotspacemacs-additional-packages '() @@ -75,10 +75,11 @@ packages then consider to create a layer, you can also put the configuration in `dotspacemacs/user-config'.") (defvar dotspacemacs-editing-style 'vim - "One of `vim', `emacs' or `hybrid'. Evil is always enabled but if the -variable is `emacs' then the `holy-mode' is enabled at startup. `hybrid' -uses emacs key bindings for vim's insert mode, but otherwise leaves evil -unchanged.") + "One of `vim', `emacs' or `hybrid'. +`hybrid' is like `vim' except that `insert state' is replaced by the +`hybrid state' with `emacs' key bindings. The value can also be a list + with `:variables' keyword (similar to layers). Check the editing styles + section of the documentation for details on available variables.") (defvar dotspacemacs-startup-banner 'official "Specify the startup banner. Default value is `official', it displays @@ -309,6 +310,45 @@ are caught and signalled to user in spacemacs buffer." (error-message-string err)) t)))))) +(defun dotspacemacs//read-editing-style-config (config) + "Read editing style CONFIG: apply variables and return the editing style. +CONFIG can be the symbol of an editing style or a list where the car is +the symbol of an editing style and the cdr is a list of keyword arguments like +`:variables'." + (cond + ((symbolp config) config) + ((listp config) + (let ((variables (spacemacs/mplist-get config :variables))) + (while variables + (let ((var (pop variables))) + (if (consp variables) + (condition-case-unless-debug err + (set-default var (eval (pop variables))) + ('error + (spacemacs-buffer/append + (format (concat "\nAn error occurred while reading the " + "editing style variable %s " + "(error: %s). Be sure to quote the value " + "if needed.\n") var err)))) + (spacemacs-buffer/warning "Missing value for variable %s !" + var))))) + (car config)))) + +(defun dotspacemacs/add-layer (layer-name) + "Add LAYER_NAME to dotfile and reload the it. +Returns non nil if the layer has been effectively inserted." + (unless (configuration-layer/layer-usedp layer-name) + (with-current-buffer (find-file-noselect (dotspacemacs/location)) + (beginning-of-buffer) + (let ((insert-point (re-search-forward + "dotspacemacs-configuration-layers *\n?.*\\((\\)"))) + (insert (format "\n%S" layer-name)) + (indent-region insert-point (+ insert-point + (length (symbol-name layer-name)))) + (save-buffer))) + (load-file (dotspacemacs/location)) + t)) + (defun dotspacemacs/sync-configuration-layers (&optional arg) "Synchronize declared layers in dotfile with spacemacs. @@ -326,6 +366,11 @@ Called with `C-u C-u' skips `dotspacemacs/user-config' _and_ preleminary tests." (load-file buffer-file-name) (dotspacemacs|call-func dotspacemacs/init "Calling dotfile init...") + (dotspacemacs|call-func dotspacemacs/user-init + "Calling dotfile user init...") + (setq dotspacemacs-editing-style + (dotspacemacs//read-editing-style-config + dotspacemacs-editing-style)) (configuration-layer/sync) (if (member arg '((4) (16))) (message (concat "Done (`dotspacemacs/user-config' " @@ -539,8 +584,11 @@ error recovery." (dotspacemacs||let-init-test (dotspacemacs/init) (spacemacs//test-var - (lambda (x) (member x '(vim emacs hybrid))) - 'dotspacemacs-editing-style "is \'vim, \'emacs or \'hybrid") + (lambda (x) (or (member x '(vim emacs hybrid)) + (and (listp x) + (spacemacs/mplist-get x :variables)))) + 'dotspacemacs-editing-style + "is \'vim, \'emacs or \'hybrid or and list with `:variable' keyword") (spacemacs//test-var (lambda (x) (member x '(original cache nil))) 'dotspacemacs-auto-save-file-location (concat "is one of \'original, " diff --git a/core/core-spacemacs.el b/core/core-spacemacs.el index 081dd9b5a8b89..f3c67efdefc33 100644 --- a/core/core-spacemacs.el +++ b/core/core-spacemacs.el @@ -76,6 +76,8 @@ (require 'core-configuration-layer) (dotspacemacs|call-func dotspacemacs/init "Calling dotfile init...") (dotspacemacs|call-func dotspacemacs/user-init "Calling dotfile user init...") + (setq dotspacemacs-editing-style (dotspacemacs//read-editing-style-config + dotspacemacs-editing-style)) (configuration-layer/initialize) ;; default theme (let ((default-theme (car dotspacemacs-themes))) diff --git a/core/templates/.spacemacs.template b/core/templates/.spacemacs.template index 50238676c5ae7..82fa3b05f26c6 100644 --- a/core/templates/.spacemacs.template +++ b/core/templates/.spacemacs.template @@ -12,8 +12,8 @@ values." ;; or `spacemacs'. (default 'spacemacs) dotspacemacs-distribution 'spacemacs ;; If non-nil layers with lazy install support are lazy installed. - ;; (default nil) - dotspacemacs-enable-lazy-installation nil + ;; (default t) + dotspacemacs-enable-lazy-installation t ;; List of additional paths where to look for configuration layers. ;; Paths must have a trailing slash (i.e. `~/.mycontribs/') dotspacemacs-configuration-layer-path '() @@ -73,10 +73,12 @@ values." ;; If non nil then spacemacs will check for updates at startup ;; when the current branch is not `develop'. (default t) dotspacemacs-check-for-update t - ;; One of `vim', `emacs' or `hybrid'. Evil is always enabled but if the - ;; variable is `emacs' then the `holy-mode' is enabled at startup. `hybrid' - ;; uses emacs key bindings for vim's insert mode, but otherwise leaves evil - ;; unchanged. (default 'vim) + ;; One of `vim', `emacs' or `hybrid'. + ;; `hybrid' is like `vim' except that `insert state' is replaced by the + ;; `hybrid state' with `emacs' key bindings. The value can also be a list + ;; with `:variables' keyword (similar to layers). Check the editing styles + ;; section of the documentation for details on available variables. + ;; (default 'vim) dotspacemacs-editing-style 'vim ;; If non nil output loading progress in `*Messages*' buffer. (default nil) dotspacemacs-verbose-loading nil diff --git a/core/templates/README.org.template b/core/templates/README.org.template index e209a327ee4ec..637fac06a702f 100644 --- a/core/templates/README.org.template +++ b/core/templates/README.org.template @@ -1,8 +1,6 @@ #+TITLE: %LAYER_NAME% layer #+HTML_HEAD_EXTRA: -#+CAPTION: logo - # The maximum height of the logo should be 200 pixels. [[img/%LAYER_NAME%.png]] @@ -16,11 +14,9 @@ This layer does wonderful things: - thing01 * Install -To use this contribution add it to your =~/.spacemacs= - -#+begin_src emacs-lisp - (setq-default dotspacemacs-configuration-layers '(%LAYER_NAME%)) -#+end_src +To use this configuration layer, add it to your =~/.spacemacs=. You will need to +add =%LAYER_NAME%= to the existing =dotspacemacs-configuration-layers= list in this +file. * Key bindings diff --git a/doc/DOCUMENTATION.org b/doc/DOCUMENTATION.org index ea6a83ae88919..b74ac4a9c8cde 100644 --- a/doc/DOCUMENTATION.org +++ b/doc/DOCUMENTATION.org @@ -12,20 +12,20 @@ - [[Who can benefit from this?][Who can benefit from this?]] - [[Update and Rollback][Update and Rollback]] - [[Update Spacemacs repository][Update Spacemacs repository]] - - [[Automatic Updates][Automatic Updates]] + - [[Automatic Updates][Automatic Updates]] - [[Updating from the Spacemacs Buffer][Updating from the Spacemacs Buffer]] - [[Updating Manually with git][Updating Manually with git]] - [[Update packages][Update packages]] - [[Configuration layers][Configuration layers]] - [[Purpose][Purpose]] - [[Structure][Structure]] - - [[Packages][Packages]] - - [[Within a layer][Within a layer]] + - [[Configure packages][Configure packages]] + - [[With a layer][With a layer]] - [[Declaration][Declaration]] - [[Initialization][Initialization]] - [[Exclusion][Exclusion]] - [[Without a layer][Without a layer]] - - [[Packages synchronization (Vundle like feature)][Packages synchronization (Vundle like feature)]] + - [[Packages synchronization][Packages synchronization]] - [[Types of configuration layers][Types of configuration layers]] - [[Submitting a configuration layer upstream][Submitting a configuration layer upstream]] - [[Example: Themes Megapack example][Example: Themes Megapack example]] @@ -35,38 +35,36 @@ - [[Using a personal branch][Using a personal branch]] - [[Tips for writing layers][Tips for writing layers]] - [[Dotfile Configuration][Dotfile Configuration]] - - [[Installation][Installation]] - - [[Alternative setup][Alternative setup]] + - [[Dotfile Installation][Dotfile Installation]] + - [[Alternative dotdirectory][Alternative dotdirectory]] - [[Synchronization of dotfile changes][Synchronization of dotfile changes]] - - [[Testing][Testing]] - - [[Content][Content]] + - [[Testing the dotfile][Testing the dotfile]] + - [[Dotfile Contents][Dotfile Contents]] - [[Using configuration layers][Using configuration layers]] - [[Setting configuration layers variables][Setting configuration layers variables]] - [[Excluding packages][Excluding packages]] - - [[Hooks][Hooks]] - - [[Binding keys][Binding keys]] + - [[Configuration functions][Configuration functions]] - [[Custom variables][Custom variables]] - - [[Main principles][Main principles]] + - [[Concepts][Concepts]] - [[Editing Styles][Editing Styles]] - [[Vim][Vim]] - [[Emacs][Emacs]] - [[Hybrid][Hybrid]] - - [[Evilified modes][Evilified modes]] - [[States][States]] + - [[Evilified modes][Evilified modes]] - [[Evil leader][Evil leader]] - [[Universal argument][Universal argument]] - [[Transient-states][Transient-states]] - [[Differences between Vim, Evil and Spacemacs][Differences between Vim, Evil and Spacemacs]] - [[The vim-surround case][The vim-surround case]] - [[Evil plugins][Evil plugins]] - - [[Spacemacs UI][Spacemacs UI]] - - [[Graphical UI][Graphical UI]] - - [[Color themes][Color themes]] - - [[Font][Font]] - - [[Graphical UI Toggles][Graphical UI Toggles]] + - [[Binding keys][Binding keys]] + - [[GUI Elements][GUI Elements]] + - [[Color themes][Color themes]] + - [[Font][Font]] + - [[GUI Toggles][GUI Toggles]] - [[Global line numbers][Global line numbers]] - - [[Mouse usage][Mouse usage]] - - [[Mode-line][Mode-line]] + - [[Mode-line][Mode-line]] - [[Powerline font installation for terminal-mode users][Powerline font installation for terminal-mode users]] - [[Flycheck integration][Flycheck integration]] - [[Anzu integration][Anzu integration]] @@ -74,6 +72,15 @@ - [[Powerline separators][Powerline separators]] - [[Minor Modes][Minor Modes]] - [[Customizing the mode-line][Customizing the mode-line]] + - [[Layouts and workspaces][Layouts and workspaces]] + - [[Layouts][Layouts]] + - [[The default layout][The default layout]] + - [[Project layouts][Project layouts]] + - [[Custom Layouts][Custom Layouts]] + - [[Save/Load layouts into a file][Save/Load layouts into a file]] + - [[Layout key bindings][Layout key bindings]] + - [[Workspaces][Workspaces]] + - [[Workspace key bindings][Workspace key bindings]] - [[Commands][Commands]] - [[Vim key bindings][Vim key bindings]] - [[Escaping][Escaping]] @@ -84,7 +91,7 @@ - [[Helm][Helm]] - [[C-z and Tab switch][C-z and Tab switch]] - [[Helm focus][Helm focus]] - - [[Helm transient-state][Helm transient-state]] + - [[Helm transient state][Helm transient state]] - [[Discovering][Discovering]] - [[Key bindings][Key bindings]] - [[Which-key][Which-key]] @@ -105,17 +112,17 @@ - [[Joining and splitting][Joining and splitting]] - [[Window manipulation][Window manipulation]] - [[Window manipulation key bindings][Window manipulation key bindings]] - - [[Window manipulation transient-state][Window manipulation transient-state]] + - [[Window manipulation transient state][Window manipulation transient state]] - [[Golden ratio][Golden ratio]] - [[Buffers and Files][Buffers and Files]] - [[Buffers manipulation key bindings][Buffers manipulation key bindings]] - - [[Buffers manipulation transient-state][Buffers manipulation transient-state]] + - [[Buffers manipulation transient state][Buffers manipulation transient state]] - [[Special Buffers][Special Buffers]] - [[Files manipulations key bindings][Files manipulations key bindings]] - [[Emacs and Spacemacs files][Emacs and Spacemacs files]] - [[Browsing files with Helm][Browsing files with Helm]] - [[Ido][Ido]] - - [[Ido transient-state][Ido transient-state]] + - [[Ido transient state][Ido transient state]] - [[NeoTree file tree][NeoTree file tree]] - [[NeoTree navigation][NeoTree navigation]] - [[Opening files with NeoTree][Opening files with NeoTree]] @@ -167,6 +174,7 @@ - [[Deleting files][Deleting files]] - [[Editing Lisp code][Editing Lisp code]] - [[Lisp Key Bindings][Lisp Key Bindings]] + - [[Mouse usage][Mouse usage]] - [[Managing projects][Managing projects]] - [[Registers][Registers]] - [[Errors handling][Errors handling]] @@ -262,12 +270,16 @@ project. - Emacs users wanting a simple but deep configuration system that greatly *lower the risk of .emacs bankruptcy*. +- *Pair-programming* users thanks to out of the box support for dynamic + switching of editing style. A Vim user and an Emacs user can use the same + Spacemacs comfortably. + * Update and Rollback ** Update Spacemacs repository There are several methods of updating the core files and layer information for Spacemacs. It is recommended to update the packages first, see the next section. -*** Automatic Updates +*** Automatic Updates Spacemacs will automatically check for a new version every startup. When it detects that a new version is available a arrow will appear in the modeline. Click it to update Spacemacs. You must restart Emacs after updating. @@ -275,7 +287,8 @@ Click it to update Spacemacs. You must restart Emacs after updating. Update Button: [[file:img/powerline-update.png]] -*Note*: If you use the =develop= branch of Spacemacs, you must update using git. +*Note*: If you use the =develop= branch of Spacemacs, automatic update is +disabled, you have to update manually using git. *** Updating from the Spacemacs Buffer Use the button labeled "Update Spacemacs" in the Spacemacs buffer. You will be @@ -284,13 +297,16 @@ prompted for the version you would like to use. *Note*: If you use the =develop= branch of Spacemacs, you cannot use this method. *** Updating Manually with git - To update manually close Emacs and update the git repository: #+BEGIN_SRC sh -$ git pull --rebase +$ git pull origin master #+END_SRC +*Note*: The master branch is considered to be immutable in the sense that you +must not modify it by adding your own commit. If you do so you will break the +automatic update of Spacemacs on the master branch. To fork Spacemacs code you +have to use a custom branch that you manage manually. ** Update packages To update the Emacs packages used by Spacemacs press RET (enter) or click on the @@ -299,20 +315,21 @@ Emacs. If you prefer, you can use the command =configuration-layer/update-packages= instead of the button. If anything goes wrong you should be able to rollback the update by pressing -~RET~ or clicking on the =[Rollback Package Update]= link next to the =[Update -Packages]= link and choose a rollback slot (sorted by date). This button uses -the command =configuration-layer/rollback=. +~RET~ or clicking on the =[Rollback Package Update]= link in the startup page +and choose a rollback slot (sorted by date). This button uses the command +=configuration-layer/rollback=. * Configuration layers -*Note*: This is a very simple overview of how layers work. A more extensive -introduction to writing configuration layers can be found [[file:LAYERS.org][here]]. +This section is an overview of layers. A more extensive introduction to writing +configuration layers can be found [[file:LAYERS.org][here]]. ** Purpose Layers help collect related packages together to provide features. For example, the =python= layer provides auto-completion, syntax checking, and repl support for python files. This approach helps keep configuration organized and reduces overhead for the user by keeping them from having to think about what packages -to install +to install. To install all the =python= features the user has just to add the +=python= layer to their dotfile. ** Structure Configuration is organized in layers. Each layer has the following structure: @@ -327,29 +344,31 @@ Configuration is organized in layers. Each layer has the following structure: |__ funcs.el |__ keybindings.el |__ packages.el + |__ packages-funcs.el [] = directory #+END_EXAMPLE Where: -| File | Usage | -|----------------+----------------------------------------------------------------------| -| config.el | Emacs built-in configuration or mandatory configuration | -| funcs.el | Various functions and macros (often used in keybindings.el) | -| keybindings.el | Emacs built-in key bindings or mandatory key bindings | -| packages.el | The list of packages to install and the functions to initialize them | - -=Packages= are =ELPA= packages which can be installed from an =ELPA= compliant -repository, local packages in a layer's =local= folder, or packages that can be -installed from an online source using [[https://github.com/quelpa/quelpa][quelpa]]. - -** Packages -*** Within a layer +| File | Usage | +|-------------------+----------------------------------------------------------------------------------------| +| config.el | Layer configuration (not related to packages contained in this layer) | +| funcs.el | Various functions and macros (not related to packages contained in this layer) | +| keybindings.el | Emacs built-in key bindings or mandatory key bindings | +| packages.el | The list of packages to install and the configuration functions (init, post-init, ...) | +| packages-funcs.el | Additional functions used in the packages.el | + +=Packages= can be: +- =ELPA= packages installed from an =ELPA= compliant repository +- local packages in a layer's =local= folder +- installed from an online source using [[https://github.com/quelpa/quelpa][quelpa]]. + +** Configure packages +*** With a layer **** Declaration -=Packages= are declared in variables and =-packages= where == is -the layer name. They are processed in alphabetical order so sometimes you'll -have to use some =eval-after-load= black magic. +=Packages= are declared in a variable called =-packages= where == +is the name of the layer. Example: @@ -357,12 +376,20 @@ Example: (setq -packages '(package1 package2 ...) #+END_SRC -For details on installing local packages using quelpa or in the layer's =local= -folder, see [[file:LAYERS.org::packages.el][LAYERS]]. +All packages from all layers are processed in alphabetical order so sometimes +you'll have to use some =with-eval-after-load= black magic to configure them +properly. For instance if package =A= depends on =B= then you can configure +=A= with: + +#+BEGIN_SRC emacs-lisp +(with-eval-after-load 'B ...) +#+END_SRC + +For details on installing packages using quelpa or local packages see [[file:LAYERS.org::packages.el][LAYERS]]. **** Initialization To initialize an extension or a package =xxx=, define a function with this -format in or =packages.el=: +format in =packages.el=: #+BEGIN_SRC emacs-lisp (defun /init-xxx () ...body ) @@ -386,15 +413,15 @@ Example: *** Without a layer Sometimes a layer can be an unnecessary overhead, this is the case if you just -want to install a package without any configuration associated to it. A good -example is some niche language where you are only interested syntax +want to install a package with very few configuration associated to it. A good +example is some niche language where you are only interested in syntax highlighting. You can install such packages by adding them to the variable =dotspacemacs-additional-packages= in your dotfile. -If you want to add some configuration for them then consider to create a layer, -or just put the configuration in the =dotspacemacs/user-config= function. +If you want to add some configuration for them then put the configuration in +the =dotspacemacs/user-config= function or consider to create a layer. Example to install =llvm-mode= and =dts-mode=: @@ -402,27 +429,26 @@ Example to install =llvm-mode= and =dts-mode=: (setq dotspacemacs-additional-packages '(llvm-mode dts-mode) #+END_SRC -** Packages synchronization (Vundle like feature) -Spacemacs features a synchronization engine for the ELPA packages. It means -that Spacemacs will auto-install the new packages in =-packages= lists -/and/ auto-delete orphan packages in your =elpa= directory. - -It effectively makes Spacemacs behave like [[https://github.com/gmarik/Vundle.vim][Vundle]]. +** Packages synchronization +Spacemacs will only install the packages that are explicitly used by the user. +A package is considered to be used if its layer is used (i.e. listed in +=dotspacemacs-configuration-layers=). +Any packages that are not used is considered to be orphan and is deleted at +the next startup of Emacs. ** Types of configuration layers -There are three types of configuration layers: - - core (this is the Spacemacs layer) +There are two types of configuration layers: + - distributed layers (in the =layers= directory, those layers are contributions shared + by the community and merged upstream) - private (in the =private= directory, they are ignored by Git) - - contrib (in the =layers= directory, those layers are contributions shared - by the community and merged upstream). ** Submitting a configuration layer upstream -If you decide to provide a =contrib= configuration layer, please check the -contribution guidelines in [[file:../CONTRIBUTING.org][CONTRIBUTING]]. +If you decide to provide a configuration layer, please check the contribution +guidelines first in [[file:../CONTRIBUTING.org][CONTRIBUTING]]. ** Example: Themes Megapack example -This is a simple =contrib= configuration layer listing a bunch of themes, you -can find it [[../layers/themes-megapack][here]]. +This is a simple configuration layer listing a bunch of themes which you can +find [[../layers/themes-megapack][here]]. To install it, just add =themes-megapack= to your =~/.spacemacs= like so: @@ -430,8 +456,8 @@ To install it, just add =themes-megapack= to your =~/.spacemacs= like so: (setq-default dotspacemacs-configuration-layers '(themes-megapack)) #+END_SRC -You have now installed around 100 themes you are free to try with ~SPC T h~ -(helm-themes). +Adding this layer will install around 100 themes, to uninstall them remove the +layer from the =dotspacemacs-configuration-layers= and press ~SPC f e R~. ** Managing private configuration layers Spacemacs configuration system is flexible enough to let you manage your @@ -467,60 +493,56 @@ best make them fit with the Spacemacs philosophy and loading strategy. * Dotfile Configuration User configuration can be stored in your =~/.spacemacs= file. -** Installation -The very first time Spacemacs starts up, it will prompt you to choose your -editing style. Once you choose a style, the =.spacemacs= file will be created -from a template. +** Dotfile Installation +The very first time Spacemacs starts up, it will ask you several questions +and then install the =.spacemacs= in your =HOME= directory. -*** Alternative setup -Since v0.104 you have the option of using =~/.spacemacs.d/init.el= for your -dotfile instead of =~/.spacemacs=. If you want to use this option, simply move -=~/.spacemacs= to =~/.spacemacs.d/init.el=. =~/.spacemacs= will always take -priority over =~/.spacemacs.d/init.el=, so =~/.spacemacs= must be missing for -=~/.spacemacs.d/init.el= to be used by spacemacs. - -If you use this option, everything that applies to =~/.spacemacs= in this guide -will now apply to =~/.spacemacs.d/init.el=. +** Alternative dotdirectory +A dotdirectory =~/.spacemacs.d/= can be used instead of a dotfile. +If you want to use this option, move =~/.spacemacs= to =~/.spacemacs.d/init.el=. It is also possible to override the location of =~/.spacemacs.d/= using the environment variable =SPACEMACSDIR=. Of course you can also use symlinks to change the location of this directory. +*Note:* =~/.spacemacs= will always take priority over =~/.spacemacs.d/init.el=, +so =~/.spacemacs= must not exist for =~/.spacemacs.d/init.el= to be used by +Spacemacs. + ** Synchronization of dotfile changes To apply the modifications made in =~/.spacemacs= press ~SPC f e R~. It will re-execute the Spacemacs initialization process. -*Note*: A synchronization re-executes the functions =dotspacemacs/init= and -=dotspacemacs/user-config=. Depending on the content of this functions you may -encounter some unwanted side effects. For instance if you use a toggle in -=dotspacemac/user-config= to enable some behavior, this behavior will be turned -off whenever the dotfile is re-synchronized. To avoid these side-effects it is -recommended to either use =setq= expressions instead of toggle functions, or to -use the =on= or =off= versions instead (i.e. instead of -=spacemacs/toggle-=, use =spacemacs/toggle--on= or -=spacemacs/toggle--off=). It is possible to /skip/ the execution of -=dotspacemacs/user-config= with the universal argument (~SPC u SPC f e R~). - -** Testing +*Note*: A synchronization re-executes the functions =dotspacemacs/init=, +=dotspacemacs/user-init= and =dotspacemacs/user-config=. +Depending on the content of this functions you may encounter some unwanted side +effects. For instance if you use a toggle in =dotspacemac/user-config= to enable +some behavior, this behavior will be turned off whenever the dotfile is +re-synchronized. To avoid these side-effects it is recommended to either use +=setq= expressions instead of toggle functions, or to use the =on= or =off= +versions instead (i.e. instead of =spacemacs/toggle-=, use +=spacemacs/toggle--on= or =spacemacs/toggle--off=). + +It is possible to /skip/ the execution of =dotspacemacs/user-config= with the +universal argument (~SPC u SPC f e R~). + +** Testing the dotfile You can use the command =SPC SPC dotspacemacs/test-dotfile= to check if your =~/.spacemacs= looks correct. This will check, among other things, whether the declared layers can be found and that the variables have sensible values. These tests are also run automatically when you synchronize with ~SPC f e R~. -** Content +** Dotfile Contents *** Using configuration layers To use a configuration layer, add it to the =dotspacemacs-configuration-layers= variable of your =~/.spacemacs=. -For instance to add the configuration layer of [[Thank you][RMS]]: +For instance [[Thank you][RMS]] can add his private configuration layer like this: #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-configuration-layers '(rms)) #+END_SRC -If this layer does not exist you can still try another one in [[file:../layers][the =layers= -directory]]. - Configuration layers are expected to be stored in =~/.emacs.d/private= or =~/.emacs.d/layers=. But you are free to keep them somewhere else by declaring additional paths where Spacemacs can look for configuration layers. This is @@ -533,7 +555,7 @@ done by setting the list =dotspacemacs-configuration-layer-path= in your *** Setting configuration layers variables Some configuration layers have configuration variables to enable specific -support. For instance the [[../layers/%2Bsource-control/git][git layer]] has several configuration variables, they +feature. For instance the [[../layers/%2Bsource-control/git][git layer]] has several configuration variables, they can be set directly in the =dotspacemacs-configuration-layers= like this: #+BEGIN_SRC emacs-lisp @@ -557,113 +579,127 @@ For instance to disable the =rainbow-delimiters= package: #+END_SRC When you exclude a package, Spacemacs will automatically delete it for you the -next time you launch Emacs. All the orphan dependencies are as well delete +next time you launch Emacs. All the orphan dependencies are as well deleted automatically. -*** Hooks -Three special functions of the =~/.spacemacs= file can be used to perform -configuration at the beginning and end of Spacemacs loading process. +*** Configuration functions +Three special functions in the =~/.spacemacs= file can be used to perform +configuration at the beginning and end of Spacemacs loading process: + +- =dotspacemacs/init= is called at the very startup of Spacemacs initialization + before layers configuration. You should not put any user code in there + besides modifying the Spacemacs variable values. +- =dotspacemacs/user-init= is called immediately after =dotspacemacs/init=, + before layer configuration executes. This function is mostly useful for + variables that need to be set before packages are loaded. +- =dotspacemacs/user-config= is called at the very end of Spacemacs + initialization after layers configuration. This is the place where most of + your configurations should be done. Unless it is explicitly specified that a + variable should be set before a package is loaded, you should place you code + here. - - =dotspacemacs/init= is triggered at the very beginning of Spacemacs - loading. You can configure Spacemacs variables here. - - =dotspacemacs/user-init= is also triggered at the very beginning of Spacemacs - loading. User initialization occurs here. - - =dotspacemacs/user-config= is triggered at the very end of Spacemacs - loading. Most user configuration should go here. +*** Custom variables +Custom variables configuration from =M-x customize-group= which are +automatically saved by Emacs are stored at the end of your =~/.spacemacs= file. -*** Binding keys -Key sequences are bound to commands in Emacs in various keymaps. The most basic -map is the global-map. Setting a key binding the global-map uses the function -=global-set-key= as follows (to the command =forward-char= in this case). +* Concepts +** Editing Styles + Spacemacs comes with several editing styles which can be switched dynamically +providing an easier way to do pair programming, for instance between a Vim user +and an Emacs user. -#+BEGIN_SRC emacs-lisp -(global-set-key (kbd "C-]") 'forward-char) -#+END_SRC +Three styles are available: +- Vim, +- Emacs, +- Hybrid (a mix between Vim and Emacs). -The =kbd= macro accepts a string describing a key sequence. The global-map is -often shadowed by other maps. For example, evil-mode defines keymaps that target -states (or modes in vim terminology). Here is an example that creates the same -binding as above but only in insert state (=define-key= is a built-in function. -Evil-mode has its own functions for defining keys). +*** Vim +Spacemacs behaves like in Vim using [[https://gitorious.org/evil/pages/Home][Evil]] mode package to emulate Vim key bindings. +This is the default style of Spacemacs, it can be set explicitly by setting +the =dotspacemacs-editing-style= variable to =vim= in the dotfile. + +To bind keys in Vim editing style (=insert state=): #+BEGIN_SRC emacs-lisp (define-key evil-insert-state-map (kbd "C-]") 'forward-char) #+END_SRC -Perhaps most importantly for spacemacs is the use of the evil-leader package, -which binds keys to the evil-leader keymap. This is where most of the spacemacs -bindings live. There are two related commands from this package which are used -as follows. +*** Emacs +Spacemacs behaves like in raw Emacs using the Holy mode which configures Evil to +make the =emacs state= the default state everywhere. +Set the =dotspacemacs-editing-style= variable to =emacs= in the dotfile. + +In Emacs style the leader is available on ~M-m~. It is possible to toggle it on +and off with ~SPC t E e~ and ~M-m t E e~. When off the =vim= style is enabled. + +To bind keys in Emacs editing style (=emacs state=): #+BEGIN_SRC emacs-lisp -(spacemacs/set-leader-keys "C-]" 'forward-char) -(spacemacs/set-leader-keys-for-major-mode 'emacs-lisp-mode "C-]" 'forward-char) +(define-key evil-emacs-state-map (kbd "C-]") 'forward-char) #+END_SRC -These functions use a macro like =kbd= to translate the key sequences for you. -The second function, =spacemacs/set-leader-keys-for-major-mode=, binds the key only in the -specified mode. The second key binding would not be in effect in =org-mode= for -example. +*** Hybrid +The hybrid editing style is like the Vim style except that =insert state= is +replaced by a new state called =hybrid state=. In =hybrid state= all the Emacs +key bindings are available, this is like replacing the =insert state= with the +=emacs state= but provides an isolated key map =evil-hybrid-state-map=. -Finally, one should be aware of prefix keys. Essentially, all keymaps can be -nested. Nested keymaps are used extensively in spacemacs, and in vanilla Emacs -for that matter. For example, ~SPC a~ points to key bindings for "applications", -like ~SPC ac~ for =calc-dispatch=. Nesting bindings is easy. +To bind keys in Hybrid editing style (=hybrid state=): #+BEGIN_SRC emacs-lisp -(spacemacs/declare-prefix "]" "bracket-prefix") -(spacemacs/set-leader-keys "]]" 'double-bracket-command) +(define-key evil-hybrid-state-map (kbd "C-]") 'forward-char) #+END_SRC -The first line declares ~SPC ]~ to be a prefix and the second binds the key -sequence ~SPC ]]~ to the corresponding command. The first line is actually -unnecessary to create the prefix, but it will give your new prefix a name that -key-discovery tools can use (e.g., which-key). +This style can be tweaked to be more like Emacs or more like Vim depending +on the user preferences. The following variable are available to change the +style configuration: -There is much more to say about bindings keys, but these are the basics. Keys -can be bound in your =~/.spacemacs= file or in individual layers. +- =hybrid-mode-default-state= The default state when opening a new buffer, + default is =normal=. Set it to =emacs= for a more emacsy style. +- =hybrid-mode-enable-hjkl-bindings= If non nil then packages will configure + =h j k l= key bindings for navigation. +- =hybrid-mode-enable-evilified-state= If non nil buffer are =evilified= when + supported, if nil then =emacs= state is enabled in those buffers instead. -*** Custom variables -Custom variables configuration from =M-x customize-group= which are -automatically saved by Emacs are stored at the end of your =~/.spacemacs= file. - -* Main principles -** Editing Styles -*** Vim -Spacemacs behaves like in Vim using [[https://gitorious.org/evil/pages/Home][Evil]] mode package to emulate Vim key bindings. -This is the default style of Spacemacs, it can be set explicitly by setting -the =dotspacemacs-editing-style= variable to =vim= in the dotfile. +Default configuration is: -*** Emacs -Spacemacs behaves like in raw Emacs using the Holy mode which configures Evil to -make the emacs state the default state everywhere. -Set the =dotspacemacs-editing-style= variable to =emacs= in the dotfile. +#+BEGIN_SRC emacs-lisp +(setq-default dotspacemacs-editing-style '(hybrid :variables + hybrid-mode-enable-evilified-state nil + hybrid-mode-enable-hjkl-bindings nil + hybrid-mode-default-state 'normal) +#+END_SRC -In Emacs style the leader is available on ~M-m~. It is possible to dynamically -switch between evil and holy mode using ~SPC t E h~ and ~M-m t E h~. +To toggle the hybrid style on and off use ~SPC t E h~ and ~M-m t E h~. When +off the =vim= style is enabled. -*** Hybrid -The hybrid editing style is like the Vim style except that insert state -has all the Emacs key bindings available like in emacs state. The insert state -in hybrid mode is called the hybrid state and you have to map your key bindings -in =evil-hybrid-state-map= keymap instead of =evil-insert-state-map=. +** States +Spacemacs has 10 states: -Hybrid mode can be enabled by setting =dotspacemacs-editing-style= to =hybrid=. -To switch between evil and hybrid mode use ~SPC t E y~ and ~M-m t E y~. +| State | Default Color | Description | +|--------------+---------------+------------------------------------------------------------------------------------------------------------| +| normal | orange | like the =normal mode of Vim=, used to execute and combine commands | +| insert | green | like the =insert mode of Vim=, used to actually insert text | +| visual | gray | like the =visual mode of Vim=, used to make text selection | +| motion | purple | exclusive to =Evil=, used to navigate read only buffers | +| emacs | blue | exclusive to =Evil=, using this state is like using a regular Emacs without Vim | +| replace | chocolate | exclusive to =Evil=, overwrites the character under point instead of inserting a new one | +| hybrid | blue | exclusive to Spacemacs, this is like the insert state except that all the emacs key bindings are available | +| evilified | light brown | exclusive to Spacemacs, this is an =emacs state= modified to bring Vim navigation, selection and search. | +| lisp | pink | exclusive to Spacemacs, used to navigate Lisp code and modify it (more [[Editing Lisp code][info]]) | +| iedit | red | exclusive to Spacemacs, used to navigate between multiple regions of text using =iedit= (more [[Replacing text with iedit][info]]) | +| iedit-insert | red | exclusive to Spacemacs, used to replace multiple regions of text using =iedit= (more [[Replacing text with iedit][info]]) | -The default state in hybrid mode can be changed by setting the variable -=hybrid-mode-default-state= to a state value, the default is =normal=, set it -to =hybrid= to start in hybrid insert state instead of normal state. +Note: Technically speaking there is also the =operator= evil state. ** Evilified modes -Some buffers (such as Magit, for using git from within Emacs), are not for -editing text, and provide their own keybindings for certain operations. These -often conflict with Vim bindings. To make such buffers behave Vim-like in a -consistent manner, they use a special state called /evilified/ state. In -evilified state, a handful of keys work as in Evil, namely =/=, =:=, =h=, =j=, -=k=, =l=, =n=, =N=, =v=, =V=, =gg=, =G=, =C-f=, =C-b=, =C-d=, =C-e=, =C-u=, -=C-y= and =C-z=. -All other keys work as intended by the underlying mode. +Some buffers are not for editing text and provide their own keybindings for +certain operations. These often conflict with Vim bindings. To make such buffers +behave more like Vim in a consistent manner, they use a special state called +/evilified/ state. In evilified state, a handful of keys work as in Evil, namely +=/=, =:=, =h=, =j=, =k=, =l=, =n=, =N=, =v=, =V=, =gg=, =G=, =C-f=, =C-b=, +=C-d=, =C-e=, =C-u=, =C-y= and =C-z=. All other keys work as intended by the +underlying mode. Shadowed keys are moved according to the pattern: =a= → =A= → =C-a= → =C-A= @@ -677,35 +713,16 @@ In addition to this, =C-g=, being an important escape key in Emacs, is skipped. So anything bound to =g= originally will be found on =C-G=, since =g=, =G= and =C-g= are all reserved. -** States -Spacemacs has 10 states: - -| State | Color | Description | -|--------------+-------------+------------------------------------------------------------------------------------------------------------| -| normal | orange | like the =normal mode of Vim=, used to execute and combine commands | -| insert | green | like the =insert mode of Vim=, used to actually insert text | -| visual | gray | like the =visual mode of Vim=, used to make text selection | -| motion | purple | exclusive to =Evil=, used to navigate read only buffers | -| emacs | blue | exclusive to =Evil=, using this state is like using a regular Emacs without Vim | -| replace | chocolate | exclusive to =Evil=, overwrites the character under point instead of inserting a new one | -| hybrid | blue | exclusive to Spacemacs, this is like the insert state except that all the emacs key bindings are available | -| evilified | light brown | exclusive to Spacemacs, this is an =emacs state= modified to bring Vim navigation, selection and search. | -| lisp | pink | exclusive to Spacemacs, used to navigate Lisp code and modify it (more [[Editing Lisp code][info]]) | -| iedit | red | exclusive to Spacemacs, used to navigate between multiple regions of text using =iedit= (more [[Replacing text with iedit][info]]) | -| iedit-insert | red | exclusive to Spacemacs, used to replace multiple regions of text using =iedit= (more [[Replacing text with iedit][info]]) | - -Note: Technically speaking there is also the =operator= evil state. - ** Evil leader -Spacemacs heavily uses the [[https://github.com/cofi/evil-leader][evil-leader]] mode which brings the Vim leader key to -the Emacs world. +Spacemacs uses a leader key to bind almost all its key bindings. This leader key is commonly set to ~​,​~ by Vim users, in Spacemacs the leader -key is set on ~SPC~ (space bar, hence the name =spacemacs=). This key is the +key is set on ~SPC~ (the space bar, hence the name =spacemacs=). This key is the most accessible key on a keyboard and it is pressed with the thumb which is a -good choice to lower the risk of [[http://en.wikipedia.org/wiki/Repetitive_strain_injury][RSI]]. +good choice to lower the risk of [[http://en.wikipedia.org/wiki/Repetitive_strain_injury][RSI]]. It can be customized to any other key +using the variable =dotspacemacs-leader-key= and =dotspacemacs-emacs-leader-key=. -So with Spacemacs there is no need to remap your keyboard modifiers to attempt +With Spacemacs there is no need to remap your keyboard modifiers to attempt to reduce the risk of RSI, every command can be executed very easily while you are in =normal= mode by pressing the ~SPC~ leader key, here are a few examples: @@ -725,17 +742,17 @@ to ~SPC u~. pressing ~RETURN~. For instance: ~SPC SPC org-reload C-u RET~ ** Transient-states -Spacemacs defines a wide variety of =transient-states= (temporary overlay maps) +Spacemacs defines a wide variety of =transient states= (temporary overlay maps) where it makes sense. This prevents one from doing repetitive and tedious presses on the ~SPC~ key. -When a =transient-state= is active, a documentation is displayed in the minibuffer. -Additional information may as well be displayed in the minibuffer. +When a =transient state= is active, a documentation is displayed in the +minibuffer. Additional information may as well be displayed in the minibuffer. -Auto-highlight-symbol transient-state: +Auto-highlight-symbol transient state: [[file:img/spacemacs-ahs-transient-state.png]] +[[Text][Text scale transient state]]: -[[Text][Text scale transient-state]]: [[file:img/spacemacs-scale-transient-state.png]] * Differences between Vim, Evil and Spacemacs @@ -743,9 +760,6 @@ Auto-highlight-symbol transient-state: opposite direction in =Vim=, but in Spacemacs it is the major mode specific leader key by default (which can be set on another key binding in the dotfile). -- The ~Y~ key does not yank the whole line. It yanks from the current point to - the end of the line. This is more consistent with the behavior of ~C~ and ~D~ - and is also recommended by the vim documentation. Send a PR to add the differences you found in this section. @@ -754,13 +768,14 @@ There is one obvious visible difference though. It is not between =Evil= and =Vim= but between Spacemacs and [[https://github.com/tpope/vim-surround][vim-surround]]: the =surround= command is on ~S~ in =vim-surround= whereas it is on ~s~ in Spacemacs. -This is something that can surprise some Vim users so let me explain why this is -the case: +This is something that can surprise some Vim users so here are some motivations +behind this change: - ~s~ and ~c~ do the same thing in =visual state=, - ~s~ is only useful to delete /one/ character and add more than one character which is a /very/ narrow use case - ~c~ accept motions and can do everything ~s~ can do in =normal state= - - this is also true for ~r~ but ~r~ is more useful because it stays in =normal state= + (note that this is also true for ~r~ but ~r~ is more useful because it + stays in =normal state=) - =surround= command is just a more powerful command than ~s~. If you are not convinced, then here is the snippet to revert back to the default @@ -777,32 +792,78 @@ Spacemacs ships with the following evil plugins: | Mode | Description | |-------------------------------+----------------------------------------------------------| -| [[https://github.com/cofi/evil-leader][evil-leader]] | vim leader that bring a new layer of keys in normal mode | -| [[https://github.com/cofi/evil-indent-textobject][evil-indent-textobject]] | add text object based on indentation level | -| [[https://github.com/bling/evil-visualstar][evil-visualstar]] | search for current selection with ~*~ | +| [[https://github.com/wcsmith/evil-args][evil-args]] | motions and text objects for arguments | | [[https://github.com/Dewdrops/evil-exchange][evil-exchange]] | port of [[https://github.com/tommcdo/vim-exchange][vim-exchange]] | -| [[https://github.com/timcharper/evil-surround][evil-surround]] | port of [[https://github.com/tpope/vim-surround][vim-surround]] | +| [[https://github.com/cofi/evil-indent-textobject][evil-indent-textobject]] | add text object based on indentation level | | [[https://github.com/redguardtoo/evil-matchit][evil-matchit]] | port of [[http://www.vim.org/scripts/script.php?script_id=39][matchit.vim]] | | [[https://github.com/redguardtoo/evil-nerd-commenter][evil-nerd-commenter]] | port of [[https://github.com/scrooloose/nerdcommenter][nerdcommenter]] | -| [[https://github.com/juanjux/evil-search-highlight-persist][evil-search-highlight-persist]] | emulation of hlsearch behavior | | [[https://github.com/cofi/evil-numbers][evil-numbers]] | like ~C-a~ and ~C-x~ in vim | -| [[https://github.com/wcsmith/evil-args][evil-args]] | motions and text objects for arguments | +| [[https://github.com/juanjux/evil-search-highlight-persist][evil-search-highlight-persist]] | emulation of hlsearch behavior | +| [[https://github.com/timcharper/evil-surround][evil-surround]] | port of [[https://github.com/tpope/vim-surround][vim-surround]] | +| [[https://github.com/bling/evil-visualstar][evil-visualstar]] | search for current selection with ~*~ | | [[https://github.com/jaypei/emacs-neotree][NeoTree]] | mimic [[https://github.com/scrooloose/nerdtree][NERD Tree]] | -* Spacemacs UI -Spacemacs has unique UI elements to make the Emacs experience even more -enjoyable: - - dedicated startup page with a mode aimed at easily managing Spacemacs - - dedicated helm source via =helm-spacemacs-help= - - a [[https://github.com/justbur/emacs-which-key][which-key]] buffer +* Binding keys +Key sequences are bound to commands in Emacs in various keymaps. The most basic +map is the =global-map=. Setting a key binding in the =global-map= is achieved +with the function =global-set-key=. Example to bind a key to the command +=forward-char=: + +#+BEGIN_SRC emacs-lisp +(global-set-key (kbd "C-]") 'forward-char) +#+END_SRC + +The =kbd= macro accepts a string describing a key sequence. The =global-map= is +often shadowed by other maps. For example, =evil-mode= defines keymaps that +target states (or modes in vim terminology). Here is an example that creates the +same binding as above but only in =insert state= (=define-key= is a built-in +function. =Evil-mode= has its own functions for defining keys). + +#+BEGIN_SRC emacs-lisp +(define-key evil-insert-state-map (kbd "C-]") 'forward-char) +#+END_SRC + +Perhaps most importantly for Spacemacs is the use of the bind-map package to +bind keys behind a leader key. +This is where most of the Spacemacs bindings live. Binding keys behind the +leader key is achieved with the functions =spacemacs/set-leader-keys= and +=spacemacs/set-leader-keys-for-major-mode=, example: + +#+BEGIN_SRC emacs-lisp +(spacemacs/set-leader-keys "C-]" 'forward-char) +(spacemacs/set-leader-keys-for-major-mode 'emacs-lisp-mode "C-]" 'forward-char) +#+END_SRC + +These functions use a macro like =kbd= to translate the key sequences for you. +The second function, =spacemacs/set-leader-keys-for-major-mode=, binds the key +only in the specified mode. The second key binding is active only when the +major mode is =emacs-lisp=. -** Graphical UI +Finally, one should be aware of prefix keys. Essentially, all keymaps can be +nested. Nested keymaps are used extensively in spacemacs, and in vanilla Emacs +for that matter. For example, ~SPC a~ points to key bindings for "applications", +like ~SPC a c~ for =calc-dispatch=. Nesting bindings is easy. + +#+BEGIN_SRC emacs-lisp +(spacemacs/declare-prefix "]" "bracket-prefix") +(spacemacs/set-leader-keys "]]" 'double-bracket-command) +#+END_SRC + +The first line declares ~SPC ]~ to be a prefix and the second binds the key +sequence ~SPC ]]~ to the corresponding command. The first line is actually +unnecessary to create the prefix, but it will give your new prefix a name that +key-discovery tools can use (e.g., which-key). + +There is much more to say about bindings keys, but these are the basics. Keys +can be bound in your =~/.spacemacs= file or in individual layers. + +* GUI Elements Spacemacs has a minimalistic and distraction free graphical UI: - custom [[https://github.com/milkypostman/powerline][powerline]] mode-line [[Flycheck integration][with color feedback]] according to current [[https://github.com/flycheck/flycheck][Flycheck]] status - Unicode symbols for minor mode lighters which appear in the mode-line - [[Errors handling][custom fringe bitmaps]] and error feedbacks for [[https://github.com/flycheck/flycheck][Flycheck]] -*** Color themes +** Color themes The official Spacemacs theme is [[https://github.com/nashamri/spacemacs-theme][spacemacs-dark]] and it is the default theme installed when you first started Spacemacs. There are two variants of the @@ -840,7 +901,7 @@ You can see samples of all included themes in this [[http://themegallery.robdor. *Hint*: If you are an =Org= user, [[https://github.com/fniessen/emacs-leuven-theme][leuven-theme]] is amazing ;-) -*** Font +** Font The default font used by Spacemacs is [[https://github.com/adobe-fonts/source-code-pro][Source Code Pro]] by Adobe. It is recommended to install it on your system. @@ -906,12 +967,13 @@ separators like on the following screenshot (default value is 1.1). [[file:img/crappy-powerline-separators.png]] -*** Graphical UI Toggles +** GUI Toggles Some graphical UI indicators can be toggled on and off (toggles start with ~t~ and ~T~): | Key Binding | Description | |-------------+-------------------------------------------------------------------| +| ~SPC t 8~ | highlight any character past the 80th column | | ~SPC t f~ | display the fill column (by default the fill column is set to 80) | | ~SPC t h h~ | toggle highlight of the current line | | ~SPC t h i~ | toggle highlight indentation levels | @@ -922,15 +984,15 @@ and ~T~): | ~SPC t n~ | toggle line numbers | | ~SPC t v~ | toggle smooth scrolling | -| Key Binding | Description | -|-------------+--------------------------------------------------------------| -| ~SPC T ~~ | display =~= in the fringe on empty lines | -| ~SPC T F~ | toggle frame fullscreen | -| ~SPC T f~ | toggle display of the fringe | -| ~SPC T m~ | toggle menu bar | -| ~SPC T M~ | toggle frame maximize | -| ~SPC T t~ | toggle tool bar | -| ~SPC T T~ | toggle frame transparency and enter transparency transient-state | +| Key Binding | Description | +|-------------+------------------------------------------------------------------| +| ~SPC T ~~ | display =~= in the fringe on empty lines | +| ~SPC T F~ | toggle frame fullscreen | +| ~SPC T f~ | toggle display of the fringe | +| ~SPC T m~ | toggle menu bar | +| ~SPC T M~ | toggle frame maximize | +| ~SPC T t~ | toggle tool bar | +| ~SPC T T~ | toggle frame transparency and enter transparency transient state | *Note*: These toggles are all available via the =helm-spacemacs-help= interface (press ~SPC h SPC~ to display the =helm-spacemacs-help= buffer). @@ -950,14 +1012,7 @@ If it is set to =relative=, line numbers are show in a relative way: (setq-default dotspacemacs-line-numbers 'relative) #+END_SRC -*** Mouse usage -There are some added mouse features set for the line number margin (if shown): - -- single click in line number margin visually selects the entire line -- drag across line number margin visually selects the region -- double click in line number margin visually select the current code block - -*** Mode-line +** Mode-line The mode line is a heavily customized [[https://github.com/milkypostman/powerline][powerline]] with the following capabilities: - show the window number - color code for current state @@ -1080,31 +1135,33 @@ toggle them. Some toggle have two flavors: local and global. The global version of the toggle can be reached using the =control= key. -| Key Binding | Unicode | ASCII | Mode | -|-------------+---------+-------+---------------------------------------------| -| ~SPC t -~ | =⊝= | - | [[http://emacswiki.org/emacs/centered-cursor-mode.el][centered-cursor]] mode | -| ~SPC t C--~ | =⊝= | | global centered cursor | -| ~SPC t a~ | =ⓐ= | a | auto-completion | -| ~SPC t c~ | =ⓒ= | c | camel case motion with subword mode | -| =none= | =ⓔ= | e | [[https://github.com/edwtjo/evil-org-mode][evil-org]] mode | -| ~SPC t E e~ | =Ⓔe= | Ee | emacs editing style (holy mode) | -| ~SPC t E h~ | =Ⓔh= | Eh | hybrid editing style (hybrid mode) | -| ~SPC t f~ | | | fill-column-indicator mode | -| ~SPC t F~ | =Ⓕ= | F | auto-fill mode | -| ~SPC t g~ | =ⓖ= | g | [[https://github.com/roman/golden-ratio.el][golden-ratio]] mode | -| ~SPC t h i~ | =ⓗi= | hi | toggle highlight indentation levels | -| ~SPC t h c~ | =ⓗc= | hc | toggle highlight indentation current column | -| ~SPC t i~ | =ⓘ= | i | indentation guide | -| ~SPC t C-i~ | =ⓘ= | i | global indentation guide | -| ~SPC t I~ | =Ⓘ= | I | aggressive indent mode | -| ~SPC t K~ | =Ⓚ= | K | which-key mode | -| ~SPC t p~ | =ⓟ= | p | [[https://github.com/Fuco1/smartparens][smartparens]] mode | -| ~SPC t C-p~ | =ⓟ= | | global smartparens | -| ~SPC t s~ | =ⓢ= | s | syntax checking (flycheck) | -| ~SPC t S~ | =Ⓢ= | S | enabled in [[../layers/spell-checking][spell checking layer]] (flyspell) | -| ~SPC t w~ | =ⓦ= | w | whitespace mode | -| ~SPC t C-w~ | =Ⓦ= | W | global whitespace | -| ~SPC t y~ | =ⓨ= | y | [[https://github.com/capitaomorte/yasnippet][yasnippet]] mode | +| Key Binding | Unicode | ASCII | Mode | +|-------------+---------+-------+------------------------------------------------------| +| ~SPC t -~ | =⊝= | - | [[http://emacswiki.org/emacs/centered-cursor-mode.el][centered-cursor]] mode | +| ~SPC t 8~ | =⑧= | 8 | toggle highlight of characters for long lines | +| ~SPC t C-8~ | =⑧= | 8 | global toggle highlight of characters for long lines | +| ~SPC t C--~ | =⊝= | | global centered cursor | +| ~SPC t a~ | =ⓐ= | a | auto-completion | +| ~SPC t c~ | =ⓒ= | c | camel case motion with subword mode | +| =none= | =ⓔ= | e | [[https://github.com/edwtjo/evil-org-mode][evil-org]] mode | +| ~SPC t E e~ | =Ⓔe= | Ee | emacs editing style (holy mode) | +| ~SPC t E h~ | =Ⓔh= | Eh | hybrid editing style (hybrid mode) | +| ~SPC t f~ | | | fill-column-indicator mode | +| ~SPC t F~ | =Ⓕ= | F | auto-fill mode | +| ~SPC t g~ | =ⓖ= | g | [[https://github.com/roman/golden-ratio.el][golden-ratio]] mode | +| ~SPC t h i~ | =ⓗi= | hi | toggle highlight indentation levels | +| ~SPC t h c~ | =ⓗc= | hc | toggle highlight indentation current column | +| ~SPC t i~ | =ⓘ= | i | indentation guide | +| ~SPC t C-i~ | =ⓘ= | i | global indentation guide | +| ~SPC t I~ | =Ⓘ= | I | aggressive indent mode | +| ~SPC t K~ | =Ⓚ= | K | which-key mode | +| ~SPC t p~ | =ⓟ= | p | [[https://github.com/Fuco1/smartparens][smartparens]] mode | +| ~SPC t C-p~ | =ⓟ= | | global smartparens | +| ~SPC t s~ | =ⓢ= | s | syntax checking (flycheck) | +| ~SPC t S~ | =Ⓢ= | S | enabled in [[../layers/spell-checking][spell checking layer]] (flyspell) | +| ~SPC t w~ | =ⓦ= | w | whitespace mode | +| ~SPC t C-w~ | =Ⓦ= | W | global whitespace | +| ~SPC t y~ | =ⓨ= | y | [[https://github.com/capitaomorte/yasnippet][yasnippet]] mode | **** Customizing the mode-line Spacemacs uses [[https://github.com/TheBB/spaceline][Spaceline]] to provide its mode-line. It consists of a number of @@ -1115,6 +1172,172 @@ right hand side variables. Please see the Spaceline documentation for more information. +* Layouts and workspaces +Layouts are window configurations with buffer isolation, each layout can define +several workspaces (think of them as sub-layouts) sharing the same list of +buffers as their parent layout. + +** Layouts +A layout is a window configuration associated with a list of buffers. The list +of buffers can be an arbitrarily chosen set of buffers. Spacemacs provides +some facilities to create meaningful sets of buffers, for instance the buffers +related to a projectile project. + +The name of the current layout appears in the mode-line at the far left (first +element of the mode-line). + +To create a new layout type a layout number that does not exist yet. +For instance if you have two layouts currently then type ~SPC l 3~ to create a +third layout. + +*** The default layout +The =default= layout (the layout created at the startup of Emacs) is not +displayed in the mode-line but it is possible to display it by setting the +variable =dotspacemacs-display-default-layout= to =t=. + +Its name is "default" by default but it can be changed by setting the variable +=dotspacemacs-default-layout-name=. + +The =default= layout is special because it has a global scope which means that +all the opened buffers belong to it. So using only the =default= layout feels +like not using layouts at all. + +*** Project layouts +A project layout is bound to a projectile project. To create a project layout +use ~SPC p l~. + +The name of the layout is the name of the project root directory. + +*** Custom Layouts +Custom layouts can be defined using the macro ~spacemacs|define-custom-layout~, +they are accessible via ~SPC l o~. + +By convention the name of a custom layout should start with =@=. + +Example of custom layout definition for =ERC= buffers: + +#+BEGIN_SRC emacs-lisp + (spacemacs|define-custom-layout "@ERC" + :binding "E" + :body + (progn + ;; hook to add all ERC buffers to the layout + (defun spacemacs-layouts/add-erc-buffer-to-persp () + (persp-add-buffer (current-buffer) + (persp-get-by-name + erc-spacemacs-layout-name))) + (add-hook 'erc-mode-hook #'spacemacs-layouts/add-erc-buffer-to-persp) + ;; Start ERC + (call-interactively 'erc))) +#+END_SRC + +Then use ~SPC l o E~ to start ERC inside its own layout. Any new ERC buffer +will be part of the custom layout. + +Some custom layouts that ship with Spacemacs: + +| Name | Key Binding | Description | +|------------+-------------+---------------------------------------------------------------------------------| +| @Spacemacs | ~e~ | Custom perspective containing all buffers of =~/.emacs.d= | +| @ERC | ~E~ | Custom perspective containing all ERC buffers (needs the erc layer enabled) | +| @RCIRC | ~i~ | Custom perspective containing all RCIRC buffers (needs the rcirc layer enabled) | +| @Org | ~o~ | Custom perspective containing all the =org-agenda= buffers | + +*** Save/Load layouts into a file +With ~SPC l s~ and ~SPC l L~ you can save and load layouts to/from a file. + +*Note:* By default, Spacemacs will automatically save the layouts under the name +=persp-auto-save=. + +Setting the variable =dotspacemacs-auto-resume-layouts= to =t= will +automatically resume the last saved layouts. + +*** Layout key bindings +The key bindings are registered in a transient state. The docstring of the +transient state displays the existing layouts and the currently active +layout has square brackets. Pressing a layout number will activate it (or +create a new one) and exit the transient state. It is possible to just preview a +layout with ~Ctrl-~. Pressing ~TAB~ will activate the previously +selected layout. + +Press ~?~ to toggle the full help. + +| Key Binding | Description | +|-------------------+------------------------------------------------------------| +| ~SPC l~ | activate the transient- state | +| ~?~ | toggle the documentation | +| ~[1..9, 0]~ | switch to nth layout | +| ~[C-1..C-9, C-0]~ | switch to nth layout and keep the transient state active | +| ~~ | switch to the latest layout | +| ~a~ | add a buffer to the current layout | +| ~A~ | add all the buffers from another layout in the current one | +| ~b~ | select a buffer in the current layout | +| ~d~ | delete the current layout and keep its buffers | +| ~D~ | delete the other layouts and keep their buffers | +| ~h~ | go to default layout | +| ~C-h~ | previous layout in list | +| ~l~ | select/create a layout with helm | +| ~L~ | load layouts from file | +| ~C-l~ | next layout in list | +| ~n~ | next layout in list | +| ~N~ | previous layout in list | +| ~o~ | open a custom layout | +| ~p~ | previous layout in list | +| ~r~ | remove current buffer from layout | +| ~R~ | rename current layout | +| ~s~ | save layouts | +| ~t~ | display a buffer without adding it to the current layout | +| ~w~ | workspaces transient state (needs eyebrowse layer enabled) | +| ~x~ | kill current layout with its buffers | +| ~X~ | kill other layouts with their buffers | + +** Workspaces +Workspaces are sub-layouts, they allow to define multiple layouts into a given +layout, those layouts share the same buffer as the parent layout. + +The currently active workspace number is displayed before the window number, +for instance "➊|➍" or "1|4" means the fourth window of the first workspace. + +Any new layout comes with a default workspace which is the workspace 1. + +Switching to a workspace that does not exist in the current layout will create a +new one. For instance at startup you can press ~SPC l w 2~ to create the +workspace 2 in the =default= layout. + +When created a workspace is anonymous, you can give them a name with +~SPC l w R~. + +*** Workspace key bindings +The key bindings are registered in a transient state. The docstring of the +transient state displays the existing workspaces and the currently active +workspace has square brackets. Pressing a workspace number will activate it (or +create a new one) and exit the transient state. It is possible to just preview a +workspace with ~Ctrl-~. Pressing ~TAB~ will activate the previously +selected workspace. + +Press ~?~ to toggle the full help. + +| Key Binding | Description | +|-------------------+-------------------------------------------------------------| +| ~SPC l w~ | activate the transient state | +| ~?~ | toggle the documentation | +| ~[1..9, 0]~ | switch to nth workspace | +| ~[C-1..C-9, C-0]~ | switch to nth workspace and keep the transient state active | +| ~TAB~ | switch to last active workspace | +| ~d~ | close current workspace | +| ~n~ or ~l~ | switch to next workspace | +| ~N~ or ~p~ or ~h~ | switch to previous workspace | +| ~R~ | set a tag to the current workspace | +| ~w~ | switched to tagged workspace | + +There are also some handy globally available key bindings related to workspaces: + +| Key Binding | Description | +|-------------+--------------------------------------| +| ~gt~ | go to next workspace | +| ~gT~ | got to previous workspace | +| ~SPC b W~ | go to workspace and window by buffer | + * Commands ** Vim key bindings Spacemacs is based on =Vim= modal user interface to navigate and edit text. If @@ -1169,7 +1392,6 @@ state= to press quickly ~jj~ and inadvertently escape to =normal state=. The emacs command key ~SPC~ (executed after the leader key) can be changed with the variable =dotspacemacs-emacs-command-key= of your =~/.spacemacs=. - *** Leader key On top of =Vim= modes (modes are called states in Spacemacs) there is a special key called the leader key which once pressed gives a whole new keyboard @@ -1215,37 +1437,37 @@ makes sense to swap them. It's also recommended [[http://tuhdo.github.io/helm-in If you find yourself unable to return focus to Helm (after a careless mouse-click for example), use ~SPC w b~ to return focus to the minibuffer. -*** Helm transient-state -Spacemacs defines a [[Transient-states][transient-state]] for =Helm= to make it work like [[https://github.com/Shougo/unite.vim][Vim's Unite]] +*** Helm transient state +Spacemacs defines a [[Transient-states][transient state]] for =Helm= to make it work like [[https://github.com/Shougo/unite.vim][Vim's Unite]] plugin. -Initiate the transient-state with ~M-SPC~ or ~s-M-SPC~ while in a =Helm= buffer. - -| Key Binding | Description | -|----------------------+--------------------------------------------------| -| ~M-SPC~ or ~s-M-SPC~ | initiate the transient-state | -| ~q~ | quit transient-state | -| ~TAB~ | switch to actions page and leave the transient-state | -| ~1~ | execute action 0 | -| ~2~ | execute action 1 | -| ~3~ | execute action 2 | -| ~4~ | execute action 3 | -| ~5~ | execute action 4 | -| ~6~ | execute action 5 | -| ~7~ | execute action 6 | -| ~8~ | execute action 7 | -| ~9~ | execute action 8 | -| ~0~ | execute action 9 | -| ~a~ | switch to actions page | -| ~g~ | go to first candidate | -| ~G~ | go to last candidate | -| ~h~ | go to previous source | -| ~j~ | select next candidate | -| ~k~ | select previous candidate | -| ~l~ | go to next source | -| ~t~ | mark current candidate | -| ~T~ | mark all candidates | -| ~v~ | execute persistent action | +Initiate the transient state with ~M-SPC~ or ~s-M-SPC~ while in a =Helm= buffer. + +| Key Binding | Description | +|----------------------+------------------------------------------------------| +| ~M-SPC~ or ~s-M-SPC~ | initiate the transient state | +| ~q~ | quit transient state | +| ~TAB~ | switch to actions page and leave the transient state | +| ~1~ | execute action 0 | +| ~2~ | execute action 1 | +| ~3~ | execute action 2 | +| ~4~ | execute action 3 | +| ~5~ | execute action 4 | +| ~6~ | execute action 5 | +| ~7~ | execute action 6 | +| ~8~ | execute action 7 | +| ~9~ | execute action 8 | +| ~0~ | execute action 9 | +| ~a~ | switch to actions page | +| ~g~ | go to first candidate | +| ~G~ | go to last candidate | +| ~h~ | go to previous source | +| ~j~ | select next candidate | +| ~k~ | select previous candidate | +| ~l~ | go to next source | +| ~t~ | mark current candidate | +| ~T~ | mark all candidates | +| ~v~ | execute persistent action | ** Discovering *** Key bindings @@ -1374,7 +1596,7 @@ Spacemacs. *** Toggles =helm-spacemacs-help= is also a central place to discover the available toggles. -To display only the toggles source press ~C-l~ (or in [[Helm transient-state][Helm transient-state]] you can +To display only the toggles source press ~C-l~ (or in [[Helm transient state][Helm transient state]] you can press just ~l~). The following helm actions are available on packages: @@ -1422,10 +1644,10 @@ selecting an avy candidate. | Key Binding | Description | |-------------+----------------------------------------------------| +| ~SPC j b~ | go back to the previous location (before the jump) | | ~SPC j j~ | initiate avy jump char | | ~SPC j w~ | initiate avy jump word | | ~SPC j l~ | initiate avy jump line | -| ~SPC j u~ | go back to the previous location (before the jump) | **** ace-link mode Similar to =avy=, [[https://github.com/abo-abo/ace-link][ace-link]] allows one to jump to any link in @@ -1474,7 +1696,7 @@ The ~SPC j~ prefix is for jumping, joining and splitting. |-------------+-----------------------------------------------------------------------------------| | ~SPC j 0~ | go to the beginning of line (and set a mark at the previous location in the line) | | ~SPC j $~ | go to the end of line (and set a mark at the previous location in the line) | -| ~SPC j b~ | jump to a bookmark | +| ~SPC j b~ | undo a jump (go back to previous location) | | ~SPC j d~ | jump to a listing of the current directory | | ~SPC j D~ | jump to a listing of the current directory (other window) | | ~SPC j f~ | jump to the definition of the function around point | @@ -1484,8 +1706,7 @@ The ~SPC j~ prefix is for jumping, joining and splitting. | ~SPC j J~ | jump to a suite of two characters in the buffer (works as an evil motion) | | ~SPC j k~ | jump to next line and indent it using auto-indent rules | | ~SPC j l~ | jump to a line with avy (works as an evil motion) | -| ~SPC j u~ | undo a jump (go back to previous location) | -| ~SPC j U~ | jump to a URL in the current buffer | +| ~SPC j u~ | jump to a URL in the current buffer | | ~SPC j v~ | jump to the definition/declaration of the variable around point | | ~SPC j w~ | jump to a word in the current buffer (works as an evil motion) | @@ -1551,14 +1772,14 @@ Windows manipulation commands (start with ~w~): | ~SPC w w~ | cycle and focus between windows | | ~SPC w SPC~ | select window using [[https://github.com/abo-abo/ace-window][ace-window]] | -**** Window manipulation transient-state -A convenient window manipulation transient-state allows to perform most of the -actions listed above. The transient-state allows additional actions as well like +**** Window manipulation transient state +A convenient window manipulation transient state allows to perform most of the +actions listed above. The transient state allows additional actions as well like window resizing. | Key Binding | Description | |---------------+---------------------------------------------------------------| -| ~SPC w .~ | initiate transient-state | +| ~SPC w .~ | initiate transient state | | ~?~ | display the full documentation in minibuffer | | ~0~ | go to window number 0 | | ~1~ | go to window number 1 | @@ -1596,7 +1817,7 @@ window resizing. | ~v~ | vertical split | | ~V~ | horizontal split and focus new window | | ~w~ | focus other window | -| Any other key | leave the transient-state | +| Any other key | leave the transient state | **** Golden ratio If you resize windows like crazy you may want to give a try to [[https://github.com/roman/golden-ratio.el][golden-ratio]]. @@ -1636,17 +1857,17 @@ Buffer manipulation commands (start with ~b~): | ~SPC b Y~ | copy whole buffer to clipboard (useful when copying to a browser) | | ~z f~ | Make current function or comments visible in buffer as much as possible | -**** Buffers manipulation transient-state -A convenient buffer manipulation transient-state allows to quickly cycles through +**** Buffers manipulation transient state +A convenient buffer manipulation transient state allows to quickly cycles through the opened buffer and kill them. | Key Binding | Description | |---------------+-----------------------------------------------| -| ~SPC b .~ | initiate transient-state | +| ~SPC b .~ | initiate transient state | | ~K~ | kill current buffer | | ~n~ | go to next buffer (avoid special buffers) | | ~N~ | go to previous buffer (avoid special buffers) | -| Any other key | leave the transient-state | +| Any other key | leave the transient state | **** Special Buffers Unlike vim, emacs creates many buffers that most people do not need to see. Some @@ -1735,29 +1956,29 @@ Basic =ido= operations can be done with ~Ctrl~ key: | ~C-S-k~ or ~C-S-p~ | previous history element | | ~C-S-l~ | go to next directory | -*** Ido transient-state -Spacemacs defines a [[Transient-states][transient-state]] for =ido=. - -Initiate the transient-state with ~M-SPC~ or ~s-M-SPC~ while in an =ido= buffer. - -| Key Binding | Description | -|----------------------+-------------------------------------| -| ~M-SPC~ or ~s-M-SPC~ | initiate or leave the transient-state | -| ~?~ | display help | -| ~e~ | open dired | -| ~h~ | delete backward or parent directory | -| ~j~ | next match | -| ~J~ | sub directory | -| ~k~ | previous match | -| ~K~ | parent directory | -| ~l~ | select match | -| ~n~ | next directory in history | -| ~o~ | open in other window | -| ~p~ | previous directory in history | -| ~q~ | quit transient-state | -| ~s~ | open in a new horizontal split | -| ~t~ | open in other frame | -| ~v~ | open in a new vertical split | +*** Ido transient state +Spacemacs defines a [[Transient-states][transient state]] for =ido=. + +Initiate the transient state with ~M-SPC~ or ~s-M-SPC~ while in an =ido= buffer. + +| Key Binding | Description | +|----------------------+---------------------------------------| +| ~M-SPC~ or ~s-M-SPC~ | initiate or leave the transient state | +| ~?~ | display help | +| ~e~ | open dired | +| ~h~ | delete backward or parent directory | +| ~j~ | next match | +| ~J~ | sub directory | +| ~k~ | previous match | +| ~K~ | parent directory | +| ~l~ | select match | +| ~n~ | next directory in history | +| ~o~ | open in other window | +| ~p~ | previous directory in history | +| ~q~ | quit transient state | +| ~s~ | open in a new horizontal split | +| ~t~ | open in other frame | +| ~v~ | open in a new vertical split | *** NeoTree file tree Spacemacs provides a quick and simple way to navigate in an unknown project @@ -2067,7 +2288,7 @@ by pressing ~SPC s c~ or executing the ex command =:noh=. *** Highlight current symbol Spacemacs supports highlighting of the current symbol on demand (provided by -[[https://github.com/emacsmirror/auto-highlight-symbol][auto-highlight-symbol]] mode) and adds a transient-state to easily navigate and rename +[[https://github.com/emacsmirror/auto-highlight-symbol][auto-highlight-symbol]] mode) and adds a transient state to easily navigate and rename this symbol. It is also possible to change the range of the navigation on the fly to: @@ -2081,14 +2302,14 @@ Navigation between the highlighted symbols can be done with the commands: | Key Binding | Description | |-------------+------------------------------------------------------------------------------------| -| ~/~ | initiate navigation transient-state on current symbol and jump forwards | -| ~#~ | initiate navigation transient-state on current symbol and jump backwards | +| ~/~ | initiate navigation transient state on current symbol and jump forwards | +| ~#~ | initiate navigation transient state on current symbol and jump backwards | | ~SPC s e~ | edit all occurrences of the current symbol(/) | | ~SPC s h~ | highlight the current symbol and all its occurrence within the current range | | ~SPC s H~ | go to the last searched occurrence of the last highlighted symbol | | ~SPC t h a~ | toggle automatic highlight of symbol under point after =ahs-idle-interval= seconds | -In 'Spacemacs' highlight symbol transient-state: +In 'Spacemacs' highlight symbol transient state: | Key Binding | Description | |---------------+---------------------------------------------------------------| @@ -2099,12 +2320,12 @@ In 'Spacemacs' highlight symbol transient-state: | ~D~ | go to previous definition occurrence | | ~r~ | change range (=function=, =display area=, =whole buffer=) | | ~R~ | go to home occurrence (reset position to starting occurrence) | -| Any other key | leave the navigation transient-state | +| Any other key | leave the navigation transient state | (*) using [[https://github.com/tsdh/iedit][iedit]] or the default implementation of =auto-highlight-symbol= -The transient-state text in minibuffer display the following information: +The transient state text in minibuffer display the following information: #+BEGIN_EXAMPLE [6/11]* press (n/N) to navigate, (e) to edit, (r) to change range or (R) @@ -2127,7 +2348,7 @@ selection. It is pretty useful combined with the [[Region selection][expand-region]] bindings. *Note*: If the current state is not the =visual state= then pressing ~*~ uses -auto-highlight-symbol and its transient-state. +auto-highlight-symbol and its transient state. *** Listing symbols by semantic Use =helm-semantic-or-imenu= command from =Helm= to quickly navigate between the @@ -2152,10 +2373,10 @@ modifications to the buffer. ** Editing *** Paste text **** Paste Transient-state -The paste transient-state can be enabled by settings the variable +The paste transient state can be enabled by settings the variable =dotspacemacs-enable-paste-transient-state= to =t=. By default it is disabled. -When the transient-state is enabled, pressing ~p~ again will replace the pasted text +When the transient state is enabled, 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 @@ -2163,11 +2384,11 @@ 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= transient-state | -| ~p~ | in transient-state: replace paste text with the previously copied one | -| ~P~ | in transient-state: replace paste text with the next copied one | -| ~.~ | paste the same text and leave the transient-state | -| Any other key | leave the transient-state | +| ~p~ or ~P~ | paste the text before or after point and initiate the =paste= transient state | +| ~p~ | in transient state: replace paste text with the previously copied one | +| ~P~ | in transient state: replace paste text with the next copied one | +| ~.~ | paste the same text and leave the transient state | +| Any other key | leave the transient state | **** Auto-indent pasted text By default any pasted text will be auto-indented. To paste text un-indented use @@ -2180,57 +2401,57 @@ adding a major-mode to the variable =spacemacs-indent-sensitive-modes= in your *** Text manipulation commands Text related commands (start with ~x~): - | Key Binding | Description | - |-------------+---------------------------------------------------------------| - | ~SPC x a &~ | align region at & | - | ~SPC x a (~ | align region at ( | - | ~SPC x a )~ | align region at ) | - | ~SPC x a ​,​~ | align region at , | - | ~SPC x a .~ | align region at . (for numeric tables) | - | ~SPC x a :~ | align region at : | - | ~SPC x a ;~ | align region at ; | - | ~SPC x a =~ | align region at = | - | ~SPC x a a~ | align region (or guessed section) using default rules | - | ~SPC x a c~ | align current intendation region using default rules | - | ~SPC x a r~ | align region using user-specified regexp | - | ~SPC x a m~ | align region at arithmetic operators (+-*/) | - | ~SPC x a ¦~ | align region at ¦ | - | ~SPC x c~ | count the number of chars/words/lines in the selection region | - | ~SPC x d w~ | delete trailing whitespaces | - | ~SPC x g l~ | set languages used by translate commands | - | ~SPC x g t~ | translate current word using Google Translate | - | ~SPC x g T~ | reverse source and target languages | - | ~SPC x j c~ | set the justification to center | - | ~SPC x j f~ | set the justification to full | - | ~SPC x j l~ | set the justification to left | - | ~SPC x j n~ | set the justification to none | - | ~SPC x j r~ | set the justification to right | - | ~SPC x J~ | move down a line of text (enter transient-state) | - | ~SPC x K~ | move up a line of text (enter transient-state) | - | ~SPC x l s~ | sort lines | - | ~SPC x l u~ | uniquify lines | - | ~SPC x o~ | use avy to select a link in the frame and open it | - | ~SPC x O~ | use avy to select multiple links in the frame and open them | - | ~SPC x t c~ | swap (transpose) the current character with the previous one | - | ~SPC x t w~ | swap (transpose) the current word with the previous one | - | ~SPC x t l~ | swap (transpose) the current line with the previous one | - | ~SPC x u~ | set the selected text to lower case | - | ~SPC x U~ | set the selected text to upper case | - | ~SPC x w c~ | count the number of occurrences per word in the select region | - | ~SPC x w d~ | show dictionary entry of word from wordnik.com | +| Key Binding | Description | +|-------------+---------------------------------------------------------------| +| ~SPC x a &~ | align region at & | +| ~SPC x a (~ | align region at ( | +| ~SPC x a )~ | align region at ) | +| ~SPC x a ​,​~ | align region at , | +| ~SPC x a .~ | align region at . (for numeric tables) | +| ~SPC x a :~ | align region at : | +| ~SPC x a ;~ | align region at ; | +| ~SPC x a =~ | align region at = | +| ~SPC x a a~ | align region (or guessed section) using default rules | +| ~SPC x a c~ | align current intendation region using default rules | +| ~SPC x a r~ | align region using user-specified regexp | +| ~SPC x a m~ | align region at arithmetic operators (+-*/) | +| ~SPC x a ¦~ | align region at ¦ | +| ~SPC x c~ | count the number of chars/words/lines in the selection region | +| ~SPC x d w~ | delete trailing whitespaces | +| ~SPC x g l~ | set languages used by translate commands | +| ~SPC x g t~ | translate current word using Google Translate | +| ~SPC x g T~ | reverse source and target languages | +| ~SPC x j c~ | set the justification to center | +| ~SPC x j f~ | set the justification to full | +| ~SPC x j l~ | set the justification to left | +| ~SPC x j n~ | set the justification to none | +| ~SPC x j r~ | set the justification to right | +| ~SPC x J~ | move down a line of text (enter transient state) | +| ~SPC x K~ | move up a line of text (enter transient state) | +| ~SPC x l s~ | sort lines | +| ~SPC x l u~ | uniquify lines | +| ~SPC x o~ | use avy to select a link in the frame and open it | +| ~SPC x O~ | use avy to select multiple links in the frame and open them | +| ~SPC x t c~ | swap (transpose) the current character with the previous one | +| ~SPC x t w~ | swap (transpose) the current word with the previous one | +| ~SPC x t l~ | swap (transpose) the current line with the previous one | +| ~SPC x u~ | set the selected text to lower case | +| ~SPC x U~ | set the selected text to upper case | +| ~SPC x w c~ | count the number of occurrences per word in the select region | +| ~SPC x w d~ | show dictionary entry of word from wordnik.com | *** Text insertion commands Text insertion commands (start with ~i~): - | Key binding | Description | - |-------------+-----------------------------------------------------------------------| - | ~SPC i l l~ | insert lorem-ipsum list | - | ~SPC i l p~ | insert lorem-ipsum paragraph | - | ~SPC i l s~ | insert lorem-ipsum sentence | - | ~SPC i u~ | Search for Unicode characters and insert them into the active buffer. | - | ~SPC i U 1~ | insert UUIDv1 (use universal argument to insert with CID format) | - | ~SPC i U 4~ | insert UUIDv4 (use universal argument to insert with CID format) | - | ~SPC i U U~ | insert UUIDv4 (use universal argument to insert with CID format) | +| Key binding | Description | +|-------------+-----------------------------------------------------------------------| +| ~SPC i l l~ | insert lorem-ipsum list | +| ~SPC i l p~ | insert lorem-ipsum paragraph | +| ~SPC i l s~ | insert lorem-ipsum sentence | +| ~SPC i u~ | Search for Unicode characters and insert them into the active buffer. | +| ~SPC i U 1~ | insert UUIDv1 (use universal argument to insert with CID format) | +| ~SPC i U 4~ | insert UUIDv4 (use universal argument to insert with CID format) | +| ~SPC i U U~ | insert UUIDv4 (use universal argument to insert with CID format) | *** Smartparens Strict mode [[https://github.com/Fuco1/smartparens][Smartparens]] comes with a strict mode which prevents deletion of parenthesis if @@ -2250,17 +2471,17 @@ It is possible to enable it easily for /all programming modes/ with the variable **** Text The font size of the current buffer can be adjusted with the commands: -| Key Binding | Description | -|---------------+----------------------------------------------------------------------------| -| ~SPC z x +~ | scale up the font and initiate the font scaling transient-state | -| ~SPC z x =~ | scale up the font and initiate the font scaling transient-state | -| ~SPC z x -~ | scale down the font and initiate the font scaling transient-state | -| ~SPC z x 0~ | reset the font size (no scaling) and initiate the font scaling transient-state | -| ~+~ | increase the font size | -| ~=~ | increase the font size | -| ~-~ | decrease the font size | -| ~0~ | reset the font size | -| Any other key | leave the font scaling transient-state | +| Key Binding | Description | +|---------------+--------------------------------------------------------------------------------| +| ~SPC z x +~ | scale up the font and initiate the font scaling transient state | +| ~SPC z x =~ | scale up the font and initiate the font scaling transient state | +| ~SPC z x -~ | scale down the font and initiate the font scaling transient state | +| ~SPC z x 0~ | reset the font size (no scaling) and initiate the font scaling transient state | +| ~+~ | increase the font size | +| ~=~ | increase the font size | +| ~-~ | decrease the font size | +| ~0~ | reset the font size | +| Any other key | leave the font scaling transient state | Note that /only/ the text of the current buffer is scaled, the other buffers, the mode-line and the minibuffer are not affected. To zoom the whole content of @@ -2269,33 +2490,33 @@ a frame use the =zoom frame= bindings (see next section). **** Frame You can zoom in and out the whole content of the frame with the commands: -| Key Binding | Description | -|---------------+-------------------------------------------------------------------------| -| ~SPC z f +~ | zoom in the frame content and initiate the frame scaling transient-state | -| ~SPC z f =~ | zoom in the frame content and initiate the frame scaling transient-state | -| ~SPC z f -~ | zoom out the frame content and initiate the frame scaling transient-state | -| ~SPC z f 0~ | reset the frame content size and initiate the frame scaling transient-state | -| ~+~ | zoom in | -| ~=~ | zoom in | -| ~-~ | zoom out | -| ~0~ | reset zoom | -| Any other key | leave the zoom frame transient-state | +| Key Binding | Description | +|---------------+-----------------------------------------------------------------------------| +| ~SPC z f +~ | zoom in the frame content and initiate the frame scaling transient state | +| ~SPC z f =~ | zoom in the frame content and initiate the frame scaling transient state | +| ~SPC z f -~ | zoom out the frame content and initiate the frame scaling transient state | +| ~SPC z f 0~ | reset the frame content size and initiate the frame scaling transient state | +| ~+~ | zoom in | +| ~=~ | zoom in | +| ~-~ | zoom out | +| ~0~ | reset zoom | +| Any other key | leave the zoom frame transient state | *** Increase/Decrease numbers Spacemacs uses [[https://github.com/cofi/evil-numbers][evil-numbers]] to easily increase or increase numbers. -| Key Binding | Description | -|-------------+-----------------------------------------------------------------| -| ~SPC n +~ | increase the number under point by one and initiate transient-state | -| ~SPC n -~ | decrease the number under point by one and initiate transient-state | +| Key Binding | Description | +|-------------+---------------------------------------------------------------------| +| ~SPC n +~ | increase the number under point by one and initiate transient state | +| ~SPC n -~ | decrease the number under point by one and initiate transient state | -In transient-state: +In transient state: | Key Binding | Description | |---------------+----------------------------------------| | ~+~ | increase the number under point by one | | ~-~ | decrease the number under point by one | -| Any other key | leave the transient-state | +| Any other key | leave the transient state | *Tips:* you can increase or decrease a value by more that once by using a prefix argument (ie. ~10 SPC n +~ will add 10 to the number under point). @@ -2452,17 +2673,17 @@ It is possible to batch rename files in a directory using =wdired= from an *** Commenting Comments are handled by [[https://github.com/redguardtoo/evil-nerd-commenter][evil-nerd-commenter]], it's bound to the following keys. - | Key Binding | Description | - |-------------+---------------------------| - | ~SPC ;~ | comment operator | - | ~SPC c l~ | comment lines | - | ~SPC c L~ | invert comment lines | - | ~SPC c p~ | comment paragraphs | - | ~SPC c P~ | invert comment paragraphs | - | ~SPC c t~ | comment to line | - | ~SPC c T~ | invert comment to line | - | ~SPC c y~ | comment and yank | - | ~SPC c Y~ | invert comment and yank | +| Key Binding | Description | +|-------------+---------------------------| +| ~SPC ;~ | comment operator | +| ~SPC c l~ | comment lines | +| ~SPC c L~ | invert comment lines | +| ~SPC c p~ | comment paragraphs | +| ~SPC c P~ | invert comment paragraphs | +| ~SPC c t~ | comment to line | +| ~SPC c T~ | invert comment to line | +| ~SPC c y~ | comment and yank | +| ~SPC c Y~ | invert comment and yank | *Tips:* To comment efficiently a block of line use the combo ~SPC ; SPC y~ @@ -2565,6 +2786,13 @@ These commands automatically switch to =lisp state=. | ~SPC m t b~ | execute buffer tests | | ~SPC m t q~ | ask for test function to execute | +*** Mouse usage +There are some added mouse features set for the line number margin (if shown): + +- single click in line number margin visually selects the entire line +- drag across line number margin visually selects the region +- double click in line number margin visually select the current code block + ** Managing projects Projects in Spacemacs are managed with [[https://github.com/bbatsov/projectile][projectile]]. In =projectile= projects are defined implicitly, for instance the root of a project is found when a @@ -2576,36 +2804,36 @@ To search in a project see [[Searching in a project][project searching]]. =projectile= commands start with p: - | Key Binding | Description | - |-------------+---------------------------------------------------------| - | ~SPC p '​~ | open a shell in project's root (with the =shell= layer) | - | ~SPC p !~ | run shell command in project's root | - | ~SPC p &~ | run async shell command in project's root | - | ~SPC p a~ | toggle between implementation and test | - | ~SPC p b~ | switch to project buffer | - | ~SPC p c~ | compile project using =projectile= | - | ~SPC p d~ | find directory | - | ~SPC p D~ | open project root in =dired= | - | ~SPC p f~ | find file | - | ~SPC p F~ | find file based on path around point | - | ~SPC p G~ | regenerate the project's =etags= / =gtags= | - | ~SPC p h~ | find file using =helm= | - | ~SPC p I~ | invalidate the projectile cache | - | ~SPC p k~ | kill all project buffers | - | ~SPC p o~ | run =multi-occur= | - | ~SPC p p~ | switch project | - | ~SPC p r~ | open a recent file | - | ~SPC p R~ | replace a string | - | ~SPC p s~ | see [[Searching in a project][search in project]] | - | ~SPC p t~ | open =NeoTree= in =projectile= root | - | ~SPC p T~ | find test files | - | ~SPC p v~ | open project root in =vc-dir= or =magit= | - | ~SPC p y~ | find tags | - | ~SPC /~ | search in project with the best search tool available | - | ~SPC s a p~ | run =ag= | - | ~SPC s g p~ | run =grep= | - | ~SPC s k p~ | run =ack= | - | ~SPC s t p~ | run =pt= | +| Key Binding | Description | +|-------------+---------------------------------------------------------| +| ~SPC p '​~ | open a shell in project's root (with the =shell= layer) | +| ~SPC p !~ | run shell command in project's root | +| ~SPC p &~ | run async shell command in project's root | +| ~SPC p a~ | toggle between implementation and test | +| ~SPC p b~ | switch to project buffer | +| ~SPC p c~ | compile project using =projectile= | +| ~SPC p d~ | find directory | +| ~SPC p D~ | open project root in =dired= | +| ~SPC p f~ | find file | +| ~SPC p F~ | find file based on path around point | +| ~SPC p G~ | regenerate the project's =etags= / =gtags= | +| ~SPC p h~ | find file using =helm= | +| ~SPC p I~ | invalidate the projectile cache | +| ~SPC p k~ | kill all project buffers | +| ~SPC p o~ | run =multi-occur= | +| ~SPC p p~ | switch project | +| ~SPC p r~ | open a recent file | +| ~SPC p R~ | replace a string | +| ~SPC p s~ | see [[Searching in a project][search in project]] | +| ~SPC p t~ | open =NeoTree= in =projectile= root | +| ~SPC p T~ | find test files | +| ~SPC p v~ | open project root in =vc-dir= or =magit= | +| ~SPC p y~ | find tags | +| ~SPC /~ | search in project with the best search tool available | +| ~SPC s a p~ | run =ag= | +| ~SPC s g p~ | run =grep= | +| ~SPC s k p~ | run =ack= | +| ~SPC s t p~ | run =pt= | *Note for Windows Users*: To enable fast indexing the GNU ~find~ or Cygwin ~find~ must be in your ~PATH~. @@ -2626,15 +2854,15 @@ only performed at save time by default. Errors management commands (start with ~e~): - | Key Binding | Description | - |-------------+-----------------------------------------------------------------------| - | ~SPC t s~ | toggle flycheck | - | ~SPC e c~ | clear all errors | - | ~SPC e h~ | describe a flycheck checker | - | ~SPC e l~ | toggle the display of the =flycheck= list of errors/warnings | - | ~SPC e n~ | go to the next error | - | ~SPC e p~ | go to the previous error | - | ~SPC e v~ | verify flycheck setup (useful to debug 3rd party tools configuration) | +| Key Binding | Description | +|-------------+-----------------------------------------------------------------------| +| ~SPC t s~ | toggle flycheck | +| ~SPC e c~ | clear all errors | +| ~SPC e h~ | describe a flycheck checker | +| ~SPC e l~ | toggle the display of the =flycheck= list of errors/warnings | +| ~SPC e n~ | go to the next error | +| ~SPC e p~ | go to the previous error | +| ~SPC e v~ | verify flycheck setup (useful to debug 3rd party tools configuration) | Custom fringe bitmaps: diff --git a/doc/FAQ.org b/doc/FAQ.org index 3cf1619b20fc7..4f7b85bab1607 100644 --- a/doc/FAQ.org +++ b/doc/FAQ.org @@ -448,8 +448,9 @@ arguments of the =ag= program. * Windows ** Why do the fonts look crappy on Windows? -You can install [[https://code.google.com/p/mactype/][MacType]] on Windows to get very nice looking fonts. It is also -recommended to disable smooth scrolling on Windows. +You can install [[https://code.google.com/archive/p/gdipp/][GDIPP]] (simplest) or [[https://code.google.com/p/mactype/][MacType]] (more complete) on Windows to get +very nice looking fonts. It is also recommended to disable smooth scrolling on +Windows. ** Why is there no Spacemacs logo in the startup buffer? A GUI build of emacs supporting image display is required. You can follow the diff --git a/layers/+irc/erc/README.org b/layers/+chat/erc/README.org similarity index 100% rename from layers/+irc/erc/README.org rename to layers/+chat/erc/README.org diff --git a/layers/+irc/erc/config.el b/layers/+chat/erc/config.el similarity index 100% rename from layers/+irc/erc/config.el rename to layers/+chat/erc/config.el diff --git a/layers/+irc/erc/local/erc-sasl/erc-sasl.el b/layers/+chat/erc/local/erc-sasl/erc-sasl.el similarity index 100% rename from layers/+irc/erc/local/erc-sasl/erc-sasl.el rename to layers/+chat/erc/local/erc-sasl/erc-sasl.el diff --git a/layers/+irc/erc/local/erc-tex/erc-tex.el b/layers/+chat/erc/local/erc-tex/erc-tex.el similarity index 100% rename from layers/+irc/erc/local/erc-tex/erc-tex.el rename to layers/+chat/erc/local/erc-tex/erc-tex.el diff --git a/layers/+irc/erc/local/erc-yank/README.md b/layers/+chat/erc/local/erc-yank/README.md similarity index 100% rename from layers/+irc/erc/local/erc-yank/README.md rename to layers/+chat/erc/local/erc-yank/README.md diff --git a/layers/+irc/erc/local/erc-yank/erc-yank.el b/layers/+chat/erc/local/erc-yank/erc-yank.el similarity index 100% rename from layers/+irc/erc/local/erc-yank/erc-yank.el rename to layers/+chat/erc/local/erc-yank/erc-yank.el diff --git a/layers/+irc/erc/packages.el b/layers/+chat/erc/packages.el similarity index 100% rename from layers/+irc/erc/packages.el rename to layers/+chat/erc/packages.el diff --git a/layers/jabber/README.org b/layers/+chat/jabber/README.org similarity index 100% rename from layers/jabber/README.org rename to layers/+chat/jabber/README.org diff --git a/layers/jabber/img/attribution.md b/layers/+chat/jabber/img/attribution.md similarity index 100% rename from layers/jabber/img/attribution.md rename to layers/+chat/jabber/img/attribution.md diff --git a/layers/jabber/img/jabber-logo.gif b/layers/+chat/jabber/img/jabber-logo.gif similarity index 100% rename from layers/jabber/img/jabber-logo.gif rename to layers/+chat/jabber/img/jabber-logo.gif diff --git a/layers/jabber/packages.el b/layers/+chat/jabber/packages.el similarity index 100% rename from layers/jabber/packages.el rename to layers/+chat/jabber/packages.el diff --git a/layers/+irc/rcirc/README.org b/layers/+chat/rcirc/README.org similarity index 100% rename from layers/+irc/rcirc/README.org rename to layers/+chat/rcirc/README.org diff --git a/layers/+irc/rcirc/config.el b/layers/+chat/rcirc/config.el similarity index 100% rename from layers/+irc/rcirc/config.el rename to layers/+chat/rcirc/config.el diff --git a/layers/+irc/rcirc/funcs.el b/layers/+chat/rcirc/funcs.el similarity index 100% rename from layers/+irc/rcirc/funcs.el rename to layers/+chat/rcirc/funcs.el diff --git a/layers/+irc/rcirc/img/irc.png b/layers/+chat/rcirc/img/irc.png similarity index 100% rename from layers/+irc/rcirc/img/irc.png rename to layers/+chat/rcirc/img/irc.png diff --git a/layers/+irc/rcirc/local/helm-rcirc/README.md b/layers/+chat/rcirc/local/helm-rcirc/README.md similarity index 100% rename from layers/+irc/rcirc/local/helm-rcirc/README.md rename to layers/+chat/rcirc/local/helm-rcirc/README.md diff --git a/layers/+irc/rcirc/local/helm-rcirc/helm-rcirc.el b/layers/+chat/rcirc/local/helm-rcirc/helm-rcirc.el similarity index 100% rename from layers/+irc/rcirc/local/helm-rcirc/helm-rcirc.el rename to layers/+chat/rcirc/local/helm-rcirc/helm-rcirc.el diff --git a/layers/+irc/rcirc/local/rcirc-late-fix/rcirc-late-fix.el b/layers/+chat/rcirc/local/rcirc-late-fix/rcirc-late-fix.el similarity index 100% rename from layers/+irc/rcirc/local/rcirc-late-fix/rcirc-late-fix.el rename to layers/+chat/rcirc/local/rcirc-late-fix/rcirc-late-fix.el diff --git a/layers/+irc/rcirc/local/rcirc-reconnect/rcirc-reconnect.el b/layers/+chat/rcirc/local/rcirc-reconnect/rcirc-reconnect.el similarity index 100% rename from layers/+irc/rcirc/local/rcirc-reconnect/rcirc-reconnect.el rename to layers/+chat/rcirc/local/rcirc-reconnect/rcirc-reconnect.el diff --git a/layers/+irc/rcirc/packages.el b/layers/+chat/rcirc/packages.el similarity index 100% rename from layers/+irc/rcirc/packages.el rename to layers/+chat/rcirc/packages.el diff --git a/layers/spell-checking/README.org b/layers/+checkers/spell-checking/README.org similarity index 100% rename from layers/spell-checking/README.org rename to layers/+checkers/spell-checking/README.org diff --git a/layers/spell-checking/config.el b/layers/+checkers/spell-checking/config.el similarity index 100% rename from layers/spell-checking/config.el rename to layers/+checkers/spell-checking/config.el diff --git a/layers/spell-checking/funcs.el b/layers/+checkers/spell-checking/funcs.el similarity index 100% rename from layers/spell-checking/funcs.el rename to layers/+checkers/spell-checking/funcs.el diff --git a/layers/spell-checking/packages.el b/layers/+checkers/spell-checking/packages.el similarity index 100% rename from layers/spell-checking/packages.el rename to layers/+checkers/spell-checking/packages.el diff --git a/layers/syntax-checking/README.org b/layers/+checkers/syntax-checking/README.org similarity index 100% rename from layers/syntax-checking/README.org rename to layers/+checkers/syntax-checking/README.org diff --git a/layers/syntax-checking/config.el b/layers/+checkers/syntax-checking/config.el similarity index 100% rename from layers/syntax-checking/config.el rename to layers/+checkers/syntax-checking/config.el diff --git a/layers/syntax-checking/funcs.el b/layers/+checkers/syntax-checking/funcs.el similarity index 100% rename from layers/syntax-checking/funcs.el rename to layers/+checkers/syntax-checking/funcs.el diff --git a/layers/syntax-checking/img/flycheck.png b/layers/+checkers/syntax-checking/img/flycheck.png similarity index 100% rename from layers/syntax-checking/img/flycheck.png rename to layers/+checkers/syntax-checking/img/flycheck.png diff --git a/layers/syntax-checking/packages.el b/layers/+checkers/syntax-checking/packages.el similarity index 100% rename from layers/syntax-checking/packages.el rename to layers/+checkers/syntax-checking/packages.el diff --git a/layers/auto-completion/README.org b/layers/+completion/auto-completion/README.org similarity index 100% rename from layers/auto-completion/README.org rename to layers/+completion/auto-completion/README.org diff --git a/layers/auto-completion/config.el b/layers/+completion/auto-completion/config.el similarity index 100% rename from layers/auto-completion/config.el rename to layers/+completion/auto-completion/config.el diff --git a/layers/auto-completion/funcs.el b/layers/+completion/auto-completion/funcs.el similarity index 100% rename from layers/auto-completion/funcs.el rename to layers/+completion/auto-completion/funcs.el diff --git a/layers/auto-completion/packages.el b/layers/+completion/auto-completion/packages.el similarity index 100% rename from layers/auto-completion/packages.el rename to layers/+completion/auto-completion/packages.el diff --git a/layers/auto-completion/snippets/emacs-lisp-mode/.yas-parents b/layers/+completion/auto-completion/snippets/emacs-lisp-mode/.yas-parents similarity index 100% rename from layers/auto-completion/snippets/emacs-lisp-mode/.yas-parents rename to layers/+completion/auto-completion/snippets/emacs-lisp-mode/.yas-parents diff --git a/layers/auto-completion/snippets/emacs-lisp-mode/.yas-setup.el b/layers/+completion/auto-completion/snippets/emacs-lisp-mode/.yas-setup.el similarity index 100% rename from layers/auto-completion/snippets/emacs-lisp-mode/.yas-setup.el rename to layers/+completion/auto-completion/snippets/emacs-lisp-mode/.yas-setup.el diff --git a/layers/auto-completion/snippets/emacs-lisp-mode/micro-state b/layers/+completion/auto-completion/snippets/emacs-lisp-mode/micro-state similarity index 100% rename from layers/auto-completion/snippets/emacs-lisp-mode/micro-state rename to layers/+completion/auto-completion/snippets/emacs-lisp-mode/micro-state diff --git a/layers/auto-completion/snippets/emacs-lisp-mode/new-package b/layers/+completion/auto-completion/snippets/emacs-lisp-mode/new-package similarity index 100% rename from layers/auto-completion/snippets/emacs-lisp-mode/new-package rename to layers/+completion/auto-completion/snippets/emacs-lisp-mode/new-package diff --git a/layers/+completion/spacemacs-helm/local/helm-spacemacs-help/helm-spacemacs-help.el b/layers/+completion/spacemacs-helm/local/helm-spacemacs-help/helm-spacemacs-help.el index 9ba01fab38c10..c00b49aaf9e16 100644 --- a/layers/+completion/spacemacs-helm/local/helm-spacemacs-help/helm-spacemacs-help.el +++ b/layers/+completion/spacemacs-helm/local/helm-spacemacs-help/helm-spacemacs-help.el @@ -297,17 +297,8 @@ (defun helm-spacemacs-help//layer-action-install-layer (candidate-layer) "Add CANDIDATE-LAYER to dotspacemacs file and reloads configuration" - (if (configuration-layer/layer-usedp (intern candidate-layer)) - (message "Layer already installed. Not Doing Anything") - (let ((dotspacemacs (find-file-noselect (dotspacemacs/location)))) - (with-current-buffer dotspacemacs - (beginning-of-buffer) - (let ((insert-point (re-search-forward - "dotspacemacs-configuration-layers *\n?.*\\((\\)"))) - (insert (format "\n%s\n" candidate-layer)) - (indent-region insert-point (+ insert-point (length candidate-layer))) - (save-current-buffer))) - (dotspacemacs/sync-configuration-layers)))) + (when (dotspacemacs/add-layer (intern candidate-layer)) + (dotspacemacs/sync-configuration-layers))) (defun helm-spacemacs-help//layer-action-open-readme-edit (candidate) "Open the `README.org' file of the passed CANDIDATE for editing." diff --git a/layers/+completion/spacemacs-helm/packages.el b/layers/+completion/spacemacs-helm/packages.el index 9e227c8b4d2a3..ff37b812a98da 100644 --- a/layers/+completion/spacemacs-helm/packages.el +++ b/layers/+completion/spacemacs-helm/packages.el @@ -392,7 +392,9 @@ Removes the automatic guessing of the initial value based on thing at point. " (defun spacemacs//helm-hjkl-navigation (style) "Set navigation on 'hjkl' for the given editing STYLE." (cond - ((eq 'vim style) + ((or (eq 'vim style) + (and (eq 'hybrid style) + hybrid-mode-enable-hjkl-bindings)) (define-key helm-map (kbd "C-j") 'helm-next-line) (define-key helm-map (kbd "C-k") 'helm-previous-line) (define-key helm-map (kbd "C-h") 'helm-next-source) diff --git a/layers/+completion/spacemacs-ivy/packages.el b/layers/+completion/spacemacs-ivy/packages.el index 50e5830959952..3ebce1f5a0d51 100644 --- a/layers/+completion/spacemacs-ivy/packages.el +++ b/layers/+completion/spacemacs-ivy/packages.el @@ -379,7 +379,9 @@ Helm hack." (defun spacemacs//ivy-hjkl-navigation (style) "Set navigation on 'hjkl' for the given editing STYLE." (cond - ((eq 'vim style) + ((or (eq 'vim style) + (and (eq 'hybrid style) + hybrid-mode-enable-hjkl-bindings)) (define-key ivy-minibuffer-map (kbd "C-j") 'ivy-next-line) (define-key ivy-minibuffer-map (kbd "C-k") 'ivy-previous-line) (define-key ivy-minibuffer-map (kbd "C-h") (kbd "DEL")) diff --git a/layers/+config-files/nginx/README.org b/layers/+config-files/nginx/README.org new file mode 100644 index 0000000000000..9527b24357502 --- /dev/null +++ b/layers/+config-files/nginx/README.org @@ -0,0 +1,17 @@ +#+TITLE: nginx layer +#+HTML_HEAD_EXTRA: + +[[file:img/nginx.png]] + +* Table of Contents :TOC_4_org:noexport: + - [[Description][Description]] + - [[Install][Install]] + +* Description +[[https://github.com/ajc/nginx-mode][nginx-mode]] for editing [[http://nginx.org][nginx]] configuration files. +It adds basic syntax highlighting and syntax-aware tabbing. + +* Install +To use this configuration layer, add it to your =~/.spacemacs=. You will need to +add =nginx= to the existing =dotspacemacs-configuration-layers= list in this +file. diff --git a/layers/+config-files/nginx/img/nginx.png b/layers/+config-files/nginx/img/nginx.png new file mode 100644 index 0000000000000..6711c524ee92c Binary files /dev/null and b/layers/+config-files/nginx/img/nginx.png differ diff --git a/layers/+config-files/nginx/packages.el b/layers/+config-files/nginx/packages.el new file mode 100644 index 0000000000000..8e43d5fd28aff --- /dev/null +++ b/layers/+config-files/nginx/packages.el @@ -0,0 +1,15 @@ +;;; packages.el --- nginx layer packages file for Spacemacs. +;; +;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; +;; Author: Nathaniel Waisbrot +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + +(defconst nginx-packages '(nginx-mode)) + +(defun nginx/init-nginx-mode () + (use-package nginx-mode :defer t)) diff --git a/layers/+distribution/spacemacs-base/keybindings.el b/layers/+distribution/spacemacs-base/keybindings.el index eff0f34918473..ac34cafdcdb2f 100644 --- a/layers/+distribution/spacemacs-base/keybindings.el +++ b/layers/+distribution/spacemacs-base/keybindings.el @@ -135,7 +135,6 @@ (spacemacs/set-leader-keys "j0" 'spacemacs/push-mark-and-goto-beginning-of-line "j$" 'spacemacs/push-mark-and-goto-end-of-line - "jb" 'bookmark-jump "jd" 'dired-jump "jD" 'dired-jump-other-window "jf" 'find-function-at-point @@ -360,13 +359,6 @@ (evil-define-key 'insert comint-mode-map [up] 'comint-previous-input) (evil-define-key 'insert comint-mode-map [down] 'comint-next-input)) -;; ivy/helm keys -------------------------------------------------------------- - -(defvar spacemacs-editing-style-hook nil - "Hook run whenever an editing style is toggled. -Each function in the hook is run with a single argument which is the current -editing style.") - ;; --------------------------------------------------------------------------- ;; Transient-states ;; --------------------------------------------------------------------------- @@ -409,17 +401,15 @@ editing style.") (spacemacs|define-transient-state window-manipulation :title "Window Manipulation Transient State" - :doc - " -Select^^^^ Move^^^^ Split^^ Resize^^ Other^^ -------^^^^------------- -----^^^^------------ ------^^-------------- -------^^------------------- ------^^------------------- -[_j_/_k_] down/up [_J_/_K_] down/up [_s_] vertical [_[_] shrink horizontally [_q_] quit -[_h_/_l_] left/right [_H_/_L_] left/right [_S_] vert & follow [_]_] enlarge horizontally [_u_] restore prev layout -[_0_-_9_] window N [_R_]^^ rotate [_v_] horizontal [_{_] shrink vertically [_U_] restore next layout -[_w_]^^ other window ^^^^ [_V_] horiz & follow [_}_] enlarge vertically [_d_] close current -[_o_]^^ other frame ^^^^ ^^ ^^ [_D_] close other -^^^^ ^^^^ ^^ ^^ [_g_] golden-ratio %`golden-ratio-mode -" + :doc " + Select^^^^ Move^^^^ Split^^ Resize^^ Other^^ + ──────^^^^───────────── ────^^^^───────────── ─────^^─────────────── ──────^^──────────────────── ─────^^────────────────────────────── + [_j_/_k_] down/up [_J_/_K_] down/up [_s_] vertical [_[_] shrink horizontally [_q_] quit + [_h_/_l_] left/right [_H_/_L_] left/right [_S_] vert & follow [_]_] enlarge horizontally [_u_] restore prev layout + [_0_-_9_] window N [_R_]^^ rotate [_v_] horizontal [_{_] shrink vertically [_U_] restore next layout + [_w_]^^ other window ^^^^ [_V_] horiz & follow [_}_] enlarge vertically [_d_] close current + [_o_]^^ other frame ^^^^ ^^ ^^ [_D_] close other + ^^^^ ^^^^ ^^ ^^ [_g_] golden-ratio %`golden-ratio-mode" :bindings ("q" nil :exit t) ("0" select-window-0) diff --git a/layers/+spacemacs/spacemacs-editing-styles/local/evil-evilified-state/evil-evilified-state.el b/layers/+distribution/spacemacs-base/local/evil-evilified-state/evil-evilified-state.el similarity index 100% rename from layers/+spacemacs/spacemacs-editing-styles/local/evil-evilified-state/evil-evilified-state.el rename to layers/+distribution/spacemacs-base/local/evil-evilified-state/evil-evilified-state.el diff --git a/layers/+spacemacs/spacemacs-editing-styles/local/holy-mode/holy-mode.el b/layers/+distribution/spacemacs-base/local/holy-mode/holy-mode.el similarity index 88% rename from layers/+spacemacs/spacemacs-editing-styles/local/holy-mode/holy-mode.el rename to layers/+distribution/spacemacs-base/local/holy-mode/holy-mode.el index a9f6af27cec4a..c5ece18bafd8e 100644 --- a/layers/+spacemacs/spacemacs-editing-styles/local/holy-mode/holy-mode.el +++ b/layers/+distribution/spacemacs-base/local/holy-mode/holy-mode.el @@ -72,7 +72,7 @@ The `insert state' is replaced by the `emacs state'." ;; key bindings hooks for dynamic switching of editing styles (run-hook-with-args 'spacemacs-editing-style-hook 'emacs) ;; initiate `emacs state' and enter the church - (holy-mode//update-states-for-current-buffers)) + (holy-mode//update-states-for-current-buffers 'emacs)) (defun amen () "May the force be with you my son (or not)." @@ -88,19 +88,17 @@ The `insert state' is replaced by the `emacs state'." ;; restore key bindings (run-hook-with-args 'spacemacs-editing-style-hook 'vim) ;; restore the states - (holy-mode//update-states-for-current-buffers t)) + (holy-mode//update-states-for-current-buffers 'vim)) -(defun holy-mode//update-states-for-current-buffers (&optional arg) - "Update the active state in all current buffers. -ARG non nil means that the editing style is `vim'." +(defun holy-mode//update-states-for-current-buffers (style) + "Update the active state in all current buffers given current STYLE." (dolist (buffer (buffer-list)) (with-current-buffer buffer - ;; switch to holy-mode - (when (not arg) - (evil-emacs-state)) - ;; disable holy-mode - (when (and arg (eq 'emacs evil-state)) + (cond + ((eq 'emacs style) (evil-emacs-state)) + ((and (eq 'vim style) + (eq 'emacs evil-state)) (cond ((memq major-mode evil-evilified-state-modes) (evil-evilified-state)) ((memq major-mode evil-motion-state-modes) (evil-motion-state)) - (t (evil-normal-state))))))) + (t (evil-normal-state)))))))) diff --git a/layers/+distribution/spacemacs-base/local/hybrid-mode/hybrid-mode.el b/layers/+distribution/spacemacs-base/local/hybrid-mode/hybrid-mode.el new file mode 100644 index 0000000000000..646cc3d3193d9 --- /dev/null +++ b/layers/+distribution/spacemacs-base/local/hybrid-mode/hybrid-mode.el @@ -0,0 +1,161 @@ +;;; hybrid-mode.el --- Put one foot in the church of Emacs + +;; Copyright (C) 2012-2016 Sylvain Benner & Contributors +;; +;; Authors: Justin Burkett +;; Chris Ewald +;; Keywords: convenience editing +;; Created: 12 Aug 2015 +;; Version: 1.00 +;; Package-Requires: ((emacs "24") (evil "1.0.9")) +;; URL: https://github.com/syl20bnr/spacemacs + +;; This file is not part of GNU Emacs. + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;;; Code: + +(require 'evil) + +(defvar hybrid-mode-enable-hjkl-bindings) + +(defcustom hybrid-mode-default-state 'normal + "Value of `evil-default-state' for hybrid-mode." + :group 'spacemacs + :type 'symbol) + +(defcustom hybrid-mode-enable-hjkl-bindings nil + "If non nil then packages configuration should enable hjkl navigation." + :group 'spacemacs + :type 'boolean) + +(defcustom hybrid-mode-enable-evilified-state nil + "If non nil then evilified states is enabled in buffer supporting it." + :group 'spacemacs + :type 'boolean) + +(defvar hybrid-mode-default-state-backup evil-default-state + "Backup of `evil-default-state'.") + +(defadvice evil-insert-state (around hybrid-insert-to-hybrid-state disable) + "Forces Hybrid state." + (evil-hybrid-state)) + +(defadvice evil-evilified-state (around hybrid-evilified-to-hybrid-state disable) + "Forces Hybrid state." + (if (equal -1 (ad-get-arg 0)) + ad-do-it + (if hybrid-mode-enable-evilified-state + ad-do-it + ;; seems better to set the emacs state instead of hybrid for evilified + ;; buffers + (evil-emacs-state)))) + +;;;###autoload +(define-minor-mode hybrid-mode + "Global minor mode to replace insert state by hybrid state." + :global t + :lighter " hybrid" + :group 'spacemacs + (if hybrid-mode + (enable-hybrid-editing-style) + (disable-hybrid-editing-style))) + +(defun enable-hybrid-editing-style () + "Enable the hybrid editing style." + (setq hybrid-mode-default-state-backup evil-default-state + evil-default-state hybrid-mode-default-state) + ;; replace evil states by `hybrid state' + (ad-enable-advice 'evil-insert-state + 'around 'hybrid-insert-to-hybrid-state) + (ad-enable-advice 'evil-evilified-state + 'around 'hybrid-evilified-to-hybrid-state) + (ad-activate 'evil-insert-state) + (ad-activate 'evil-evilified-state) + ;; key bindings hooks for dynamic switching of editing styles + (run-hook-with-args 'spacemacs-editing-style-hook 'hybrid) + ;; initiate `hybrid state' + (hybrid-mode//update-states-for-current-buffers 'hybrid)) + +(defun disable-hybrid-editing-style () + "Disable the hybrid editing style (reverting to 'vim style)." + (setq evil-default-state hybrid-mode-default-state-backup) + ;; restore evil states + (ad-disable-advice 'evil-insert-state + 'around 'hybrid-insert-to-hybrid-state) + (ad-disable-advice 'evil-evilified-state + 'around 'hybrid-evilified-to-hybrid-state) + (ad-activate 'evil-insert-state) + (ad-activate 'evil-evilified-state) + ;; restore key bindings + (run-hook-with-args 'spacemacs-editing-style-hook 'vim) + ;; restore the states + (hybrid-mode//update-states-for-current-buffers 'vim)) + +;; This code is from evil insert state definition, any change upstream +;; should be reflected here +;; see https://bitbucket.org/lyro/evil/src/a25b848c90c7942fe89d9ec283c6bb44fb7b3cf4/evil-states.el?fileviewer=file-view-default#evil-states.el-74 +(evil-define-state hybrid + "Hybrid state for hybrid mode." + :tag " " + :cursor (bar . 2) + :message "-- HYBRID --" + :entry-hook (evil-start-track-last-insertion) + :exit-hook (evil-cleanup-insert-state evil-stop-track-last-insertion) + :input-method t + (cond + ((evil-hybrid-state-p) + (add-hook 'pre-command-hook #'evil-insert-repeat-hook) + (unless (eq evil-want-fine-undo t) + (evil-start-undo-step t))) + (t + (remove-hook 'pre-command-hook #'evil-insert-repeat-hook) + (setq evil-insert-repeat-info evil-repeat-info) + (evil-set-marker ?^ nil t) + (unless (eq evil-want-fine-undo t) + (evil-end-undo-step t (eq evil-want-fine-undo 'fine))) + (when evil-move-cursor-back + (when (or (evil-normal-state-p evil-next-state) + (evil-motion-state-p evil-next-state)) + (evil-move-cursor-back)))))) + +(define-key evil-hybrid-state-map [escape] 'evil-normal-state) + +;; Override stock evil function `evil-insert-state-p' +(defun evil-insert-state-p (&optional state) + "Whether the current state is insert." + (and evil-local-mode + (memq (or state evil-state) '(insert hybrid)))) + +(defun hybrid-mode//update-states-for-current-buffers (style) + "Update the active state in all current buffers given current STYLE." + (dolist (buffer (buffer-list)) + (with-current-buffer buffer + (cond + ((eq 'hybrid style) + (if (memq major-mode evil-evilified-state-modes) + (evil-evilified-state) + (funcall (intern (format "evil-%S-state" + hybrid-mode-default-state))))) + ((and (eq 'vim style) + (memq evil-state '(hybrid emacs))) + (cond + ((memq major-mode evil-evilified-state-modes) (evil-evilified-state)) + ((memq major-mode evil-motion-state-modes) (evil-motion-state)) + (t (evil-normal-state)))))))) + +(provide 'hybrid-mode) diff --git a/layers/+distribution/spacemacs-base/packages.el b/layers/+distribution/spacemacs-base/packages.el index e112520de9c77..64298fceb03a4 100644 --- a/layers/+distribution/spacemacs-base/packages.el +++ b/layers/+distribution/spacemacs-base/packages.el @@ -21,7 +21,7 @@ evil evil-ediff evil-escape - ;; evil-leader + (evil-evilified-state :location local :step pre :protected t) evil-surround evil-visualstar exec-path-from-shell @@ -391,7 +391,7 @@ below. Anything else exits." ;; define text-object for entire buffer (evil-define-text-object evil-inner-buffer (count &optional beg end type) - (evil-select-paren "\\`" "\\'" beg end type count nil)) + (list (point-min) (point-max))) (define-key evil-inner-text-objects-map "g" 'evil-inner-buffer) ;; support smart 1parens-strict-mode @@ -416,6 +416,11 @@ below. Anything else exits." :init (evil-escape-mode) :config (spacemacs|hide-lighter evil-escape-mode))) +(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)) + (defun spacemacs-base/init-evil-surround () (use-package evil-surround :init @@ -481,6 +486,38 @@ below. Anything else exits." (spacemacs|hide-lighter hs-minor-mode))) (add-hook 'prog-mode-hook 'spacemacs//enable-hs-minor-mode)) +(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")))) + (defun spacemacs-base/init-hydra () (use-package hydra :init diff --git a/layers/+distribution/spacemacs/config.el b/layers/+distribution/spacemacs/config.el index 9dabd9b0bf07d..9b891613a9420 100644 --- a/layers/+distribution/spacemacs/config.el +++ b/layers/+distribution/spacemacs/config.el @@ -14,7 +14,6 @@ (configuration-layer/declare-layers '(spacemacs-base spacemacs-layouts spacemacs-editing - spacemacs-editing-styles spacemacs-editing-visual spacemacs-evil spacemacs-language diff --git a/layers/better-defaults/README.org b/layers/+emacs/better-defaults/README.org similarity index 100% rename from layers/better-defaults/README.org rename to layers/+emacs/better-defaults/README.org diff --git a/layers/better-defaults/funcs.el b/layers/+emacs/better-defaults/funcs.el similarity index 100% rename from layers/better-defaults/funcs.el rename to layers/+emacs/better-defaults/funcs.el diff --git a/layers/better-defaults/img/emacs.png b/layers/+emacs/better-defaults/img/emacs.png similarity index 100% rename from layers/better-defaults/img/emacs.png rename to layers/+emacs/better-defaults/img/emacs.png diff --git a/layers/better-defaults/keybindings.el b/layers/+emacs/better-defaults/keybindings.el similarity index 100% rename from layers/better-defaults/keybindings.el rename to layers/+emacs/better-defaults/keybindings.el diff --git a/layers/ibuffer/README.org b/layers/+emacs/ibuffer/README.org similarity index 100% rename from layers/ibuffer/README.org rename to layers/+emacs/ibuffer/README.org diff --git a/layers/ibuffer/config.el b/layers/+emacs/ibuffer/config.el similarity index 100% rename from layers/ibuffer/config.el rename to layers/+emacs/ibuffer/config.el diff --git a/layers/ibuffer/funcs.el b/layers/+emacs/ibuffer/funcs.el similarity index 100% rename from layers/ibuffer/funcs.el rename to layers/+emacs/ibuffer/funcs.el diff --git a/layers/ibuffer/packages.el b/layers/+emacs/ibuffer/packages.el similarity index 100% rename from layers/ibuffer/packages.el rename to layers/+emacs/ibuffer/packages.el diff --git a/layers/org/README.org b/layers/+emacs/org/README.org similarity index 100% rename from layers/org/README.org rename to layers/+emacs/org/README.org diff --git a/layers/org/config.el b/layers/+emacs/org/config.el similarity index 100% rename from layers/org/config.el rename to layers/+emacs/org/config.el diff --git a/layers/org/img/org.png b/layers/+emacs/org/img/org.png similarity index 100% rename from layers/org/img/org.png rename to layers/+emacs/org/img/org.png diff --git a/layers/org/local/evil-org/evil-org.el b/layers/+emacs/org/local/evil-org/evil-org.el similarity index 100% rename from layers/org/local/evil-org/evil-org.el rename to layers/+emacs/org/local/evil-org/evil-org.el diff --git a/layers/org/local/ox-gfm/ox-gfm.el b/layers/+emacs/org/local/ox-gfm/ox-gfm.el similarity index 100% rename from layers/org/local/ox-gfm/ox-gfm.el rename to layers/+emacs/org/local/ox-gfm/ox-gfm.el diff --git a/layers/org/org-async-init.el b/layers/+emacs/org/org-async-init.el similarity index 100% rename from layers/org/org-async-init.el rename to layers/+emacs/org/org-async-init.el diff --git a/layers/org/packages.el b/layers/+emacs/org/packages.el similarity index 92% rename from layers/org/packages.el rename to layers/+emacs/org/packages.el index e1f651676c7de..afb000e7fc4a4 100644 --- a/layers/org/packages.el +++ b/layers/+emacs/org/packages.el @@ -20,7 +20,8 @@ gnuplot htmlize mu4e - ;; org and org-agenda are installed by `org-plus-contrib' + ;; ob, org and org-agenda are installed by `org-plus-contrib' + (ob :location built-in) (org :location built-in) (org-agenda :location built-in) (org-plus-contrib :step pre) @@ -84,6 +85,17 @@ ;; dummy init function to force installation of `org-plus-contrib' (defun org/init-org-plus-contrib ()) +(defun org/init-ob () + (use-package ob + :defer t + :init + (progn + (defun spacemacs//org-babel-do-load-languages () + "Load all the languages declared in `org-babel-load-languages'." + (org-babel-do-load-languages 'org-babel-load-languages + org-babel-load-languages)) + (add-hook 'org-mode-hook 'spacemacs//org-babel-do-load-languages)))) + (defun org/init-org () (use-package org :mode ("\\.org$" . org-mode) @@ -288,29 +300,38 @@ Will work on both org-mode and any mode that accepts plain html." ;; `dotspacemacs-major-mode-emacs-leader-key' to `C-c' and the key binding ;; C-c ' is shadowed by `spacemacs/default-pop-shell', effectively making ;; the Emacs user unable to exit src block editing. - (define-key org-src-mode-map (kbd (concat dotspacemacs-major-mode-emacs-leader-key " '")) 'org-edit-src-exit) + (define-key org-src-mode-map + (kbd (concat dotspacemacs-major-mode-emacs-leader-key " '")) + 'org-edit-src-exit) - (spacemacs/set-leader-keys - "Cc" 'org-capture) + (spacemacs/set-leader-keys "Cc" 'org-capture) ;; Evilify the calendar tool on C-c . (unless (eq 'emacs dotspacemacs-editing-style) (define-key org-read-date-minibuffer-local-map (kbd "M-h") - (lambda () (interactive) (org-eval-in-calendar '(calendar-backward-day 1)))) + (lambda () (interactive) + (org-eval-in-calendar '(calendar-backward-day 1)))) (define-key org-read-date-minibuffer-local-map (kbd "M-l") - (lambda () (interactive) (org-eval-in-calendar '(calendar-forward-day 1)))) + (lambda () (interactive) + (org-eval-in-calendar '(calendar-forward-day 1)))) (define-key org-read-date-minibuffer-local-map (kbd "M-k") - (lambda () (interactive) (org-eval-in-calendar '(calendar-backward-week 1)))) + (lambda () (interactive) + (org-eval-in-calendar '(calendar-backward-week 1)))) (define-key org-read-date-minibuffer-local-map (kbd "M-j") - (lambda () (interactive) (org-eval-in-calendar '(calendar-forward-week 1)))) + (lambda () (interactive) + (org-eval-in-calendar '(calendar-forward-week 1)))) (define-key org-read-date-minibuffer-local-map (kbd "M-H") - (lambda () (interactive) (org-eval-in-calendar '(calendar-backward-month 1)))) + (lambda () (interactive) + (org-eval-in-calendar '(calendar-backward-month 1)))) (define-key org-read-date-minibuffer-local-map (kbd "M-L") - (lambda () (interactive) (org-eval-in-calendar '(calendar-forward-month 1)))) + (lambda () (interactive) + (org-eval-in-calendar '(calendar-forward-month 1)))) (define-key org-read-date-minibuffer-local-map (kbd "M-K") - (lambda () (interactive) (org-eval-in-calendar '(calendar-backward-year 1)))) + (lambda () (interactive) + (org-eval-in-calendar '(calendar-backward-year 1)))) (define-key org-read-date-minibuffer-local-map (kbd "M-J") - (lambda () (interactive) (org-eval-in-calendar '(calendar-forward-year 1)))))))) + (lambda () (interactive) + (org-eval-in-calendar '(calendar-forward-year 1)))))))) (defun org/init-org-agenda () (use-package org-agenda diff --git a/layers/semantic/README.org b/layers/+emacs/semantic/README.org similarity index 100% rename from layers/semantic/README.org rename to layers/+emacs/semantic/README.org diff --git a/layers/semantic/packages.el b/layers/+emacs/semantic/packages.el similarity index 100% rename from layers/semantic/packages.el rename to layers/+emacs/semantic/packages.el diff --git a/layers/smex/README.org b/layers/+emacs/smex/README.org similarity index 100% rename from layers/smex/README.org rename to layers/+emacs/smex/README.org diff --git a/layers/smex/img/smex.png b/layers/+emacs/smex/img/smex.png similarity index 100% rename from layers/smex/img/smex.png rename to layers/+emacs/smex/img/smex.png diff --git a/layers/smex/packages.el b/layers/+emacs/smex/packages.el similarity index 100% rename from layers/smex/packages.el rename to layers/+emacs/smex/packages.el diff --git a/layers/typography/README.org b/layers/+emacs/typography/README.org similarity index 100% rename from layers/typography/README.org rename to layers/+emacs/typography/README.org diff --git a/layers/typography/config.el b/layers/+emacs/typography/config.el similarity index 100% rename from layers/typography/config.el rename to layers/+emacs/typography/config.el diff --git a/layers/typography/packages.el b/layers/+emacs/typography/packages.el similarity index 100% rename from layers/typography/packages.el rename to layers/+emacs/typography/packages.el diff --git a/layers/chinese/README.org b/layers/+intl/chinese/README.org similarity index 100% rename from layers/chinese/README.org rename to layers/+intl/chinese/README.org diff --git a/layers/chinese/config.el b/layers/+intl/chinese/config.el similarity index 100% rename from layers/chinese/config.el rename to layers/+intl/chinese/config.el diff --git a/layers/chinese/img/China.png b/layers/+intl/chinese/img/China.png similarity index 100% rename from layers/chinese/img/China.png rename to layers/+intl/chinese/img/China.png diff --git a/layers/chinese/img/Chinese.png b/layers/+intl/chinese/img/Chinese.png similarity index 100% rename from layers/chinese/img/Chinese.png rename to layers/+intl/chinese/img/Chinese.png diff --git a/layers/chinese/packages.el b/layers/+intl/chinese/packages.el similarity index 100% rename from layers/chinese/packages.el rename to layers/+intl/chinese/packages.el diff --git a/layers/+lang/elixir/config.el b/layers/+lang/elixir/config.el index f67395491e1b0..e3655573f8f24 100644 --- a/layers/+lang/elixir/config.el +++ b/layers/+lang/elixir/config.el @@ -11,8 +11,5 @@ ;; Variables -(configuration-layer/lazy-install 'elixir - :extensions '("\\.\\(ex\\|exs\\|elixir\\)\\'" elixir-mode)) - (spacemacs|defvar-company-backends elixir-mode) (spacemacs|defvar-company-backends alchemist-iex-mode) diff --git a/layers/+lang/extra-langs/README.org b/layers/+lang/extra-langs/README.org index 8dd347503d333..15e48cd146075 100644 --- a/layers/+lang/extra-langs/README.org +++ b/layers/+lang/extra-langs/README.org @@ -10,7 +10,6 @@ Adds many more language modes for less common languages, some more niche than ot These include: - Arduino -- Faust - Julia - MATLAB - QML diff --git a/layers/+lang/extra-langs/packages.el b/layers/+lang/extra-langs/packages.el index 30da135bebad6..208236e4469bf 100644 --- a/layers/+lang/extra-langs/packages.el +++ b/layers/+lang/extra-langs/packages.el @@ -2,7 +2,6 @@ '( arduino-mode julia-mode - faust-mode matlab-mode qml-mode scad-mode @@ -14,9 +13,6 @@ (defun extra-langs/init-arduino-mode () (use-package arduino-mode :defer t)) -(defun extra-langs/init-faust-mode () - (use-package faust-mode :defer t :mode "\\.\\(dsp\\|lib\\)\\'")) - (defun extra-langs/init-scad-mode () (use-package scad-mode :defer t)) diff --git a/layers/+lang/faust/README.org b/layers/+lang/faust/README.org new file mode 100644 index 0000000000000..c4ef7c52fbf10 --- /dev/null +++ b/layers/+lang/faust/README.org @@ -0,0 +1,28 @@ +#+TITLE: faust layer +#+HTML_HEAD_EXTRA: + +[[img/faust.png]] + +* Table of Contents :TOC_4_org:noexport: + - [[Description][Description]] + - [[Install][Install]] + - [[Key bindings][Key bindings]] + +* Description +This simple layer adds support for the [[http://faust.grame.fr/][faust language]]. +It adds =faust-mode= as well as integrating it with =auto-completion= layer. + +* Install +To use this configuration layer, add it to your =~/.spacemacs=. You will need to +add =faust= to the existing =dotspacemacs-configuration-layers= list in this +file. + +* Key bindings + +| Key Binding | Description | +|-------------+---------------------------------------| +| ~SPC m c f~ | Compile to SVG and open in Firefox | +| ~SPC m c g~ | Compile a jack-gtk program and run it | +| ~SPC m c q~ | Compile a jack-qt program and run it | +| ~SPC m g b~ | Jump back to previous location | +| ~SPC m g g~ | Jump to definition around point | diff --git a/layers/+lang/faust/config.el b/layers/+lang/faust/config.el new file mode 100644 index 0000000000000..494fa61b044c7 --- /dev/null +++ b/layers/+lang/faust/config.el @@ -0,0 +1,14 @@ +;;; config.el --- faust Layer configuration File for Spacemacs +;; +;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; +;; Author: Bart Brouns +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + +;; Variables + +(spacemacs|defvar-company-backends faust-mode) diff --git a/layers/+lang/faust/funcs.el b/layers/+lang/faust/funcs.el new file mode 100644 index 0000000000000..2accd4f6d8140 --- /dev/null +++ b/layers/+lang/faust/funcs.el @@ -0,0 +1,45 @@ +;;; funcs.el -- Faust Layer functions File for Spacemacs +;; +;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; +;; Author: Sylvain Benner +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + +(defun spacemacs/faust-to-firefox () + "Compile a block-diagram and show it in the browser." + (interactive) + (set-process-sentinel + (start-process-shell-command "faust2svg" "faust-compile" + (concat "faust2svg " buffer-file-name)) + 'spacemacs//faust2svg-sentinel)) + +(defun spacemacs/faust-to-jack-gtk () + "Compile a jack-gtk program and run it." + (interactive) + (set-process-sentinel + (start-process-shell-command "faust2jack" "faust-compile" + (concat "faust2jack " buffer-file-name)) + 'spacemacs//faust-run-sentinel)) + +(defun spacemacs/faust-to-jack-qt () + "Compile a jack-qt program and run it." + (interactive) + (set-process-sentinel + (start-process-shell-command "faust2jaqt" "faust-compile" + (concat "faust2jaqt " buffer-file-name)) + 'spacemacs//faust-run-sentinel)) + +(defun spacemacs//faust2svg-sentinel (process event) + "Show block-diagram in browser" + (browse-url-of-file (concat (file-name-sans-extension buffer-file-name) + "-svg/process.svg"))) + +(defun spacemacs//faust-run-sentinel (process event) + "Run the program" + (start-process-shell-command "faust-run" nil + (file-name-sans-extension (buffer-file-name))) + (switch-to-buffer-other-window "faust-compile")) diff --git a/layers/+lang/faust/img/faust.png b/layers/+lang/faust/img/faust.png new file mode 100644 index 0000000000000..c722ddcf04236 Binary files /dev/null and b/layers/+lang/faust/img/faust.png differ diff --git a/layers/+lang/faust/packages.el b/layers/+lang/faust/packages.el new file mode 100644 index 0000000000000..6d192024d0afc --- /dev/null +++ b/layers/+lang/faust/packages.el @@ -0,0 +1,44 @@ +;;; packages.el --- faust layer packages file for Spacemacs. +;; +;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; +;; Author: Bart Brouns +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + +;;; Code: + +(defconst faust-packages + '(company + dumb-jump + faust-mode + yasnippet)) + +(defun faust/post-init-company () + (spacemacs|add-company-hook faust-mode)) + +;; Consider to move this package somewhere else if we use it for other languages. +(defun faust/init-dumb-jump () + (use-package dumb-jump + :defer t + :init + (progn + (add-hook 'faust-mode-hook 'dumb-jump-mode) + (spacemacs/set-leader-keys-for-major-mode 'faust-mode + "gb" 'dumb-jump-back + "gg" 'dumb-jump-go)))) + +(defun faust/init-faust-mode () + (use-package faust-mode + :defer t + :mode "\\.\\(dsp\\|lib\\)\\'" + :init (spacemacs/set-leader-keys-for-major-mode 'faust-mode + "cf" 'spacemacs/faust-to-firefox + "cg" 'spacemacs/faust-to-jack-gtk + "cq" 'spacemacs/faust-to-jack-qt))) + +(defun faust/post-init-yasnippet () + (add-hook 'faust-mode-hook 'spacemacs/load-yasnippet)) diff --git a/layers/+lang/graphviz/README.org b/layers/+lang/graphviz/README.org new file mode 100644 index 0000000000000..18e4f943cc1a2 --- /dev/null +++ b/layers/+lang/graphviz/README.org @@ -0,0 +1,34 @@ +#+TITLE: graphviz layer +#+HTML_HEAD_EXTRA: + +[[file:img/graphviz.png]] + +* Table of Contents :TOC_4_org:noexport: + - [[Description][Description]] + - [[Install][Install]] + - [[Configuration][Configuration]] + - [[Key bindings][Key bindings]] + +* Description +This contains a forked version of [[https://github.com/ppareit/graphviz-dot-mode][graphviz-dot-mode]] that enables a live-reload +type work flow for editing `.dot` files. When live-preview is enabled, saving +the file will automatically trigger a compilation and reload of the image buffer +associated with the file. + +* Install +To use this configuration layer, add it to your =~/.spacemacs=. You will need to +add =graphviz= to the existing =dotspacemacs-configuration-layers= list in this +file. + +* Configuration +If the live preview is not always updating the rendered image properly, you can +try to adjust the value of =graphviz-dot-revert-delay= higher to give the +compiler more time to finish generating the file before reverting the buffer. + +* Key bindings +| Key Binding | Description | +|-------------+--------------------------------------| +| ~ m ,~ | Preview file | +| ~ m =~ | Indent graph | +| ~ m t~ | Toggle live-preview | +| ~ m c~ | Set compile command and compile file | diff --git a/layers/+lang/graphviz/img/graphviz.png b/layers/+lang/graphviz/img/graphviz.png new file mode 100644 index 0000000000000..2d452a4f6d129 Binary files /dev/null and b/layers/+lang/graphviz/img/graphviz.png differ diff --git a/layers/+lang/graphviz/packages.el b/layers/+lang/graphviz/packages.el new file mode 100644 index 0000000000000..e7a13b3d6f9b8 --- /dev/null +++ b/layers/+lang/graphviz/packages.el @@ -0,0 +1,49 @@ +;;; packages.el --- graphviz layer packages file for Spacemacs. +;; +;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; +;; Author: luxbock +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + +(defconst graphviz-packages + '((graphviz-dot-mode :location (recipe :fetcher github + :repo "luxbock/graphviz-dot-mode")) + smartparens)) + +(defun graphviz/init-graphviz-dot-mode () + (use-package graphviz-dot-mode + :mode (("\\.diag\\'" . graphviz-dot-mode) + ("\\.blockdiag\\'" . graphviz-dot-mode) + ("\\.nwdiag\\'" . graphviz-dot-mode) + ("\\.rackdiag\\'" . graphviz-dot-mode) + ("\\.dot\\'" . graphviz-dot-mode) + ("\\.gv\\'" . graphviz-dot-mode)) + :config + (progn + (spacemacs|add-toggle graphviz-live-reload + :status graphviz-dot-auto-preview-on-save + :on (graphviz-turn-on-live-preview) + :off (graphviz-turn-off-live-preview) + :documentation "Enable Graphviz live reload.") + (spacemacs/set-leader-keys-for-major-mode 'graphviz-dot-mode + "=" 'graphviz-dot-indent-graph + "c" 'compile + "t" 'spacemacs/toggle-graphviz-live-reload) + (when dotspacemacs-major-mode-emacs-leader-key + (spacemacs/set-leader-keys-for-major-mode 'graphviz-dot-mode + dotspacemacs-major-mode-emacs-leader-key 'graphviz-dot-preview)) + (when dotspacemacs-major-mode-leader-key + (spacemacs/set-leader-keys-for-major-mode 'graphviz-dot-mode + dotspacemacs-major-mode-leader-key 'graphviz-dot-preview))))) + +(defun graphviz/post-init-smartparens () + (spacemacs|use-package-add-hook graphviz-dot-mode + :post-config + (progn + ;; allow smartparens to work properly + (define-key graphviz-dot-mode-map "{" nil) + (define-key graphviz-dot-mode-map "}" nil)))) diff --git a/layers/+lang/plantuml/packages-config.el b/layers/+lang/plantuml/packages-config.el deleted file mode 100644 index 90a54cfb95241..0000000000000 --- a/layers/+lang/plantuml/packages-config.el +++ /dev/null @@ -1,20 +0,0 @@ -;;; packages-config.el --- plantuml layer packages file for Spacemacs. -;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors -;; -;; Author: Robert O'Connor -;; URL: https://github.com/robbyoconnor -;; -;; This file is not part of GNU Emacs. -;; -;;; License: GPLv3 - -;;; Commentary: - -;;; Code: - -(defconst plantuml-packages - '(org - puml-mode)) - -;;; packages-config.el ends here diff --git a/layers/+lang/plantuml/packages.el b/layers/+lang/plantuml/packages.el index 463b2f3430cd2..47cd4de3357e9 100644 --- a/layers/+lang/plantuml/packages.el +++ b/layers/+lang/plantuml/packages.el @@ -9,25 +9,19 @@ ;; ;;; License: GPLv3 -;;; Commentary: +(defconst plantuml-packages + '(org + puml-mode)) -;;; Code: +(defun plantuml/post-init-org () + (spacemacs|use-package-add-hook org + :post-config (add-to-list 'org-babel-load-languages '(plantuml . t)))) (defun plantuml/init-puml-mode () (use-package puml-mode :defer t :mode ("\\.pum$" . puml-mode) - :config (spacemacs/set-leader-keys-for-major-mode 'puml-mode "cc" 'puml-preview "co" 'puml-set-output-type))) -(defun plantuml/post-init-org () - (spacemacs|use-package-add-hook org - :post-config - (when (boundp 'org-plantuml-jar-path) - (org-babel-do-load-languages - 'org-babel-load-languages - '((plantuml . t)))))) - -;;; packages.el ends here diff --git a/layers/nixos/README.org b/layers/+os/nixos/README.org similarity index 100% rename from layers/nixos/README.org rename to layers/+os/nixos/README.org diff --git a/layers/nixos/config.el b/layers/+os/nixos/config.el similarity index 100% rename from layers/nixos/config.el rename to layers/+os/nixos/config.el diff --git a/layers/nixos/img/nixos.jpg b/layers/+os/nixos/img/nixos.jpg similarity index 100% rename from layers/nixos/img/nixos.jpg rename to layers/+os/nixos/img/nixos.jpg diff --git a/layers/nixos/packages.el b/layers/+os/nixos/packages.el similarity index 100% rename from layers/nixos/packages.el rename to layers/+os/nixos/packages.el diff --git a/layers/osx/README.org b/layers/+os/osx/README.org similarity index 100% rename from layers/osx/README.org rename to layers/+os/osx/README.org diff --git a/layers/osx/config.el b/layers/+os/osx/config.el similarity index 100% rename from layers/osx/config.el rename to layers/+os/osx/config.el diff --git a/layers/osx/img/apple.png b/layers/+os/osx/img/apple.png similarity index 100% rename from layers/osx/img/apple.png rename to layers/+os/osx/img/apple.png diff --git a/layers/osx/img/osx.png b/layers/+os/osx/img/osx.png similarity index 100% rename from layers/osx/img/osx.png rename to layers/+os/osx/img/osx.png diff --git a/layers/osx/keybindings.el b/layers/+os/osx/keybindings.el similarity index 100% rename from layers/osx/keybindings.el rename to layers/+os/osx/keybindings.el diff --git a/layers/osx/packages.el b/layers/+os/osx/packages.el similarity index 100% rename from layers/osx/packages.el rename to layers/+os/osx/packages.el diff --git a/layers/floobits/README.org b/layers/+pair-programming/floobits/README.org similarity index 100% rename from layers/floobits/README.org rename to layers/+pair-programming/floobits/README.org diff --git a/layers/floobits/img/floobits.png b/layers/+pair-programming/floobits/img/floobits.png similarity index 100% rename from layers/floobits/img/floobits.png rename to layers/+pair-programming/floobits/img/floobits.png diff --git a/layers/floobits/packages.el b/layers/+pair-programming/floobits/packages.el similarity index 100% rename from layers/floobits/packages.el rename to layers/+pair-programming/floobits/packages.el diff --git a/layers/+spacemacs/spacemacs-editing-styles/local/hybrid-mode/hybrid-mode.el b/layers/+spacemacs/spacemacs-editing-styles/local/hybrid-mode/hybrid-mode.el deleted file mode 100644 index 9dd2719f696fe..0000000000000 --- a/layers/+spacemacs/spacemacs-editing-styles/local/hybrid-mode/hybrid-mode.el +++ /dev/null @@ -1,104 +0,0 @@ -;;; hybrid-mode.el --- Put one foot in the church of Emacs - -;; Copyright (C) 2012-2016 Sylvain Benner & Contributors -;; -;; Authors: Justin Burkett -;; Chris Ewald -;; Keywords: convenience editing -;; Created: 12 Aug 2015 -;; Version: 1.00 -;; Package-Requires: ((emacs "24") (evil "1.0.9")) -;; URL: https://github.com/syl20bnr/spacemacs - -;; This file is not part of GNU Emacs. - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;;; Code: - -(require 'evil) - -(defvar hybrid-mode-default-state-backup evil-default-state - "Backup of `evil-default-state'.") - -(defcustom hybrid-mode-default-state 'normal - "Value of `evil-default-state' for hybrid-mode. Set to hybrid -to start in hybrid state (emacs bindings) by default." - :group 'spacemacs - :type 'symbol) - -(defvar hybrid-mode-insert-cursor evil-hybrid-state-cursor) -(defvar hybrid-mode-insert-cursor-backup evil-insert-state-cursor) -(defvar hybrid-mode-insert-state-entry-hook) -(defvar hybrid-mode-insert-state-exit-hook) - -(defun hybrid-mode-insert-state-entry-hook () - "Run hooks in `hybrid-mode-insert-state-entry-hook'." - (run-hooks 'hybrid-mode-insert-state-entry-hook)) - -(defun hybrid-mode-insert-state-exit-hook () - "Run hooks in `hybrid-mode-insert-state-exit-hook'." - (run-hooks 'hybrid-mode-insert-state-exit-hook)) - -;;;###autoload -(define-minor-mode hybrid-mode - "Global minor mode to allow emacs bindings in `evil-insert-state'." - :global t - :lighter " hybrid" - :group 'spacemacs - (if hybrid-mode - (progn - (setq hybrid-mode-default-state-backup evil-default-state - evil-default-state hybrid-mode-default-state - evil-insert-state-cursor hybrid-mode-insert-cursor) - (put 'spacemacs-insert-face 'face-alias 'spacemacs-hybrid-face) - ;; using this function to set the variable triggers the defcustom :set - ;; property which actually does the work of removing the bindings. - (customize-set-variable 'evil-disable-insert-state-bindings t) - (add-hook 'evil-insert-state-entry-hook 'hybrid-mode-insert-state-entry-hook) - (add-hook 'evil-insert-state-exit-hook 'hybrid-mode-insert-state-exit-hook)) - (setq evil-default-state hybrid-mode-default-state-backup - evil-insert-state-cursor hybrid-mode-insert-cursor-backup) - (put 'spacemacs-insert-face 'face-alias nil) - (customize-set-variable 'evil-disable-insert-state-bindings nil) - (remove-hook 'evil-insert-state-entry-hook 'hybrid-mode-insert-state-entry-hook) - (remove-hook 'evil-insert-state-exit-hook 'hybrid-mode-insert-state-exit-hook))) - -;;; Temporary to support old method of defining bindings. Should be removed -;;; eventually. -(when (fboundp 'advice-add) - (defun hybrid-mode-evil-define-key (old-func &rest args) - (if (equal (car args) ''hybrid) - (let ((map (nth 1 args)) - (key (nth 2 args)) - (def (nth 3 args)) - (bindings (nthcdr 4 args))) - (message "warning: evil-define-key no longer supports \ -hybrid as a state please convert to (define-key map key def)") - (while key - (when (keymapp (symbol-value map)) - (define-key (symbol-value map) key def) - (setq key (pop bindings) - def (pop bindings))))) - (apply old-func args))) - (advice-add 'evil-define-key :around #'hybrid-mode-evil-define-key)) - -(defvar evil-hybrid-state-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent evil-insert-state-map map) - map)) - -(provide 'hybrid-mode) diff --git a/layers/+spacemacs/spacemacs-editing-styles/packages.el b/layers/+spacemacs/spacemacs-editing-styles/packages.el deleted file mode 100644 index b2e446b6e3648..0000000000000 --- a/layers/+spacemacs/spacemacs-editing-styles/packages.el +++ /dev/null @@ -1,43 +0,0 @@ -(setq spacemacs-editing-styles-packages - '( - evil - (evil-evilified-state :location local :step pre :protected t) - (holy-mode :location local :step pre) - (hybrid-mode :location local :step pre) - )) - -(defun spacemacs-editing-styles/init-evil-evilified-state () - (use-package evil-evilified-state) - (define-key evil-evilified-state-map (kbd dotspacemacs-leader-key) - spacemacs-default-map)) - -(defun spacemacs-editing-styles/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 (holy-mode) - :off (holy-mode -1) - :documentation "Globally toggle holy mode." - :evil-leader "tEe") - (spacemacs|diminish holy-mode " Ⓔe" " Ee")))) - -(defun spacemacs-editing-styles/init-hybrid-mode ()) -(defun spacemacs-editing-styles/post-init-evil () - (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")))) diff --git a/layers/+spacemacs/spacemacs-editing-visual/packages.el b/layers/+spacemacs/spacemacs-editing-visual/packages.el index 739bacd1de75a..9a198aeca62e3 100644 --- a/layers/+spacemacs/spacemacs-editing-visual/packages.el +++ b/layers/+spacemacs/spacemacs-editing-visual/packages.el @@ -14,6 +14,7 @@ ;; default adaptive-wrap auto-highlight-symbol + column-enforce-mode highlight-indentation highlight-numbers highlight-parentheses @@ -268,6 +269,28 @@ (spacemacs/symbol-highlight-transient-state/body) (spacemacs/integrate-evil-search nil))))) +(defun spacemacs-editing-visual/init-column-enforce-mode () + (use-package column-enforce-mode + :commands (column-enforce-mode global-column-enforce-mode) + :init + (progn + ;; TODO Ideally find a way to define the minimum length for long lines + ;; We may add support for the universal prefix argument in toggles to + ;; be able to do this. + (spacemacs|add-toggle highlight-long-lines + :status column-enforce-mode + :on (column-enforce-mode) + :off (column-enforce-mode -1) + :documentation "Highlight the characters past the 80th column." + :evil-leader "t8") + (spacemacs|add-toggle highlight-long-lines-globally + :status global-column-enforce-mode + :on (global-column-enforce-mode) + :off (global-column-enforce-mode -1) + :documentation "Globally Highlight the characters past the 80th column." + :evil-leader "t C-8")) + :config (spacemacs|diminish column-enforce-mode "⑧" "8"))) + (defun spacemacs-editing-visual/init-highlight-indentation () (use-package highlight-indentation :defer t diff --git a/layers/+spacemacs/spacemacs-editing/packages.el b/layers/+spacemacs/spacemacs-editing/packages.el index 83c49c4fec223..768936f7386b4 100644 --- a/layers/+spacemacs/spacemacs-editing/packages.el +++ b/layers/+spacemacs/spacemacs-editing/packages.el @@ -58,11 +58,11 @@ (setq avy-all-windows 'all-frames) (setq avy-background t) (spacemacs/set-leader-keys + "jb" 'avy-pop-mark "jj" 'evil-avy-goto-char "jJ" 'evil-avy-goto-char-2 "jl" 'evil-avy-goto-line - "ju" 'avy-pop-mark - "jU" 'spacemacs/avy-goto-url + "ju" 'spacemacs/avy-goto-url "jw" 'evil-avy-goto-word-or-subword-1 "xo" 'spacemacs/avy-open-url)) :config diff --git a/layers/+window-management/spacemacs-layouts/config.el b/layers/+spacemacs/spacemacs-layouts/config.el similarity index 91% rename from layers/+window-management/spacemacs-layouts/config.el rename to layers/+spacemacs/spacemacs-layouts/config.el index 21d5a657a0b0d..ab4b4cf265f12 100644 --- a/layers/+window-management/spacemacs-layouts/config.el +++ b/layers/+spacemacs/spacemacs-layouts/config.el @@ -24,6 +24,9 @@ (defvar spacemacs--layouts-ts-full-hint-toggle 0 "Display a short doc when nil, full doc otherwise.") +(defvar spacemacs--workspaces-ts-full-hint-toggle 0 + "Display a short doc when nil, full doc otherwise.") + (defvar spacemacs--last-selected-layout dotspacemacs-default-layout-name "Previously selected layout.") diff --git a/layers/+spacemacs/spacemacs-layouts/funcs.el b/layers/+spacemacs/spacemacs-layouts/funcs.el new file mode 100644 index 0000000000000..fb55dbe68d995 --- /dev/null +++ b/layers/+spacemacs/spacemacs-layouts/funcs.el @@ -0,0 +1,540 @@ +;;; funcs.el --- Spacemacs Layouts Layer functions File +;; +;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; +;; Author: Sylvain Benner +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + + +;; General Persp functions + +(defun spacemacs//current-layout-name () + "Get name of the current perspective." + (safe-persp-name (get-frame-persp))) + +(defun spacemacs//layout-autosave () + "Perspectives mode autosave. +Autosaves perspectives layouts every `persp-autosave-interal' seconds. +Cancels autosave on exiting perspectives mode." + (if (and persp-mode layouts-enable-autosave) + (progn + (message "Perspectives mode autosaving enabled.") + (setq spacemacs--layouts-autosave-timer + (run-with-timer + layouts-autosave-delay + layouts-autosave-delay + (lambda () + (message "Saving perspectives to file.") + (persp-save-state-to-file))))) + (when spacemacs--layouts-autosave-timer + (cancel-timer spacemacs--layouts-autosave-timer) + (setq spacemacs--layouts-autosave-timer nil)))) + +(defun spacemacs/jump-to-last-layout () + "Open the previously selected layout, if it exists." + (interactive) + (unless (eq 'non-existent + (gethash spacemacs--last-selected-layout + *persp-hash* 'non-existent)) + (persp-switch spacemacs--last-selected-layout))) + +(defun spacemacs/alternate-buffer-in-persp () + "Switch back and forth between current and last buffer in the +current perspective." + (interactive) + (with-persp-buffer-list () + (switch-to-buffer (other-buffer (current-buffer) t)))) + +(defun spacemacs-layouts/non-restricted-buffer-list () + (interactive) + (remove-hook 'ido-make-buffer-list-hook #'persp-restrict-ido-buffers) + (helm-mini) + (add-hook 'ido-make-buffer-list-hook #'persp-restrict-ido-buffers)) + + +;; Persp transient-state + +(defun spacemacs//layouts-ts-toggle-hint () + "Toggle the full hint docstring for the layouts transient-state." + (interactive) + (setq spacemacs--layouts-ts-full-hint-toggle + (logxor spacemacs--layouts-ts-full-hint-toggle 1))) + +(defun spacemacs//layout-format-name (name pos) + "Format the layout name given by NAME for display in mode-line." + (let* ((layout-name (if (file-directory-p name) + (file-name-nondirectory (directory-file-name name)) + name)) + (string-name (format "%s" layout-name)) + (current (equal name (spacemacs//current-layout-name))) + (caption (concat (number-to-string (if (eq 9 pos) 0 (1+ pos))) + ":" string-name))) + (if current + (propertize (concat "[" caption "]") 'face 'warning) + caption))) + +(defun spacemacs//layouts-ts-hint () + "Return a one liner string containing all the layout names." + (let* ((persp-list (or (persp-names-current-frame-fast-ordered) + (list persp-nil-name))) + (formatted-persp-list + (concat " " + (mapconcat (lambda (persp) + (spacemacs//layout-format-name + persp (position persp persp-list))) + persp-list " | ")))) + (concat + formatted-persp-list + (if (equal 1 spacemacs--layouts-ts-full-hint-toggle) + spacemacs--layouts-ts-full-hint + (concat " ([" + (propertize "?" 'face 'hydra-face-red) + "] help)"))))) + +(defun spacemacs/layout-switch-by-pos (pos) + "Switch to perspective of position POS." + (let ((persp-to-switch + (nth pos (persp-names-current-frame-fast-ordered)))) + (if persp-to-switch + (persp-switch persp-to-switch) + (when (y-or-n-p + (concat "Perspective in this position doesn't exist.\n" + "Do you want to create one? ")) + (let ((persp-reset-windows-on-nil-window-conf t)) + (persp-switch nil) + (spacemacs/home-delete-other-windows)))))) + +;; Define all `spacemacs/persp-switch-to-X' functions +(dolist (i (number-sequence 9 0 -1)) + (eval `(defun ,(intern (format "spacemacs/persp-switch-to-%s" i)) nil + ,(format "Switch to layout %s." i) + (interactive) + (spacemacs/layout-switch-by-pos ,(if (eq 0 i) 9 (1- i)))))) + +(defun spacemacs/layout-goto-default () + "Go to `dotspacemacs-default-layout-name` layout" + (interactive) + (when dotspacemacs-default-layout-name + (persp-switch dotspacemacs-default-layout-name))) + +(defun spacemacs/layouts-ts-rename () + "Rename a layout and get back to the perspectives transient-state." + (interactive) + (call-interactively 'persp-rename) + (spacemacs/layouts-transient-state/body)) + +(defun spacemacs/layouts-ts-close () + "Kill current perspective" + (interactive) + (persp-kill-without-buffers (spacemacs//current-layout-name))) + +(defun spacemacs/layouts-ts-close-other () + (interactive) + (call-interactively 'spacemacs/helm-persp-close) + (spacemacs/layouts-transient-state/body)) + +(defun spacemacs/layouts-ts-kill () + "Kill current perspective" + (interactive) + (persp-kill (spacemacs//current-layout-name))) + +(defun spacemacs/layouts-ts-kill-other () + (interactive) + (call-interactively 'spacemacs/helm-persp-kill) + (spacemacs/layouts-transient-state/body)) + + +;; Custom Persp transient-state + +(defun spacemacs//custom-layout-func-name (name) + "Return the name of the custom-perspective function for NAME." + (intern (concat "spacemacs/custom-perspective-" name))) + +(defmacro spacemacs|define-custom-layout (name &rest props) + "Define a custom-perspective called NAME. + +FUNC is a FUNCTION defined using NAME and the result of +`spacemacs//custom-layout-func-name', it takes care of +creating the perspective NAME and executing the expressions given +in the :body property to this macro. + +NAME is a STRING. + +Available PROPS: + +`:binding STRING' + Key to be bound to the function FUNC + +`:body EXPRESSIONS' + One or several EXPRESSIONS that are going to be evaluated after + we change into the perspective NAME." + (declare (indent 1)) + (let* ((name (if (symbolp name) + (symbol-value name) + name)) + (func (spacemacs//custom-layout-func-name name)) + (binding-prop (car (spacemacs/mplist-get props :binding))) + (binding (if (symbolp binding-prop) + (symbol-value binding-prop) + binding-prop)) + (body (spacemacs/mplist-get props :body)) + (already-defined? (cdr (assoc binding + spacemacs--custom-layout-alist)))) + `(progn + (defun ,func () + ,(format "Open custom perspective %s" name) + (interactive) + (let ((initialize (not (gethash ,name *persp-hash*)))) + (persp-switch ,name) + (when initialize + (delete-other-windows) + ,@body))) + ;; Check for Clashes + (if ,already-defined? + (unless (equal ,already-defined? ,name) + (spacemacs-buffer/warning "Replacing existing binding \"%s\" for %s with %s" + ,binding ,already-defined? ,name) + (push '(,binding . ,name) spacemacs--custom-layout-alist)) + (push '(,binding . ,name) spacemacs--custom-layout-alist))))) + +(defun spacemacs/select-custom-layout () + "Update the custom-perspectives transient-state and then activate it." + (interactive) + (spacemacs//update-custom-layouts) + (spacemacs/custom-layouts-transient-state/body)) + +(defun spacemacs//custom-layouts-ms-documentation () + "Return the docstring for the custom perspectives transient-state." + (if spacemacs--custom-layout-alist + (mapconcat (lambda (custom-persp) + (format "[%s] %s" + (car custom-persp) (cdr custom-persp))) + spacemacs--custom-layout-alist " ") + (spacemacs-buffer/warning (format "`spacemacs--custom-layout-alist' variable is empty" )))) + +(defun spacemacs//update-custom-layouts () + "Ensure the custom-perspectives transient-state is updated. +Takes each element in the list `spacemacs--custom-layout-alist' +format so they are supported by the +`spacemacs/custom-layouts-transient-state' macro." + (let (bindings) + (dolist (custom-persp spacemacs--custom-layout-alist bindings) + (let* ((binding (car custom-persp)) + (name (cdr custom-persp)) + (func-name (spacemacs//custom-layout-func-name name))) + (push (list binding func-name :exit t) bindings))) + (eval `(spacemacs|define-transient-state custom-layouts + :doc (concat (spacemacs//custom-layouts-ms-documentation)) + :bindings + ,@bindings)))) + + +;; Helm integration + +(defun spacemacs/persp-helm-mini () + "As `helm-mini' but restricts visible buffers by perspective." + (interactive) + (with-persp-buffer-list () + (helm-mini))) + +(defun spacemacs//helm-perspectives-source () + (helm-build-in-buffer-source + (concat "Current Perspective: " (spacemacs//current-layout-name)) + :data (persp-names) + :fuzzy-match t + :action + '(("Switch to perspective" . persp-switch) + ("Close perspective(s)" . (lambda (candidate) + (mapcar + 'persp-kill-without-buffers + (helm-marked-candidates)))) + ("Kill perspective(s)" . (lambda (candidate) + (mapcar 'persp-kill + (helm-marked-candidates))))))) +(defun spacemacs/helm-perspectives () + "Control Panel for perspectives. Has many actions. +If match is found +f1: (default) Select perspective +f2: Close Perspective(s) <- mark with C-SPC to close more than one-window +f3: Kill Perspective(s) + +If match is not found + Creates perspective + +Closing doesn't kill buffers inside the perspective while killing +perspectives does." + (interactive) + (helm + :buffer "*Helm Perspectives*" + :sources + `(,(spacemacs//helm-perspectives-source) + ,(helm-build-dummy-source "Create new perspective" + :requires-pattern t + :action + '(("Create new perspective" . + (lambda (name) + (let ((persp-reset-windows-on-nil-window-conf t)) + (persp-switch name) + (unless (member name (persp-names-current-frame-fast-ordered)) + (spacemacs/home)))))))))) + +;; ability to use helm find files but also adds to current perspective +(defun spacemacs/helm-persp-close () + "Kills perspectives without killing the buffers" + (interactive) + (helm + :buffer "*Helm Kill Perspectives (without killing buffers)*" + :sources + (helm-build-in-buffer-source + (concat "Current Perspective: " (spacemacs//current-layout-name)) + :data (persp-names) + :fuzzy-match t + :action + '(("Close perspective(s)" . (lambda (candidate) + (mapcar + 'persp-kill-without-buffers + (helm-marked-candidates)))))))) + +(defun spacemacs/helm-persp-kill () + "Kills perspectives with all their buffers" + (interactive) + (helm + :buffer "*Helm Kill Perspectives with all their buffers*" + :sources (helm-build-in-buffer-source + (s-concat "Current Perspective: " + (spacemacs//current-layout-name)) + :data (persp-names) + :fuzzy-match t + :action + '(("Kill perspective(s)" . + (lambda (candidate) + (mapcar 'persp-kill + (helm-marked-candidates)))))))) + +(defun spacemacs/helm-persp-switch-project (arg) + (interactive "P") + (helm + :sources + (helm-build-in-buffer-source "*Helm Switch Project Layout*" + :data (lambda () + (if (projectile-project-p) + (cons (abbreviate-file-name (projectile-project-root)) + (projectile-relevant-known-projects)) + projectile-known-projects)) + :fuzzy-match helm-projectile-fuzzy-match + :mode-line helm-read-file-name-mode-line-string + :action '(("Switch to Project Perspective" . + (lambda (project) + (let ((persp-reset-windows-on-nil-window-conf t)) + (persp-switch project) + (let ((projectile-completion-system 'helm)) + (projectile-switch-project-by-name project))))))) + :buffer "*Helm Projectile Layouts*")) + + +;; Ivy integration + +(defun spacemacs/ivy-persp-switch-project (arg) + (interactive "P") + (ivy-read "Switch to Project Perspective: " + (if (projectile-project-p) + (cons (abbreviate-file-name (projectile-project-root)) + (projectile-relevant-known-projects)) + projectile-known-projects) + :action (lambda (project) + (let ((persp-reset-windows-on-nil-window-conf t)) + (persp-switch project) + (let ((projectile-completion-system 'ivy)) + (projectile-switch-project-by-name project)))))) + + +;; Eyebrowse + +;; Eyebrowse uses window-state objects (as returned by `window-state-get') to +;; store window configurations, so here are some utility functions to help us +;; analyse window-states. +;; it might make more sense to move these functions to a more general place + +(defun spacemacs/window-state-window-p (object) + "Return t if OBJECT is a window, as represented in window-state objects. +Note: this function doesn't test for real window objects, but for +representations of a window in a window-state object as returned by +`window-state-get'." + (and (listp object) + (memq (car object) '(leaf vc hc)))) + +(defun spacemacs/window-state-get-buffer (window) + "Get WINDOW's buffer. +WINDOW is the representation of a window in a window-state object. +The returned value is the representation of a buffer in a window-state +object." + (cdr (assq 'buffer window))) + +(defun spacemacs/window-state-get-buffer-name (window) + "Get WINDOW's buffer's name. +WINDOW is the representation of a window in a window-state object." + (car (spacemacs/window-state-get-buffer window))) + +(defun spacemacs/window-state-walk-windows-1 (window fn) + "Helper function for `spacemacs/window-state-walk-windows'." + ;; WINDOW is a misleading name. WINDOW is a list that can represent a window, + ;; or a concatenation of several windows. window-state objects are weird. + (let ((child-windows + (-filter #'spacemacs/window-state-window-p window)) + (bare-window + ;; if WINDOW contains more than one window, take only the first window + (--take-while (not (spacemacs/window-state-window-p it)) + window))) + (--each child-windows + (spacemacs/window-state-walk-windows-1 it fn)) + (push (funcall fn bare-window) result))) + +(defun spacemacs/window-state-walk-windows (state fn) + "Execute FN once for each window in STATE and make a list of the results. +FN is a function to execute. +STATE is a window-state object." + (let (result) + (spacemacs/window-state-walk-windows-1 (cdr state) fn) + result)) + +(defun spacemacs/window-state-all-windows (state) + "Get all windows contained in STATE. +STATE is a window-state object. +The returned windows are not actual window objects. They are windows as +represented in window-state objects." + (spacemacs/window-state-walk-windows state #'identity)) + +(defun spacemacs/window-state-get-buffer-names (state) + "Get names of all buffers saved in STATE. +STATE is a window-state object as returned by `window-state-get'." + (delq nil (spacemacs/window-state-walk-windows state #'spacemacs/window-state-get-buffer-name))) + +(defun spacemacs/window-state-get-buffers (state) + "Get all buffers saved in STATE. +STATE is a window-state object as returned by `window-state-get'." + ;; delq nil - removes buffers stored in STATE that don't exist anymore + (delq nil (mapcar #'get-buffer (spacemacs/window-state-get-buffer-names state)))) + +(defun spacemacs/find-workspace (buffer) + "Find Eyebrowse workspace containing BUFFER. + If several workspaces contain BUFFER, return the first one. Workspaces are + ordered by slot number. + If no workspace contains + BUFFER, return nil." + ;; the second element of a workspace is its window-state object + (--find (memq buffer (spacemacs/window-state-get-buffers (cadr it))) + (eyebrowse--get 'window-configs))) + +(defun spacemacs/display-in-workspace (buffer alist) + "Display BUFFER's workspace. + Return BUFFER's window, if exists, otherwise nil. + If BUFFER is already visible in current workspace, just return its window + without switching workspaces." + (or (get-buffer-window buffer) + (-when-let (workspace (spacemacs/find-workspace buffer)) + (eyebrowse-switch-to-window-config (car workspace)) + (get-buffer-window buffer)))) + +(defun spacemacs/goto-buffer-workspace (buffer) + "Switch to BUFFER's window in BUFFER's workspace. + If BUFFER isn't displayed in any workspace, display it in the current + workspace, preferably in the current window." + (interactive "B") + (pop-to-buffer buffer '((;; reuse buffer window from some workspace + spacemacs/display-in-workspace + ;; fallback to display in current window + display-buffer-same-window) + (inhibit-same-window . nil)))) + + +;; Eyebrowse transient state + +(defun spacemacs//workspaces-ts-toggle-hint () + "Toggle the full hint docstring for the workspaces transient-state." + (interactive) + (setq spacemacs--workspaces-ts-full-hint-toggle + (logxor spacemacs--workspaces-ts-full-hint-toggle 1))) + +(defun spacemacs/workspaces-ts-rename () + "Rename a workspace and get back to transient-state." + (interactive) + (eyebrowse-rename-window-config (eyebrowse--get 'current-slot) nil) + (spacemacs/workspaces-transient-state/body)) + +(defun spacemacs//workspace-format-name (workspace) + "Return a porpertized string given a WORKSPACE name." + (let* ((current (eq (eyebrowse--get 'current-slot) (car workspace))) + (name (nth 2 workspace)) + (number (car workspace)) + (caption (if (< 0 (length name)) + (concat (int-to-string number) ":" name) + (int-to-string number)))) + (if current + (propertize (concat "[" caption "]") 'face 'warning) + caption))) + +(defun spacemacs//workspaces-ts-hint () + "Return a one liner string containing all the workspaces names." + (concat + " " + (mapconcat 'spacemacs//workspace-format-name + (eyebrowse--get 'window-configs) " | ") + (if (equal 1 spacemacs--workspaces-ts-full-hint-toggle) + spacemacs--workspaces-ts-full-hint + (concat " ([" + (propertize "?" 'face 'hydra-face-red) + "] help)")))) + + +;; Eyebrowse and Persp integration + +(defun spacemacs/load-eyebrowse-for-perspective (&optional frame) + "Load an eyebrowse workspace according to a perspective's parameters. + FRAME's perspective is the perspective that is considered, defaulting to + the current frame's perspective. + If the perspective doesn't have a workspace, create one." + (let* ((persp (get-frame-persp frame)) + (window-configs (persp-parameter 'eyebrowse-window-configs persp)) + (current-slot (persp-parameter 'eyebrowse-current-slot persp)) + (last-slot (persp-parameter 'eyebrowse-last-slot persp))) + (if window-configs + (progn + (eyebrowse--set 'window-configs window-configs frame) + (eyebrowse--set 'current-slot current-slot frame) + (eyebrowse--set 'last-slot last-slot frame) + (eyebrowse--load-window-config current-slot)) + (eyebrowse--set 'window-configs nil frame) + (eyebrowse-init frame) + (spacemacs/save-eyebrowse-for-perspective frame)))) + +(defun spacemacs/update-eyebrowse-for-perspective (_new-persp-name) + "Update and save current frame's eyebrowse workspace to its perspective. +Parameter _NEW-PERSP-NAME is ignored, and exists only for compatibility with +`persp-before-switch-functions'." + (let* ((current-slot (eyebrowse--get 'current-slot)) + (current-tag (nth 2 (assoc current-slot (eyebrowse--get 'window-configs))))) + (eyebrowse--update-window-config-element + (eyebrowse--current-window-config current-slot current-tag))) + (spacemacs/save-eyebrowse-for-perspective)) + +(defun spacemacs/save-eyebrowse-for-perspective (&optional frame) + "Save FRAME's eyebrowse workspace to FRAME's perspective. +FRAME defaults to the current frame." + (let ((persp (get-frame-persp frame))) + (set-persp-parameter + 'eyebrowse-window-configs (eyebrowse--get 'window-configs frame) persp) + (set-persp-parameter + 'eyebrowse-current-slot (eyebrowse--get 'current-slot frame) persp) + (set-persp-parameter + 'eyebrowse-last-slot (eyebrowse--get 'last-slot frame) persp))) + +(defun spacemacs/layout-workspaces-transient-state () + "Launches the workspaces transient state, if defined." + (interactive) + (if (fboundp 'spacemacs/workspaces-transient-state/body) + (call-interactively 'spacemacs/workspaces-transient-state/body) + (message "You need the eyebrowse layer to use this feature."))) diff --git a/layers/+spacemacs/spacemacs-layouts/packages.el b/layers/+spacemacs/spacemacs-layouts/packages.el new file mode 100644 index 0000000000000..aa946e6ce445a --- /dev/null +++ b/layers/+spacemacs/spacemacs-layouts/packages.el @@ -0,0 +1,221 @@ +;;; packages.el --- Spacemacs Layouts Layer packages File for Spacemacs +;; +;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; +;; Author: Sylvain Benner +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + +(setq spacemacs-layouts-packages + '(eyebrowse + helm + ;; temporary switch on a fork to fix + ;; https://github.com/syl20bnr/spacemacs/issues/4120 + (persp-mode :location (recipe :fetcher github + :repo "syl20bnr/persp-mode.el" + :branch "fix-emacsclient-crash")) + spaceline + swiper)) + + + +(defun spacemacs-layouts/init-eyebrowse () + (use-package eyebrowse + :init + (progn + (setq eyebrowse-new-workspace #'spacemacs/home-delete-other-windows + eyebrowse-wrap-around t) + ;; always activate eyebrowse + (eyebrowse-mode) + ;; transient state + (spacemacs|transient-state-format-hint workspaces + spacemacs--workspaces-ts-full-hint + "\n\n + Go to^^^^^^ Remove/Rename...^^ + --^-^--^^^^----------------------- --^-^--------------------------- + [_0_,_9_]^^ nth/new workspace [_d_] close current workspace + [_C-0_,_C-9_]^^ nth/new workspace [_R_] rename current workspace + [_n_/_C-l_]^^ next workspace + [_N_/_p_/_C-h_] prev workspace + [__]^^^^ last workspace\n") + + (spacemacs|define-transient-state workspaces + :title "Workspaces Transient State" + :hint-is-doc t + :dynamic-hint (spacemacs//workspaces-ts-hint) + :bindings + ("?" spacemacs//workspaces-ts-toggle-hint) + ("0" eyebrowse-switch-to-window-config-0 :exit t) + ("1" eyebrowse-switch-to-window-config-1 :exit t) + ("2" eyebrowse-switch-to-window-config-2 :exit t) + ("3" eyebrowse-switch-to-window-config-3 :exit t) + ("4" eyebrowse-switch-to-window-config-4 :exit t) + ("5" eyebrowse-switch-to-window-config-5 :exit t) + ("6" eyebrowse-switch-to-window-config-6 :exit t) + ("7" eyebrowse-switch-to-window-config-7 :exit t) + ("8" eyebrowse-switch-to-window-config-8 :exit t) + ("9" eyebrowse-switch-to-window-config-9 :exit t) + ("C-0" eyebrowse-switch-to-window-config-0) + ("C-1" eyebrowse-switch-to-window-config-1) + ("C-2" eyebrowse-switch-to-window-config-2) + ("C-3" eyebrowse-switch-to-window-config-3) + ("C-4" eyebrowse-switch-to-window-config-4) + ("C-5" eyebrowse-switch-to-window-config-5) + ("C-6" eyebrowse-switch-to-window-config-6) + ("C-7" eyebrowse-switch-to-window-config-7) + ("C-8" eyebrowse-switch-to-window-config-8) + ("C-9" eyebrowse-switch-to-window-config-9) + ("" eyebrowse-last-window-config) + ("C-h" eyebrowse-prev-window-config) + ("C-i" eyebrowse-last-window-config) + ("C-l" eyebrowse-next-window-config) + ("d" eyebrowse-close-window-config) + ("h" eyebrowse-prev-window-config) + ("l" eyebrowse-next-window-config) + ("n" eyebrowse-next-window-config) + ("N" eyebrowse-prev-window-config) + ("p" eyebrowse-prev-window-config) + ("R" spacemacs/workspaces-ts-rename :exit t) + ("w" eyebrowse-switch-to-window-config :exit t)) + ;; note: we don't need to declare the `SPC l w' binding, it is + ;; declare in the layout transient state + (spacemacs/set-leader-keys "bW" 'spacemacs/goto-buffer-workspace) + ;; hooks + (add-hook 'persp-before-switch-functions + #'spacemacs/update-eyebrowse-for-perspective) + (add-hook 'eyebrowse-post-window-switch-hook + #'spacemacs/save-eyebrowse-for-perspective) + (add-hook 'persp-activated-hook + #'spacemacs/load-eyebrowse-for-perspective) + ;; vim-style tab switching + (define-key evil-motion-state-map "gt" 'eyebrowse-next-window-config) + (define-key evil-motion-state-map "gT" 'eyebrowse-prev-window-config)))) + + + +(defun spacemacs-layouts/post-init-helm () + (spacemacs/set-leader-keys + "pl" 'spacemacs/helm-persp-switch-project)) + + + +(defun spacemacs-layouts/init-persp-mode () + (use-package persp-mode + :diminish persp-mode + :init + (progn + (setq persp-auto-resume-time (if (or dotspacemacs-auto-resume-layouts + spacemacs-force-resume-layouts) + 1 -1) + persp-nil-name dotspacemacs-default-layout-name + persp-reset-windows-on-nil-window-conf nil + persp-set-last-persp-for-new-frames nil + persp-save-dir spacemacs-layouts-directory) + ;; always activate persp-mode + (persp-mode) + ;; layouts transient state + (spacemacs|transient-state-format-hint layouts + spacemacs--layouts-ts-full-hint + "\n\n + Go to^^^^^^ Add/Remove/Rename...^^ +--^-^--^^^^----------------------- --^-^--------------------------- + [_b_]^^^^ buffer in layout [_a_] add buffer + [_h_]^^^^ default layout [_A_] add all from layout + [_o_]^^^^ custom layout [_r_] remove current buffer + [_l_]^^^^ layout w/helm/ivy [_d_] close current layout + [_L_]^^^^ layouts in file [_D_] close other layout + [_0_,_9_]^^ nth/new layout [_x_] kill current w/buffers + [_C-0_,_C-9_]^^ nth/new layout [_X_] kill other w/buffers + [_n_/_C-l_]^^ next layout [_R_] rename current layout + [_N_/_p_/_C-h_] prev layout + [__]^^^^ last layout +--^^^^^^^^---------------------------------------------------------- + [_s_/_S_] save all layouts/save by names + [_t_]^^ show a buffer without adding it to current layout + [_w_]^^ workspaces micro-state (requires eyebrowse layer) + [_?_]^^ toggle help\n") + + (spacemacs|define-transient-state layouts + :title "Layouts Transient State" + :hint-is-doc t + :dynamic-hint (spacemacs//layouts-ts-hint) + :bindings + ;; need to exit in case number doesn't exist + ("?" spacemacs//layouts-ts-toggle-hint) + ("1" spacemacs/persp-switch-to-1 :exit t) + ("2" spacemacs/persp-switch-to-2 :exit t) + ("3" spacemacs/persp-switch-to-3 :exit t) + ("4" spacemacs/persp-switch-to-4 :exit t) + ("5" spacemacs/persp-switch-to-5 :exit t) + ("6" spacemacs/persp-switch-to-6 :exit t) + ("7" spacemacs/persp-switch-to-7 :exit t) + ("8" spacemacs/persp-switch-to-8 :exit t) + ("9" spacemacs/persp-switch-to-9 :exit t) + ("0" spacemacs/persp-switch-to-0 :exit t) + ("C-1" spacemacs/persp-switch-to-1) + ("C-2" spacemacs/persp-switch-to-2) + ("C-3" spacemacs/persp-switch-to-3) + ("C-4" spacemacs/persp-switch-to-4) + ("C-5" spacemacs/persp-switch-to-5) + ("C-6" spacemacs/persp-switch-to-6) + ("C-7" spacemacs/persp-switch-to-7) + ("C-8" spacemacs/persp-switch-to-8) + ("C-9" spacemacs/persp-switch-to-9) + ("C-0" spacemacs/persp-switch-to-0) + ("" spacemacs/jump-to-last-layout) + ("" nil :exit t) + ("C-h" persp-prev) + ("C-l" persp-next) + ("a" persp-add-buffer :exit t) + ("A" persp-import-buffers :exit t) + ("b" spacemacs/persp-helm-mini :exit t) + ("d" spacemacs/layouts-ts-close) + ("D" spacemacs/layouts-ts-close-other :exit t) + ("h" spacemacs/layout-goto-default :exit t) + ("l" spacemacs/helm-perspectives :exit t) + ("L" persp-load-state-from-file :exit t) + ("n" persp-next) + ("N" persp-prev) + ("o" spacemacs/select-custom-layout :exit t) + ("p" persp-prev) + ("r" persp-remove-buffer :exit t) + ("R" spacemacs/layouts-ts-rename :exit t) + ("s" persp-save-state-to-file :exit t) + ("S" persp-save-to-file-by-names :exit t) + ("t" persp-temporarily-display-buffer :exit t) + ("w" spacemacs/layout-workspaces-transient-state :exit t) + ("x" spacemacs/layouts-ts-kill) + ("X" spacemacs/layouts-ts-kill-other :exit t)) + (spacemacs/set-leader-keys "l" 'spacemacs/layouts-transient-state/body) + ;; custom layouts + (spacemacs|define-custom-layout "@Spacemacs" + :binding "e" + :body + (spacemacs/find-dotfile))) + :config + (progn + (defadvice persp-activate (before spacemacs//save-toggle-layout activate) + (setq spacemacs--last-selected-layout persp-last-persp-name)) + (add-hook 'persp-mode-hook 'spacemacs//layout-autosave) + (spacemacs/declare-prefix "b" "persp-buffers") + (spacemacs/declare-prefix "B" "global-buffers") + ;; Override SPC TAB to only change buffers in perspective + (spacemacs/set-leader-keys + "TAB" 'spacemacs/alternate-buffer-in-persp + "ba" 'persp-add-buffer + "br" 'persp-remove-buffer + "Bb" 'spacemacs-layouts/non-restricted-buffer-list)))) + + + +(defun spacemacs-layouts/post-init-spaceline () + (setq spaceline-display-default-perspective + dotspacemacs-display-default-layout)) + + + +(defun spacemacs-layouts/post-init-swiper () + (spacemacs/set-leader-keys "pl" 'spacemacs/ivy-persp-switch-project)) diff --git a/layers/cscope/README.org b/layers/+tags/cscope/README.org similarity index 100% rename from layers/cscope/README.org rename to layers/+tags/cscope/README.org diff --git a/layers/cscope/img/cscope.jpg b/layers/+tags/cscope/img/cscope.jpg similarity index 100% rename from layers/cscope/img/cscope.jpg rename to layers/+tags/cscope/img/cscope.jpg diff --git a/layers/cscope/packages.el b/layers/+tags/cscope/packages.el similarity index 100% rename from layers/cscope/packages.el rename to layers/+tags/cscope/packages.el diff --git a/layers/gtags/README.org b/layers/+tags/gtags/README.org similarity index 100% rename from layers/gtags/README.org rename to layers/+tags/gtags/README.org diff --git a/layers/gtags/funcs.el b/layers/+tags/gtags/funcs.el similarity index 100% rename from layers/gtags/funcs.el rename to layers/+tags/gtags/funcs.el diff --git a/layers/gtags/packages.el b/layers/+tags/gtags/packages.el similarity index 100% rename from layers/gtags/packages.el rename to layers/+tags/gtags/packages.el diff --git a/layers/colors/README.org b/layers/+themes/colors/README.org similarity index 100% rename from layers/colors/README.org rename to layers/+themes/colors/README.org diff --git a/layers/colors/config.el b/layers/+themes/colors/config.el similarity index 100% rename from layers/colors/config.el rename to layers/+themes/colors/config.el diff --git a/layers/colors/img/rainbow-mode.png b/layers/+themes/colors/img/rainbow-mode.png similarity index 100% rename from layers/colors/img/rainbow-mode.png rename to layers/+themes/colors/img/rainbow-mode.png diff --git a/layers/colors/img/rainbow_dash.png b/layers/+themes/colors/img/rainbow_dash.png similarity index 100% rename from layers/colors/img/rainbow_dash.png rename to layers/+themes/colors/img/rainbow_dash.png diff --git a/layers/colors/img/theme-tweaks-python.png b/layers/+themes/colors/img/theme-tweaks-python.png similarity index 100% rename from layers/colors/img/theme-tweaks-python.png rename to layers/+themes/colors/img/theme-tweaks-python.png diff --git a/layers/colors/local/nyan-mode/README.org b/layers/+themes/colors/local/nyan-mode/README.org similarity index 100% rename from layers/colors/local/nyan-mode/README.org rename to layers/+themes/colors/local/nyan-mode/README.org diff --git a/layers/colors/local/nyan-mode/img/nyan-frame-1.xpm b/layers/+themes/colors/local/nyan-mode/img/nyan-frame-1.xpm similarity index 100% rename from layers/colors/local/nyan-mode/img/nyan-frame-1.xpm rename to layers/+themes/colors/local/nyan-mode/img/nyan-frame-1.xpm diff --git a/layers/colors/local/nyan-mode/img/nyan-frame-2.xpm b/layers/+themes/colors/local/nyan-mode/img/nyan-frame-2.xpm similarity index 100% rename from layers/colors/local/nyan-mode/img/nyan-frame-2.xpm rename to layers/+themes/colors/local/nyan-mode/img/nyan-frame-2.xpm diff --git a/layers/colors/local/nyan-mode/img/nyan-frame-3.xpm b/layers/+themes/colors/local/nyan-mode/img/nyan-frame-3.xpm similarity index 100% rename from layers/colors/local/nyan-mode/img/nyan-frame-3.xpm rename to layers/+themes/colors/local/nyan-mode/img/nyan-frame-3.xpm diff --git a/layers/colors/local/nyan-mode/img/nyan-frame-4.xpm b/layers/+themes/colors/local/nyan-mode/img/nyan-frame-4.xpm similarity index 100% rename from layers/colors/local/nyan-mode/img/nyan-frame-4.xpm rename to layers/+themes/colors/local/nyan-mode/img/nyan-frame-4.xpm diff --git a/layers/colors/local/nyan-mode/img/nyan-frame-5.xpm b/layers/+themes/colors/local/nyan-mode/img/nyan-frame-5.xpm similarity index 100% rename from layers/colors/local/nyan-mode/img/nyan-frame-5.xpm rename to layers/+themes/colors/local/nyan-mode/img/nyan-frame-5.xpm diff --git a/layers/colors/local/nyan-mode/img/nyan-frame-6.xpm b/layers/+themes/colors/local/nyan-mode/img/nyan-frame-6.xpm similarity index 100% rename from layers/colors/local/nyan-mode/img/nyan-frame-6.xpm rename to layers/+themes/colors/local/nyan-mode/img/nyan-frame-6.xpm diff --git a/layers/colors/local/nyan-mode/img/nyan-start.xpm b/layers/+themes/colors/local/nyan-mode/img/nyan-start.xpm similarity index 100% rename from layers/colors/local/nyan-mode/img/nyan-start.xpm rename to layers/+themes/colors/local/nyan-mode/img/nyan-start.xpm diff --git a/layers/colors/local/nyan-mode/img/nyan.xpm b/layers/+themes/colors/local/nyan-mode/img/nyan.xpm similarity index 100% rename from layers/colors/local/nyan-mode/img/nyan.xpm rename to layers/+themes/colors/local/nyan-mode/img/nyan.xpm diff --git a/layers/colors/local/nyan-mode/img/outerspace.xpm b/layers/+themes/colors/local/nyan-mode/img/outerspace.xpm similarity index 100% rename from layers/colors/local/nyan-mode/img/outerspace.xpm rename to layers/+themes/colors/local/nyan-mode/img/outerspace.xpm diff --git a/layers/colors/local/nyan-mode/img/rainbow-start.xpm b/layers/+themes/colors/local/nyan-mode/img/rainbow-start.xpm similarity index 100% rename from layers/colors/local/nyan-mode/img/rainbow-start.xpm rename to layers/+themes/colors/local/nyan-mode/img/rainbow-start.xpm diff --git a/layers/colors/local/nyan-mode/img/rainbow.xpm b/layers/+themes/colors/local/nyan-mode/img/rainbow.xpm similarity index 100% rename from layers/colors/local/nyan-mode/img/rainbow.xpm rename to layers/+themes/colors/local/nyan-mode/img/rainbow.xpm diff --git a/layers/colors/local/nyan-mode/mus/nyanlooped.mp3 b/layers/+themes/colors/local/nyan-mode/mus/nyanlooped.mp3 similarity index 100% rename from layers/colors/local/nyan-mode/mus/nyanlooped.mp3 rename to layers/+themes/colors/local/nyan-mode/mus/nyanlooped.mp3 diff --git a/layers/colors/local/nyan-mode/nyan-mode.el b/layers/+themes/colors/local/nyan-mode/nyan-mode.el similarity index 100% rename from layers/colors/local/nyan-mode/nyan-mode.el rename to layers/+themes/colors/local/nyan-mode/nyan-mode.el diff --git a/layers/colors/packages.el b/layers/+themes/colors/packages.el similarity index 100% rename from layers/colors/packages.el rename to layers/+themes/colors/packages.el diff --git a/layers/themes-megapack/README.org b/layers/+themes/themes-megapack/README.org similarity index 100% rename from layers/themes-megapack/README.org rename to layers/+themes/themes-megapack/README.org diff --git a/layers/themes-megapack/packages.el b/layers/+themes/themes-megapack/packages.el similarity index 100% rename from layers/themes-megapack/packages.el rename to layers/+themes/themes-megapack/packages.el diff --git a/layers/theming/README.org b/layers/+themes/theming/README.org similarity index 100% rename from layers/theming/README.org rename to layers/+themes/theming/README.org diff --git a/layers/theming/config.el b/layers/+themes/theming/config.el similarity index 100% rename from layers/theming/config.el rename to layers/+themes/theming/config.el diff --git a/layers/theming/funcs.el b/layers/+themes/theming/funcs.el similarity index 100% rename from layers/theming/funcs.el rename to layers/+themes/theming/funcs.el diff --git a/layers/chrome/README.org b/layers/+tools/chrome/README.org similarity index 100% rename from layers/chrome/README.org rename to layers/+tools/chrome/README.org diff --git a/layers/chrome/img/chrome.png b/layers/+tools/chrome/img/chrome.png similarity index 100% rename from layers/chrome/img/chrome.png rename to layers/+tools/chrome/img/chrome.png diff --git a/layers/chrome/packages.el b/layers/+tools/chrome/packages.el similarity index 100% rename from layers/chrome/packages.el rename to layers/+tools/chrome/packages.el diff --git a/layers/deft/README.org b/layers/+tools/deft/README.org similarity index 100% rename from layers/deft/README.org rename to layers/+tools/deft/README.org diff --git a/layers/deft/packages.el b/layers/+tools/deft/packages.el similarity index 100% rename from layers/deft/packages.el rename to layers/+tools/deft/packages.el diff --git a/layers/finance/README.org b/layers/+tools/finance/README.org similarity index 100% rename from layers/finance/README.org rename to layers/+tools/finance/README.org diff --git a/layers/finance/config.el b/layers/+tools/finance/config.el similarity index 100% rename from layers/finance/config.el rename to layers/+tools/finance/config.el diff --git a/layers/finance/img/ledger.png b/layers/+tools/finance/img/ledger.png similarity index 100% rename from layers/finance/img/ledger.png rename to layers/+tools/finance/img/ledger.png diff --git a/layers/finance/packages.el b/layers/+tools/finance/packages.el similarity index 100% rename from layers/finance/packages.el rename to layers/+tools/finance/packages.el diff --git a/layers/geolocation/README.org b/layers/+tools/geolocation/README.org similarity index 100% rename from layers/geolocation/README.org rename to layers/+tools/geolocation/README.org diff --git a/layers/geolocation/config.el b/layers/+tools/geolocation/config.el similarity index 100% rename from layers/geolocation/config.el rename to layers/+tools/geolocation/config.el diff --git a/layers/geolocation/extensions.el b/layers/+tools/geolocation/extensions.el similarity index 100% rename from layers/geolocation/extensions.el rename to layers/+tools/geolocation/extensions.el diff --git a/layers/geolocation/extensions/theme-changer/theme-changer.el b/layers/+tools/geolocation/extensions/theme-changer/theme-changer.el similarity index 100% rename from layers/geolocation/extensions/theme-changer/theme-changer.el rename to layers/+tools/geolocation/extensions/theme-changer/theme-changer.el diff --git a/layers/geolocation/img/emacs-location-helper.jpg b/layers/+tools/geolocation/img/emacs-location-helper.jpg similarity index 100% rename from layers/geolocation/img/emacs-location-helper.jpg rename to layers/+tools/geolocation/img/emacs-location-helper.jpg diff --git a/layers/geolocation/img/emacs-sunshine.jpg b/layers/+tools/geolocation/img/emacs-sunshine.jpg similarity index 100% rename from layers/geolocation/img/emacs-sunshine.jpg rename to layers/+tools/geolocation/img/emacs-sunshine.jpg diff --git a/layers/geolocation/packages.el b/layers/+tools/geolocation/packages.el similarity index 100% rename from layers/geolocation/packages.el rename to layers/+tools/geolocation/packages.el diff --git a/layers/prodigy/README.org b/layers/+tools/prodigy/README.org similarity index 100% rename from layers/prodigy/README.org rename to layers/+tools/prodigy/README.org diff --git a/layers/prodigy/img/prodigy.png b/layers/+tools/prodigy/img/prodigy.png similarity index 100% rename from layers/prodigy/img/prodigy.png rename to layers/+tools/prodigy/img/prodigy.png diff --git a/layers/prodigy/packages.el b/layers/+tools/prodigy/packages.el similarity index 100% rename from layers/prodigy/packages.el rename to layers/+tools/prodigy/packages.el diff --git a/layers/restclient/README.org b/layers/+tools/restclient/README.org similarity index 50% rename from layers/restclient/README.org rename to layers/+tools/restclient/README.org index 9ba3653086a06..411cd0c9b1c0b 100644 --- a/layers/restclient/README.org +++ b/layers/+tools/restclient/README.org @@ -2,23 +2,32 @@ #+HTML_HEAD_EXTRA: * Table of Contents :TOC_4_org:noexport: - - [[What is this?][What is this?]] + - [[Description][Description]] - [[Install][Install]] - - [[Keybindings][Keybindings]] + - [[Configuration][Configuration]] + - [[Restclient][Restclient]] + - [[Keybindings][Keybindings]] + - [[ob-http][ob-http]] -* What is this? -This is a package that lets you have a REPL-like interface -for http requests. Full documentation and examples can be found in the -package's [[https://github.com/pashky/restclient.el][GitHub Page]]. - -Also there is an [[http://emacsrocks.com/e15.html][Emacs Rocks!]] episode of it. +* Description +This is a package that lets you have a REPL-like interface for http requests +using a [[http://pashky/restclient.el][restclient]] buffer or an =org= buffer. * Install To use this configuration layer, add it to your =~/.spacemacs=. You will need to add =restclient= to the existing =dotspacemacs-configuration-layers= list in this file. -* Keybindings +* Configuration +By default the layer enables [[http://pashky/restclient.el][restclient]]. It is possible to use =org= via [[http://github.com/zweifisch/ob-http][ob-http]] +by setting the layer variable =restclient-use-org= to =t=. + +* Restclient +Any file with an =.http= extension is opened in a =restclient= buffer. +Full documentation and examples can be found in the package's [[https://github.com/pashky/restclient.el][GitHub Page]]. +Also there is an [[http://emacsrocks.com/e15.html][Emacs Rocks!]] episode of it. + +** Keybindings | Key Binding | Description | |-------------+-------------------------------------------------------------| @@ -28,3 +37,7 @@ file. | ~SPC m R~ | Send and switch window (do not attempt to pretty-print) | | ~SPC m y~ | Copy query under the cursor as a curl command | +* ob-http +Any file with an =.http= extension is opened in an =org= buffer with org babel +configured to use =ob-http=. +Full documentation and examples can be found in the package's [[http://github.com/zweifisch/ob-http][GitHub Page]]. diff --git a/layers/+tools/restclient/config.el b/layers/+tools/restclient/config.el new file mode 100644 index 0000000000000..68b469ec6c51b --- /dev/null +++ b/layers/+tools/restclient/config.el @@ -0,0 +1,13 @@ +;;; config.el --- restclient configuration File for Spacemacs +;; +;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; +;; Author: Sylvain Benner +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + +(defvar restclient-use-org nil + "If non-nil use `ob-http' instead of `restclient'.") diff --git a/layers/+tools/restclient/funcs.el b/layers/+tools/restclient/funcs.el new file mode 100644 index 0000000000000..7384e80fa0eb9 --- /dev/null +++ b/layers/+tools/restclient/funcs.el @@ -0,0 +1,15 @@ +;;; funcs.el --- restclient Layer functions File +;; +;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; +;; Author: Sylvain Benner +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + + +(defun restclient-http-send-current-raw-stay-in-window () + (interactive) + (restclient-http-send-current t t)) diff --git a/layers/+tools/restclient/packages.el b/layers/+tools/restclient/packages.el new file mode 100644 index 0000000000000..efac26ea13224 --- /dev/null +++ b/layers/+tools/restclient/packages.el @@ -0,0 +1,36 @@ +;;; packages.el --- restclient Layer Packages File +;; +;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; +;; Author: Sylvain Benner +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 +(setq restclient-packages + '(ob-http + restclient)) + +(defun restclient/init-ob-http () + (use-package ob-http + :init + (progn + (when restclient-use-org + (add-to-list 'auto-mode-alist '("\\.http\\'" . org-mode))) + (spacemacs|use-package-add-hook org + :post-config (add-to-list 'org-babel-load-languages '(http . t)))))) + +(defun restclient/init-restclient () + (use-package restclient + :defer t + :init + (progn + (unless restclient-use-org + (add-to-list 'auto-mode-alist '("\\.http\\'" . restclient-mode))) + (spacemacs/set-leader-keys-for-major-mode 'restclient-mode + "s" 'restclient-http-send-current-stay-in-window + "S" 'restclient-http-send-current + "r" 'restclient-http-send-current-raw-stay-in-window + "R" 'restclient-http-send-current-raw + "y" 'restclient-copy-curl-command)))) diff --git a/layers/shell/README.org b/layers/+tools/shell/README.org similarity index 100% rename from layers/shell/README.org rename to layers/+tools/shell/README.org diff --git a/layers/shell/config.el b/layers/+tools/shell/config.el similarity index 100% rename from layers/shell/config.el rename to layers/+tools/shell/config.el diff --git a/layers/shell/funcs.el b/layers/+tools/shell/funcs.el similarity index 100% rename from layers/shell/funcs.el rename to layers/+tools/shell/funcs.el diff --git a/layers/shell/img/shell.png b/layers/+tools/shell/img/shell.png similarity index 100% rename from layers/shell/img/shell.png rename to layers/+tools/shell/img/shell.png diff --git a/layers/shell/packages.el b/layers/+tools/shell/packages.el similarity index 100% rename from layers/shell/packages.el rename to layers/+tools/shell/packages.el diff --git a/layers/speed-reading/README.org b/layers/+tools/speed-reading/README.org similarity index 100% rename from layers/speed-reading/README.org rename to layers/+tools/speed-reading/README.org diff --git a/layers/speed-reading/packages.el b/layers/+tools/speed-reading/packages.el similarity index 100% rename from layers/speed-reading/packages.el rename to layers/+tools/speed-reading/packages.el diff --git a/layers/+tools/elfeed/README.org b/layers/+web-services/elfeed/README.org similarity index 100% rename from layers/+tools/elfeed/README.org rename to layers/+web-services/elfeed/README.org diff --git a/layers/+tools/elfeed/config.el b/layers/+web-services/elfeed/config.el similarity index 100% rename from layers/+tools/elfeed/config.el rename to layers/+web-services/elfeed/config.el diff --git a/layers/+tools/elfeed/img/elfeed.png b/layers/+web-services/elfeed/img/elfeed.png similarity index 100% rename from layers/+tools/elfeed/img/elfeed.png rename to layers/+web-services/elfeed/img/elfeed.png diff --git a/layers/+tools/elfeed/packages-config.el b/layers/+web-services/elfeed/packages-config.el similarity index 100% rename from layers/+tools/elfeed/packages-config.el rename to layers/+web-services/elfeed/packages-config.el diff --git a/layers/+tools/elfeed/packages.el b/layers/+web-services/elfeed/packages.el similarity index 100% rename from layers/+tools/elfeed/packages.el rename to layers/+web-services/elfeed/packages.el diff --git a/layers/+tools/evernote/README.org b/layers/+web-services/evernote/README.org similarity index 100% rename from layers/+tools/evernote/README.org rename to layers/+web-services/evernote/README.org diff --git a/layers/+tools/evernote/config.el b/layers/+web-services/evernote/config.el similarity index 100% rename from layers/+tools/evernote/config.el rename to layers/+web-services/evernote/config.el diff --git a/layers/+tools/evernote/img/evernote.png b/layers/+web-services/evernote/img/evernote.png similarity index 100% rename from layers/+tools/evernote/img/evernote.png rename to layers/+web-services/evernote/img/evernote.png diff --git a/layers/+tools/evernote/img/geeknote.png b/layers/+web-services/evernote/img/geeknote.png similarity index 100% rename from layers/+tools/evernote/img/geeknote.png rename to layers/+web-services/evernote/img/geeknote.png diff --git a/layers/+tools/evernote/packages.el b/layers/+web-services/evernote/packages.el similarity index 100% rename from layers/+tools/evernote/packages.el rename to layers/+web-services/evernote/packages.el diff --git a/layers/search-engine/README.org b/layers/+web-services/search-engine/README.org similarity index 100% rename from layers/search-engine/README.org rename to layers/+web-services/search-engine/README.org diff --git a/layers/search-engine/img/searchengine.jpg b/layers/+web-services/search-engine/img/searchengine.jpg similarity index 100% rename from layers/search-engine/img/searchengine.jpg rename to layers/+web-services/search-engine/img/searchengine.jpg diff --git a/layers/search-engine/packages.el b/layers/+web-services/search-engine/packages.el similarity index 100% rename from layers/search-engine/packages.el rename to layers/+web-services/search-engine/packages.el diff --git a/layers/spotify/README.org b/layers/+web-services/spotify/README.org similarity index 100% rename from layers/spotify/README.org rename to layers/+web-services/spotify/README.org diff --git a/layers/spotify/config.el b/layers/+web-services/spotify/config.el similarity index 100% rename from layers/spotify/config.el rename to layers/+web-services/spotify/config.el diff --git a/layers/spotify/img/spotify.png b/layers/+web-services/spotify/img/spotify.png similarity index 100% rename from layers/spotify/img/spotify.png rename to layers/+web-services/spotify/img/spotify.png diff --git a/layers/spotify/packages.el b/layers/+web-services/spotify/packages.el similarity index 100% rename from layers/spotify/packages.el rename to layers/+web-services/spotify/packages.el diff --git a/layers/+web-services/twitter/README.org b/layers/+web-services/twitter/README.org new file mode 100644 index 0000000000000..00ddf686052d8 --- /dev/null +++ b/layers/+web-services/twitter/README.org @@ -0,0 +1,79 @@ +#+TITLE: Twitter contribution layer for Spacemacs + +[[file:img/twitter.png]] + +* Table of Contents :TOC_4_org:noexport: + - [[Description][Description]] + - [[Features][Features]] + - [[Install][Install]] + - [[Configuration][Configuration]] + - [[Key Bindings][Key Bindings]] + +* Description +This layer adds Twitter support to Spacemacs via the package [[https://github.com/hayamiz/twittering-mode][twittering-mode]]. + +* Features +- Activities on Twitter + - Viewing various timelines + - Home timeline + - Replies + - User's timeline + - Public timeline + - Favorites timeline + - Retweets timeline + - Merged timeline + - Timeline without tweets satisfying a condition + - Posting tweets + - Direct message + - ReTweet + - Hash tag + - Signature + - Following and removing users + - Marking tweets as favorites +- HTTP Proxy support +- Secure connection via HTTPS (cURL, GNU Wget, OpenSSL or GnuTLS is required) + +* Install +To use this configuration layer, add it to your =~/.spacemacs=. You will need to +add =twitter= to the existing =dotspacemacs-configuration-layers= list in this +file. + +* Configuration +Exhaustive configuration documentation can be found on the README page of the +package [[https://github.com/hayamiz/twittering-mode][here]]. + +You can authenticate easily via a PIN number, or you can use GnuPG by setting +the variable =twittering-use-master-password= to =t= in the =user-config= +function of your dotfile. + +* Key Bindings + +| Key Binding | Description | +|-------------+------------------------------------------| +| ~?~ | Open/Quit transient state | +| ~/~ | Search | +| ~a~ | Toggle auto-refresh | +| ~b~ | Heart | +| ~B~ | Unheart | +| ~d~ | Direct message to user around point | +| ~e~ | Edit tweet | +| ~f~ | Follow user around point | +| ~F~ | Unfollow user around point | +| ~g~ | First tweet | +| ~G~ | Last tweet | +| ~i~ | View user profile around point | +| ~q~ | Quit transient state | +| ~Q~ | Quit twittering mode | +| ~j~ | Next tweet | +| ~J~ | Next tweet of same user around point | +| ~k~ | Previous tweet | +| ~K~ | Previous tweet of same user around point | +| ~n~ | New tweet | +| ~o~ | Open URL | +| ~r~ | Retweet (native) | +| ~R~ | Retweet (organic) | +| ~t~ | View tweet replies | +| ~u~ | Update timeline | +| ~X~ | Delete tweet | +| ~y~ | Copy tweet URI | +| ~Y~ | Copy tweet content | diff --git a/layers/+web-services/twitter/img/twitter.png b/layers/+web-services/twitter/img/twitter.png new file mode 100644 index 0000000000000..8741acbf40881 Binary files /dev/null and b/layers/+web-services/twitter/img/twitter.png differ diff --git a/layers/+web-services/twitter/packages.el b/layers/+web-services/twitter/packages.el new file mode 100644 index 0000000000000..adc5ac81881f0 --- /dev/null +++ b/layers/+web-services/twitter/packages.el @@ -0,0 +1,112 @@ +;;; packages.el --- twitter 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 + +;; List of all packages to install and/or initialize. Built-in packages +;; which require an initialization must be listed explicitly in the list. +(setq twitter-packages '(twittering-mode)) + +(defun twitter/init-twittering-mode () + (use-package twittering-mode + :defer t + :init + (progn + (evil-leader/set-key "at" 'twit) + (setq twittering-initial-timeline-spec-string '(":home") + twittering-icon-mode t + twittering-use-icon-storage 1 + twittering-enable-unread-status-notifier t + twittering-display-remaining t + twittering-edit-skeleton 'inherit-any + twittering-url-show-status nil + twittering-timeline-header "" + twittering-timeline-footer "" + twitter-images-directory (concat spacemacs-cache-directory "twitter") + twittering-status-format "%i %S, %RT{%FACE[bold]{%S}} %@ %FACE[shadow]{%p%f%L%r}\n%FOLD[ ]{%T}\n") + (unless (file-exists-p twitter-images-directory) + (make-directory twitter-images-directory)) + + ) + :config + (progn + ;; twittering mode overwrite the leader key + (define-key twittering-mode-map (kbd "SPC") spacemacs-default-map) + ;; redefine better defaults + (let ((map twittering-mode-map)) + (define-key map "?" 'spacemacs/twittering-mode-transient-state/body) + (define-key map "/" 'twittering-search) + (define-key map "a" 'twittering-toggle-activate-buffer) + (define-key map "b" 'twittering-favorite) + (define-key map "B" 'twittering-unfavorite) + (define-key map "d" 'twittering-direct-message) + (define-key map "e" 'twittering-edit-mode) + (define-key map "f" 'twittering-follow) + (define-key map "F" 'twittering-unfollow) + (define-key map "g" 'beginning-of-buffer) + (define-key map "G" 'end-of-buffer) + (define-key map "i" 'twittering-view-user-page) + (define-key map "Q" 'twittering-kill-buffer) + (define-key map "j" 'twittering-goto-next-status) + (define-key map "J" 'twittering-goto-next-status-of-user) + (define-key map "k" 'twittering-goto-previous-status) + (define-key map "K" 'twittering-goto-previous-status-of-user) + (define-key map "n" 'twittering-update-status-interactive) + (define-key map "o" 'twittering-click) + (define-key map "r" 'twittering-native-retweet) + (define-key map "R" 'twittering-organic-retweet) + (define-key map "t" 'twittering-toggle-or-retrieve-replied-statuses) + (define-key map "u" 'twittering-current-timeline) + (define-key map "X" 'twittering-delete-status) + (define-key map "y" 'twittering-push-uri-onto-kill-ring) + (define-key map "Y" 'twittering-push-tweet-onto-kill-ring)) + ;; associated transient state + (spacemacs|define-transient-state twittering-mode + :title "Twittering Mode Transient State" + :doc " + Tweets^^^^^^ User^^^^ Other^^ + ──────^^^^^^────────────────────────────────── ────^^^^─────────────── ─────^^─────────────────── + [_j_/_k_] down/up [_r_] retweet [_d_]^^ direct message [_a_] toggle auto-refresh + [_RET_]^^ open or reply [_R_] retweet & edit [_f_]^^ follow [_q_] quit + [_b_]^^ heart [_n_] post new tweet [_F_]^^ unfollow [_Q_] quit twitter + [_B_]^^ unheart [_t_] show thread [_i_]^^ profile [_u_] update + [_e_]^^ edit mode [_X_] delete tweet [_J_/_K_] down/up [_/_] search + [_g_]^^ first [_y_] yank url + [_G_]^^ last [_Y_] yank tweet + [_o_]^^ open url" + :bindings + ("?" nil :exit t) + ("RET" twittering-enter :exit t) + ("/" twittering-search :exit t) + ("a" twittering-toggle-activate-buffer) + ("b" twittering-favorite) + ("B" twittering-unfavorite) + ("d" twittering-direct-message :exit t) + ("e" twittering-edit-mode :exit t) + ("f" twittering-follow) + ("F" twittering-unfollow) + ("g" beginning-of-buffer) + ("G" end-of-buffer) + ("i" twittering-view-user-page) + ("q" nil :exit t) + ("Q" twittering-kill-buffer :exit t) + ("j" twittering-goto-next-status) + ("J" twittering-goto-next-status-of-user) + ("k" twittering-goto-previous-status) + ("K" twittering-goto-previous-status-of-user) + ("n" twittering-update-status-interactive :exit t) + ("o" twittering-click :exit t) + ("r" twittering-native-retweet :exit t) + ("R" twittering-organic-retweet :exit t) + ("t" twittering-toggle-or-retrieve-replied-statuses :exit t) + ("u" twittering-current-timeline) + ("X" twittering-delete-status) + ("y" twittering-push-uri-onto-kill-ring) + ("Y" twittering-push-tweet-onto-kill-ring))))) diff --git a/layers/+tools/wakatime/README.org b/layers/+web-services/wakatime/README.org similarity index 100% rename from layers/+tools/wakatime/README.org rename to layers/+web-services/wakatime/README.org diff --git a/layers/+tools/wakatime/img/wakatime.png b/layers/+web-services/wakatime/img/wakatime.png similarity index 100% rename from layers/+tools/wakatime/img/wakatime.png rename to layers/+web-services/wakatime/img/wakatime.png diff --git a/layers/+tools/wakatime/packages.el b/layers/+web-services/wakatime/packages.el similarity index 100% rename from layers/+tools/wakatime/packages.el rename to layers/+web-services/wakatime/packages.el diff --git a/layers/+window-management/eyebrowse/README.org b/layers/+window-management/eyebrowse/README.org deleted file mode 100644 index d03ba1d304e2b..0000000000000 --- a/layers/+window-management/eyebrowse/README.org +++ /dev/null @@ -1,70 +0,0 @@ -#+TITLE: Eyebrowse layer -#+HTML_HEAD_EXTRA: - -[[file:img/eyebrowse.gif]] [[file:img/i3wm.png]] - -* Table of Contents :TOC_4_org:noexport: - - [[Description][Description]] - - [[Install][Install]] - - [[Layer][Layer]] - - [[Removing additional help][Removing additional help]] - - [[Key bindings][Key bindings]] - - [[Transient State][Transient State]] - -* Description -This layer adds [[https://i3wm.org/][i3wm]] like workspaces thanks to the [[https://github.com/wasamasa/eyebrowse][eyebrowse]] package. - -Once the layer is activated a new number is added to the left side of the -mode-line. This number corresponds to the currently active workspace number. - -At startup, the workspace number 1 is active. Switching to a workspace will -create it if it does not exist. For instance at startup you can press -~SPC l w 2~ to create the workspace 2. - -The key bindings are registered in a transient-state displayed in the minibuffer. -The docstring of the transient-state displays the existing workspaces and the -currently active workspace has square brackets. Since this is a transient-state it -is possible to just preview a workspace, for instance press ~SPC l w 2~ to see -what's on the workspace 2 then press ~TAB~ to go back to the previously -activated workspace. - -It is also possible to give a label to a the current workspace by pressing -~r~ in the transient-state. - -* Install -** Layer -To use this configuration layer, add it to your =~/.spacemacs=. You will need to -add =eyebrowse= to the existing =dotspacemacs-configuration-layers= list in this -file. - -** Removing additional help -Once you know the key bindings to navigate between the workspaces you -may want to disable the exhaustive help in the workspace transient-state. -Set the variable =eyebrowse-display-help= to =nil= - -#+BEGIN_SRC emacs-lisp - (setq-default dotspacemacs-configuration-layers - '((eyebrowse :variables eyebrowse-display-help nil))) -#+END_SRC - -* Key bindings - -| Key Binding | Description | -|-------------+--------------------------------------| -| ~gt~ | go to next workspace | -| ~gT~ | got to previous workspace | -| ~SPC b W~ | go to workspace and window by buffer | - -*** Transient State - -| Key Binding | Description | -|-------------------+-------------------------------------------------------------| -| ~SPC l w~ | activate the transient state | -| ~[1..9, 0]~ | switch to nth workspace | -| ~[C-1..C-9, C-0]~ | switch to nth workspace and keep the transient state active | -| ~TAB~ | switch to last active workspace | -| ~d~ | close current workspace | -| ~n~ or ~l~ | switch to next workspace | -| ~N~ or ~p~ or ~h~ | switch to previous workspace | -| ~R~ | set a tag to the current workspace | -| ~w~ | switched to tagged workspace | diff --git a/layers/+window-management/eyebrowse/config.el b/layers/+window-management/eyebrowse/config.el deleted file mode 100644 index dfb2ff4cbd910..0000000000000 --- a/layers/+window-management/eyebrowse/config.el +++ /dev/null @@ -1,19 +0,0 @@ -;;; config.el --- Eyebrowse Layer configuration File for Spacemacs -;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors -;; -;; Author: Sylvain Benner -;; URL: https://github.com/syl20bnr/spacemacs -;; -;; This file is not part of GNU Emacs. -;; -;;; License: GPLv3 - -;; Variables - -(defvar eyebrowse-display-help t - "If non-nil additional help is displayed when selecting a workspace.") - -;; Prefix commands - -(spacemacs/declare-prefix "W" "workspaces") diff --git a/layers/+window-management/eyebrowse/funcs.el b/layers/+window-management/eyebrowse/funcs.el deleted file mode 100644 index dbd026b4ec44c..0000000000000 --- a/layers/+window-management/eyebrowse/funcs.el +++ /dev/null @@ -1,77 +0,0 @@ -;;; funcs.el --- Eyebrowse Layer functions File -;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors -;; -;; Author: Sylvain Benner -;; URL: https://github.com/syl20bnr/spacemacs -;; -;; This file is not part of GNU Emacs. -;; -;;; License: GPLv3 - -(require 'dash) - -;; Eyebrowse uses window-state objects (as returned by `window-state-get') to -;; store window configurations, so here are some utility functions to help us -;; analyse window-states. -;; it might make more sense to move these functions to a more general place - -(defun spacemacs/window-state-window-p (object) - "Return t if OBJECT is a window, as represented in window-state objects. -Note: this function doesn't test for real window objects, but for -representations of a window in a window-state object as returned by -`window-state-get'." - (and (listp object) - (memq (car object) '(leaf vc hc)))) - -(defun spacemacs/window-state-get-buffer (window) - "Get WINDOW's buffer. -WINDOW is the representation of a window in a window-state object. -The returned value is the representation of a buffer in a window-state -object." - (cdr (assq 'buffer window))) - -(defun spacemacs/window-state-get-buffer-name (window) - "Get WINDOW's buffer's name. -WINDOW is the representation of a window in a window-state object." - (car (spacemacs/window-state-get-buffer window))) - -(defun spacemacs/window-state-walk-windows-1 (window fn) - "Helper function for `spacemacs/window-state-walk-windows'." - ;; WINDOW is a misleading name. WINDOW is a list that can represent a window, - ;; or a concatenation of several windows. window-state objects are weird. - (let ((child-windows - (-filter #'spacemacs/window-state-window-p window)) - (bare-window - ;; if WINDOW contains more than one window, take only the first window - (--take-while (not (spacemacs/window-state-window-p it)) - window))) - (--each child-windows - (spacemacs/window-state-walk-windows-1 it fn)) - (push (funcall fn bare-window) result))) - -(defun spacemacs/window-state-walk-windows (state fn) - "Execute FN once for each window in STATE and make a list of the results. -FN is a function to execute. -STATE is a window-state object." - (let (result) - (spacemacs/window-state-walk-windows-1 (cdr state) fn) - result)) - -(defun spacemacs/window-state-all-windows (state) - "Get all windows contained in STATE. -STATE is a window-state object. -The returned windows are not actual window objects. They are windows as -represented in window-state objects." - (spacemacs/window-state-walk-windows state #'identity)) - -(defun spacemacs/window-state-get-buffer-names (state) - "Get names of all buffers saved in STATE. -STATE is a window-state object as returned by `window-state-get'." - (delq nil (spacemacs/window-state-walk-windows state #'spacemacs/window-state-get-buffer-name))) - -(defun spacemacs/window-state-get-buffers (state) - "Get all buffers saved in STATE. -STATE is a window-state object as returned by `window-state-get'." - ;; delq nil - removes buffers stored in STATE that don't exist anymore - (delq nil (mapcar #'get-buffer (spacemacs/window-state-get-buffer-names state)))) diff --git a/layers/+window-management/eyebrowse/img/eyebrowse.gif b/layers/+window-management/eyebrowse/img/eyebrowse.gif deleted file mode 100644 index b64593bad11be..0000000000000 Binary files a/layers/+window-management/eyebrowse/img/eyebrowse.gif and /dev/null differ diff --git a/layers/+window-management/eyebrowse/img/i3wm.png b/layers/+window-management/eyebrowse/img/i3wm.png deleted file mode 100644 index 5fde97aaaac90..0000000000000 Binary files a/layers/+window-management/eyebrowse/img/i3wm.png and /dev/null differ diff --git a/layers/+window-management/eyebrowse/packages.el b/layers/+window-management/eyebrowse/packages.el deleted file mode 100644 index 1c833cb6c8147..0000000000000 --- a/layers/+window-management/eyebrowse/packages.el +++ /dev/null @@ -1,138 +0,0 @@ -;;; packages.el --- Eyebrowse Layer packages File for Spacemacs -;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors -;; -;; Author: Sylvain Benner -;; URL: https://github.com/syl20bnr/spacemacs -;; -;; This file is not part of GNU Emacs. -;; -;;; License: GPLv3 - -(setq eyebrowse-packages '(eyebrowse)) - -(defun eyebrowse/init-eyebrowse () - (use-package eyebrowse - :init - (progn - (setq eyebrowse-new-workspace #'spacemacs/home-delete-other-windows - eyebrowse-wrap-around t) - (eyebrowse-mode) - - ;; vim-style tab switching - (define-key evil-motion-state-map "gt" 'eyebrowse-next-window-config) - (define-key evil-motion-state-map "gT" 'eyebrowse-prev-window-config) - - (spacemacs/set-leader-keys "bW" 'spacemacs/goto-buffer-workspace) - - (defun spacemacs/find-workspace (buffer) - "Find Eyebrowse workspace containing BUFFER. -If several workspaces contain BUFFER, return the first one. Workspaces are -ordered by slot number. -If no workspace contains -BUFFER, return nil." - ;; the second element of a workspace is its window-state object - (--find (memq buffer (spacemacs/window-state-get-buffers (cadr it))) - (eyebrowse--get 'window-configs))) - - (defun spacemacs/display-in-workspace (buffer alist) - "Display BUFFER's workspace. -Return BUFFER's window, if exists, otherwise nil. -If BUFFER is already visible in current workspace, just return its window -without switching workspaces." - (or (get-buffer-window buffer) - (-when-let (workspace (spacemacs/find-workspace buffer)) - (eyebrowse-switch-to-window-config (car workspace)) - (get-buffer-window buffer)))) - - (defun spacemacs/goto-buffer-workspace (buffer) - "Switch to BUFFER's window in BUFFER's workspace. -If BUFFER isn't displayed in any workspace, display it in the current -workspace, preferably in the current window." - (interactive "B") - (pop-to-buffer buffer '((;; reuse buffer window from some workspace - spacemacs/display-in-workspace - ;; fallback to display in current window - display-buffer-same-window) - (inhibit-same-window . nil)))) - - (defun spacemacs/workspaces-ts-rename () - "Rename a workspace and get back to transient-state." - (interactive) - (eyebrowse-rename-window-config (eyebrowse--get 'current-slot) nil) - (spacemacs/workspaces-transient-state/body)) - - (spacemacs|transient-state-format-hint workspaces - spacemacs--workspaces-ts-full-hint - "\n\n - Go to^^^^^^ Remove/Rename...^^ ---^-^--^^^^----------------------- --^-^--------------------------- - [_0_,_9_]^^ nth/new workspace [_d_] close current workspace - [_C-0_,_C-9_]^^ nth/new workspace [_R_] rename current workspace - [_n_/_C-l_]^^ next workspace - [_N_/_p_/_C-h_] prev workspace - [__]^^^^ last workspace\n") - - (spacemacs|define-transient-state workspaces - :title "Workspaces Transient State" - :hint-is-doc t - :dynamic-hint (spacemacs//workspaces-ts-hint) - :bindings - ("0" eyebrowse-switch-to-window-config-0 :exit t) - ("1" eyebrowse-switch-to-window-config-1 :exit t) - ("2" eyebrowse-switch-to-window-config-2 :exit t) - ("3" eyebrowse-switch-to-window-config-3 :exit t) - ("4" eyebrowse-switch-to-window-config-4 :exit t) - ("5" eyebrowse-switch-to-window-config-5 :exit t) - ("6" eyebrowse-switch-to-window-config-6 :exit t) - ("7" eyebrowse-switch-to-window-config-7 :exit t) - ("8" eyebrowse-switch-to-window-config-8 :exit t) - ("9" eyebrowse-switch-to-window-config-9 :exit t) - ("C-0" eyebrowse-switch-to-window-config-0) - ("C-1" eyebrowse-switch-to-window-config-1) - ("C-2" eyebrowse-switch-to-window-config-2) - ("C-3" eyebrowse-switch-to-window-config-3) - ("C-4" eyebrowse-switch-to-window-config-4) - ("C-5" eyebrowse-switch-to-window-config-5) - ("C-6" eyebrowse-switch-to-window-config-6) - ("C-7" eyebrowse-switch-to-window-config-7) - ("C-8" eyebrowse-switch-to-window-config-8) - ("C-9" eyebrowse-switch-to-window-config-9) - ("" eyebrowse-last-window-config) - ("C-h" eyebrowse-prev-window-config) - ("C-i" eyebrowse-last-window-config) - ("C-l" eyebrowse-next-window-config) - ("d" eyebrowse-close-window-config) - ("h" eyebrowse-prev-window-config) - ("l" eyebrowse-next-window-config) - ("n" eyebrowse-next-window-config) - ("N" eyebrowse-prev-window-config) - ("p" eyebrowse-prev-window-config) - ("R" spacemacs/workspaces-ts-rename :exit t) - ("w" eyebrowse-switch-to-window-config :exit t)) - - (defun spacemacs//workspace-format-name (workspace) - "Return a porpertized string given a WORKSPACE name." - (let* ((current (eq (eyebrowse--get 'current-slot) (car workspace))) - (name (nth 2 workspace)) - (number (car workspace)) - (caption (if (< 0 (length name)) - (concat (int-to-string number) ":" name) - (int-to-string number)))) - (if current - (propertize (concat "[" caption "]") 'face 'warning) - caption))) - - (defun spacemacs//workspaces-ts-hint () - "Return a one liner string containing all the workspace names." - (concat - " " - (mapconcat 'spacemacs//workspace-format-name - (eyebrowse--get 'window-configs) " | ") - (when eyebrowse-display-help spacemacs--workspaces-ts-full-hint))) - - ;; The layouts layer defines this keybinding inside a transient-state - ;; thus this is only needed if that layer is not used - (unless (configuration-layer/layer-usedp 'spacemacs-layouts) - (spacemacs/set-leader-keys - "lw" 'spacemacs/workspaces-transient-state/body))))) diff --git a/layers/+window-management/spacemacs-layouts/README.org b/layers/+window-management/spacemacs-layouts/README.org deleted file mode 100644 index 25864557a808f..0000000000000 --- a/layers/+window-management/spacemacs-layouts/README.org +++ /dev/null @@ -1,144 +0,0 @@ -#+TITLE: Spacemacs Layouts layer -#+HTML_HEAD_EXTRA: - -* Table of Contents :TOC_4_org:noexport: - - [[Description][Description]] - - [[Install][Install]] - - [[Layer][Layer]] - - [[Features][Features]] - - [[Transient-states][Transient-states]] - - [[Layouts Transient State][Layouts Transient State]] - - [[Project Layouts][Project Layouts]] - - [[Custom Layouts Transient State][Custom Layouts Transient State]] - - [[Usage][Usage]] - - [[Save/Load layouts into a file][Save/Load layouts into a file]] - - [[Custom Layout Macro][Custom Layout Macro]] - - [[Predefined custom layouts][Predefined custom layouts]] - - [[Org-agenda custom layout][Org-agenda custom layout]] - - [[RCIRC/ERC custom layout][RCIRC/ERC custom layout]] - -* Description -This contribution layer adds layouts support to Spacemacs thanks to =persp-mode=. -Layouts are window configurations that have buffer isolation between each other. - -* Install -** Layer -This layer is automatically included if you use the =spacemacs= distribution. - -If you use =spacemacs-base= distribution then to use this configuration layer, -add it to your =~/.spacemacs=. You will need to add =spacemacs-layout= to the -existing =dotspacemacs-configuration-layers= list in this file. - -* Features - -** Transient-states -*** Layouts Transient State -The layouts transient-state is initiated with ~SPC l~. - -| Key Binding | Description | -|-------------------+------------------------------------------------------------| -| ~?~ | toggle the documentation | -| ~[1..9, 0]~ | switch to nth layout | -| ~[C-1..C-9, C-0]~ | switch to nth layout and keep the transient state active | -| ~~ | switch to the latest layout | -| ~a~ | add a buffer to the current layout | -| ~A~ | add all the buffers from another layout in the current one | -| ~b~ | select a buffer in the current layout | -| ~d~ | delete the current layout and keep its buffers | -| ~D~ | delete the other layouts and keep their buffers | -| ~h~ | go to default layout | -| ~C-h~ | previous layout in list | -| ~l~ | select/create a layout with helm | -| ~L~ | load layouts from file | -| ~C-l~ | next layout in list | -| ~n~ | next layout in list | -| ~N~ | previous layout in list | -| ~o~ | open a custom layout | -| ~p~ | previous layout in list | -| ~r~ | remove current buffer from layout | -| ~R~ | rename current layout | -| ~s~ | save layouts | -| ~t~ | display a buffer without adding it to the current layout | -| ~w~ | workspaces transient-state (needs eyebrowse layer enabled) | -| ~x~ | kill current layout with its buffers | -| ~X~ | kill other layouts with their buffers | - -*** Project Layouts -To create a layout for a specific project use ~SPC p l~. - -*** Custom Layouts Transient State -The layouts transient-state is initiated with ~SPC l o~. - -Example of default custom layouts that are configured in the corresponding -layers: -| Key Binding | Description | -|-------------+-------------------------------------------------------------------------------------------| -| ~e~ | Emacs custom perspective | -| ~E~ | ERC custom perspective (needs the erc layer enabled - configurable, check ERC docs) | -| ~i~ | RCIRC custom perspective (needs the rcirc layer enabled - configurable, check RCIRC docs) | -| ~o~ | Org custom perspective | - -**Note:** You can add more custom perspectives by using the -~spacemacs|define-custom-layout~ macro explained further below. - -* Usage -At the beginning there is only one layout called =Default= which contains -all the buffers. - -If you keep working within this layout then Emacs behaves as if layouts -don't exist so you are never forced to use them even if they are available. - -They are two types of layouts: -- regular layouts which you can create dynamically or which can be bound to - a projectile project (press ~SPC l~ to access them) -- custom layouts which are defined with the macro - =spacemacs|define-custome-layout= and always active (press ~SPC l o~ to - access them). - -** Save/Load layouts into a file -With ~SPC l s~ and ~SPC l L~ you can save and load perspectives to a file. This -is available without configuration, support is great for emacs 24.4, but -depends on =workgroups.el= for Emacs <= 24.3. - -** Custom Layout Macro -If you want to add a new custom layouts (for example if you want to have -IRC on its own perspective or maybe calendar or gnus) you have to use -the macro =spacemacs|define-custom-layout= as follows: - -#+BEGIN_SRC emacs-lisp - (spacemacs|define-custom-layout "" - :binding "" - :body - (...) - ;; (stuff to be done in the persp activating) - ;; (a major mode like twittering-mode or whatever) - (...)) -#+END_SRC - -Other example: - -#+BEGIN_SRC emacs-lisp - (spacemacs|define-custom-layout "c++" - :binding "+" - :body - (find-file "~/path/to/first/file.cpp") - (split-window-right) - (find-file "~/path/to/second/file.cpp") - ;; (... do more stuff but be careful not to destroy the universe ...) - ) -#+END_SRC - -Then you can access this persp with ~SPC l o +~, where ~+~ is the binding. - -** Predefined custom layouts -*** Org-agenda custom layout -Here we define a custom layout that adds items to your org-agenda. If you -do not know what that is check the [[https://www.gnu.org/software/emacs/manual/html_node/org/Agenda-commands.html][docs]]. - -The cool part is that you can have many org files with todos in the agenda and -with one simple command you can gather all the todos from all the agenda files -you have and show them in a single buffer. (in evil the command starts with ~;a~) - -*** RCIRC/ERC custom layout -Now you can also open IRC in a new layout to keep all the chat buffers in -one layout isolated from your work buffers. diff --git a/layers/+window-management/spacemacs-layouts/funcs.el b/layers/+window-management/spacemacs-layouts/funcs.el deleted file mode 100644 index 59436e5f6002c..0000000000000 --- a/layers/+window-management/spacemacs-layouts/funcs.el +++ /dev/null @@ -1,187 +0,0 @@ -;;; funcs.el --- Spacemacs Layouts Layer functions File -;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors -;; -;; Author: Sylvain Benner -;; URL: https://github.com/syl20bnr/spacemacs -;; -;; This file is not part of GNU Emacs. -;; -;;; License: GPLv3 - -(defun spacemacs//current-layout-name () - "Get name of the current perspective." - (safe-persp-name (get-frame-persp))) - -;; Helm related functions -------------------------------------------------- - -(defun spacemacs/persp-helm-mini () - "As `helm-mini' but restricts visible buffers by perspective." - (interactive) - (with-persp-buffer-list () - (helm-mini))) - -(defun spacemacs//helm-perspectives-source () - (helm-build-in-buffer-source - (concat "Current Perspective: " (spacemacs//current-layout-name)) - :data (persp-names) - :fuzzy-match t - :action - '(("Switch to perspective" . persp-switch) - ("Close perspective(s)" . (lambda (candidate) - (mapcar - 'persp-kill-without-buffers - (helm-marked-candidates)))) - ("Kill perspective(s)" . (lambda (candidate) - (mapcar 'persp-kill - (helm-marked-candidates))))))) -(defun spacemacs/helm-perspectives () - "Control Panel for perspectives. Has many actions. -If match is found -f1: (default) Select perspective -f2: Close Perspective(s) <- mark with C-SPC to close more than one-window -f3: Kill Perspective(s) - -If match is not found - Creates perspective - -Closing doesn't kill buffers inside the perspective while killing -perspectives does." - (interactive) - (helm - :buffer "*Helm Perspectives*" - :sources - `(,(spacemacs//helm-perspectives-source) - ,(helm-build-dummy-source "Create new perspective" - :requires-pattern t - :action - '(("Create new perspective" . - (lambda (name) - (let ((persp-reset-windows-on-nil-window-conf t)) - (persp-switch name) - (unless (member name (persp-names-current-frame-fast-ordered)) - (spacemacs/home)))))))))) - -;; ability to use helm find files but also adds to current perspective -(defun spacemacs/helm-persp-close () - "Kills perspectives without killing the buffers" - (interactive) - (helm - :buffer "*Helm Kill Perspectives (without killing buffers)*" - :sources - (helm-build-in-buffer-source - (concat "Current Perspective: " (spacemacs//current-layout-name)) - :data (persp-names) - :fuzzy-match t - :action - '(("Close perspective(s)" . (lambda (candidate) - (mapcar - 'persp-kill-without-buffers - (helm-marked-candidates)))))))) - -(defun spacemacs/helm-persp-kill () - "Kills perspectives with all their buffers" - (interactive) - (helm - :buffer "*Helm Kill Perspectives with all their buffers*" - :sources (helm-build-in-buffer-source - (s-concat "Current Perspective: " - (spacemacs//current-layout-name)) - :data (persp-names) - :fuzzy-match t - :action - '(("Kill perspective(s)" . - (lambda (candidate) - (mapcar 'persp-kill - (helm-marked-candidates)))))))) - -;; Helm Projectile related functions --------------------------------------- - -(defun spacemacs/helm-persp-switch-project (arg) - (interactive "P") - (helm - :sources - (helm-build-in-buffer-source "*Helm Switch Project Layout*" - :data (lambda () - (if (projectile-project-p) - (cons (abbreviate-file-name (projectile-project-root)) - (projectile-relevant-known-projects)) - projectile-known-projects)) - :fuzzy-match helm-projectile-fuzzy-match - :mode-line helm-read-file-name-mode-line-string - :action '(("Switch to Project Perspective" . - (lambda (project) - (let ((persp-reset-windows-on-nil-window-conf t)) - (persp-switch project) - (let ((projectile-completion-system 'helm)) - (projectile-switch-project-by-name project))))))) - :buffer "*Helm Projectile Layouts*")) - -;; Autosave ---------------------------------------------------------------- - -(defun spacemacs//layout-autosave () - "Perspectives mode autosave. -Autosaves perspectives layouts every `persp-autosave-interal' seconds. -Cancels autosave on exiting perspectives mode." - (if (and persp-mode layouts-enable-autosave) - (progn - (message "Perspectives mode autosaving enabled.") - (setq spacemacs--layouts-autosave-timer - (run-with-timer - layouts-autosave-delay - layouts-autosave-delay - (lambda () - (message "Saving perspectives to file.") - (persp-save-state-to-file))))) - (when spacemacs--layouts-autosave-timer - (cancel-timer spacemacs--layouts-autosave-timer) - (setq spacemacs--layouts-autosave-timer nil)))) - -;; Eyebrowse - allow perspective-local workspaces -------------------------- - -(defun spacemacs/load-eyebrowse-for-perspective (&optional frame) - "Load an eyebrowse workspace according to a perspective's parameters. -FRAME's perspective is the perspective that is considered, defaulting to -the current frame's perspective. -If the perspective doesn't have a workspace, create one." - (let* ((persp (get-frame-persp frame)) - (window-configs (persp-parameter 'eyebrowse-window-configs persp)) - (current-slot (persp-parameter 'eyebrowse-current-slot persp)) - (last-slot (persp-parameter 'eyebrowse-last-slot persp))) - (if window-configs - (progn - (eyebrowse--set 'window-configs window-configs frame) - (eyebrowse--set 'current-slot current-slot frame) - (eyebrowse--set 'last-slot last-slot frame) - (eyebrowse--load-window-config current-slot)) - (eyebrowse--set 'window-configs nil frame) - (eyebrowse-init frame) - (spacemacs/save-eyebrowse-for-perspective frame)))) - -(defun spacemacs/update-eyebrowse-for-perspective (_new-persp-name) - "Update and save current frame's eyebrowse workspace to its perspective. -Parameter _NEW-PERSP-NAME is ignored, and exists only for compatibility with -`persp-before-switch-functions'." - (let* ((current-slot (eyebrowse--get 'current-slot)) - (current-tag (nth 2 (assoc current-slot (eyebrowse--get 'window-configs))))) - (eyebrowse--update-window-config-element - (eyebrowse--current-window-config current-slot current-tag))) - (spacemacs/save-eyebrowse-for-perspective)) - -(defun spacemacs/save-eyebrowse-for-perspective (&optional frame) - "Save FRAME's eyebrowse workspace to FRAME's perspective. -FRAME defaults to the current frame." - (let ((persp (get-frame-persp frame))) - (set-persp-parameter - 'eyebrowse-window-configs (eyebrowse--get 'window-configs frame) persp) - (set-persp-parameter - 'eyebrowse-current-slot (eyebrowse--get 'current-slot frame) persp) - (set-persp-parameter - 'eyebrowse-last-slot (eyebrowse--get 'last-slot frame) persp))) - -(defun spacemacs/layout-workspaces-transient-state () - "Launches the workspaces transient state, if defined." - (interactive) - (if (fboundp 'spacemacs/workspaces-transient-state/body) - (call-interactively 'spacemacs/workspaces-transient-state/body) - (message "You need the eyebrowse layer to use this feature."))) diff --git a/layers/+window-management/spacemacs-layouts/packages-funcs.el b/layers/+window-management/spacemacs-layouts/packages-funcs.el deleted file mode 100644 index 1e5d252b77d67..0000000000000 --- a/layers/+window-management/spacemacs-layouts/packages-funcs.el +++ /dev/null @@ -1,268 +0,0 @@ -(defun spacemacs/jump-to-last-layout () - "Open the previously selected layout, if it exists." - (interactive) - (unless (eq 'non-existent - (gethash spacemacs--last-selected-layout - *persp-hash* 'non-existent)) - (persp-switch spacemacs--last-selected-layout))) - -;; Perspectives transient-state ------------------------------------------- - -(defun spacemacs//layouts-ts-toggle-hint () - "Toggle the full hint docstring for the layouts transient-state." - (interactive) - (setq spacemacs--layouts-ts-full-hint-toggle - (logxor spacemacs--layouts-ts-full-hint-toggle 1))) - -(defun spacemacs//layout-format-name (name pos) - "Format the layout name given by NAME for display in mode-line." - (let* ((layout-name (if (file-directory-p name) - (file-name-nondirectory (directory-file-name name)) - name)) - (string-name (format "%s" layout-name)) - (current (equal name (spacemacs//current-layout-name))) - (caption (concat (number-to-string (if (eq 9 pos) 0 (1+ pos))) - ":" string-name))) - (if current - (propertize (concat "[" caption "]") 'face 'warning) - caption))) - -(defun spacemacs//layouts-ts-hint () - "Return a one liner string containing all the layout names." - (let* ((persp-list (or (persp-names-current-frame-fast-ordered) - (list persp-nil-name))) - (formatted-persp-list - (concat " " - (mapconcat (lambda (persp) - (spacemacs//layout-format-name - persp (position persp persp-list))) - persp-list " | ")))) - (concat - formatted-persp-list - (if (equal 1 spacemacs--layouts-ts-full-hint-toggle) - spacemacs--layouts-ts-full-hint - (concat " ([" - (propertize "?" 'face 'hydra-face-red) - "] help)"))))) - -(spacemacs|transient-state-format-hint layouts - spacemacs--layouts-ts-full-hint - "\n\n - Go to^^^^^^ Add/Remove/Rename...^^ ---^-^--^^^^----------------------- --^-^--------------------------- - [_b_]^^^^ buffer in layout [_a_] add buffer - [_h_]^^^^ default layout [_A_] add all from layout - [_o_]^^^^ custom layout [_r_] remove current buffer - [_l_]^^^^ layout w/helm/ivy [_d_] close current layout - [_L_]^^^^ layouts in file [_D_] close other layout - [_0_,_9_]^^ nth/new layout [_x_] kill current w/buffers - [_C-0_,_C-9_]^^ nth/new layout [_X_] kill other w/buffers - [_n_/_C-l_]^^ next layout [_R_] rename current layout - [_N_/_p_/_C-h_] prev layout - [__]^^^^ last layout ---^^^^^^^^---------------------------------------------------------- - [_s_/_S_] save all layouts/save by names - [_t_]^^ show a buffer without adding it to current layout - [_w_]^^ workspaces micro-state (requires eyebrowse layer) - [_?_]^^ toggle help\n") - -(spacemacs|define-transient-state layouts - :title "Layouts Transient State" - :hint-is-doc t - :dynamic-hint (spacemacs//layouts-ts-hint) - :bindings - ;; need to exit in case number doesn't exist - ("?" spacemacs//layouts-ts-toggle-hint) - ("1" spacemacs/persp-switch-to-1 :exit t) - ("2" spacemacs/persp-switch-to-2 :exit t) - ("3" spacemacs/persp-switch-to-3 :exit t) - ("4" spacemacs/persp-switch-to-4 :exit t) - ("5" spacemacs/persp-switch-to-5 :exit t) - ("6" spacemacs/persp-switch-to-6 :exit t) - ("7" spacemacs/persp-switch-to-7 :exit t) - ("8" spacemacs/persp-switch-to-8 :exit t) - ("9" spacemacs/persp-switch-to-9 :exit t) - ("0" spacemacs/persp-switch-to-0 :exit t) - ("C-1" spacemacs/persp-switch-to-1) - ("C-2" spacemacs/persp-switch-to-2) - ("C-3" spacemacs/persp-switch-to-3) - ("C-4" spacemacs/persp-switch-to-4) - ("C-5" spacemacs/persp-switch-to-5) - ("C-6" spacemacs/persp-switch-to-6) - ("C-7" spacemacs/persp-switch-to-7) - ("C-8" spacemacs/persp-switch-to-8) - ("C-9" spacemacs/persp-switch-to-9) - ("C-0" spacemacs/persp-switch-to-0) - ("" spacemacs/jump-to-last-layout) - ("" nil :exit t) - ("C-h" persp-prev) - ("C-l" persp-next) - ("a" persp-add-buffer :exit t) - ("A" persp-import-buffers :exit t) - ("b" spacemacs/persp-helm-mini :exit t) - ("d" spacemacs/layouts-ts-close) - ("D" spacemacs/layouts-ts-close-other :exit t) - ("h" spacemacs/layout-goto-default :exit t) - ("l" spacemacs/helm-perspectives :exit t) - ("L" persp-load-state-from-file :exit t) - ("n" persp-next) - ("N" persp-prev) - ("o" spacemacs/select-custom-layout :exit t) - ("p" persp-prev) - ("r" persp-remove-buffer :exit t) - ("R" spacemacs/layouts-ts-rename :exit t) - ("s" persp-save-state-to-file :exit t) - ("S" persp-save-to-file-by-names :exit t) - ("t" persp-temporarily-display-buffer :exit t) - ("w" spacemacs/layout-workspaces-transient-state :exit t) - ("x" spacemacs/layouts-ts-kill) - ("X" spacemacs/layouts-ts-kill-other :exit t)) - -(defun spacemacs/layout-switch-by-pos (pos) - "Switch to perspective of position POS." - (let ((persp-to-switch - (nth pos (persp-names-current-frame-fast-ordered)))) - (if persp-to-switch - (persp-switch persp-to-switch) - (when (y-or-n-p - (concat "Perspective in this position doesn't exist.\n" - "Do you want to create one? ")) - (let ((persp-reset-windows-on-nil-window-conf t)) - (persp-switch nil) - (spacemacs/home-delete-other-windows)))))) - -;; Define all `spacemacs/persp-switch-to-X' functions -(dolist (i (number-sequence 9 0 -1)) - (eval `(defun ,(intern (format "spacemacs/persp-switch-to-%s" i)) nil - ,(format "Switch to layout %s." i) - (interactive) - (spacemacs/layout-switch-by-pos ,(if (eq 0 i) 9 (1- i)))))) - -(defun spacemacs/layout-goto-default () - "Go to `dotspacemacs-default-layout-name` layout" - (interactive) - (when dotspacemacs-default-layout-name - (persp-switch dotspacemacs-default-layout-name))) - -(defun spacemacs/layouts-ts-rename () - "Rename a layout and get back to the perspectives transient-state." - (interactive) - (call-interactively 'persp-rename) - (spacemacs/layouts-transient-state/body)) - -(defun spacemacs/layouts-ts-close () - "Kill current perspective" - (interactive) - (persp-kill-without-buffers (spacemacs//current-layout-name))) - -(defun spacemacs/layouts-ts-close-other () - (interactive) - (call-interactively 'spacemacs/helm-persp-close) - (spacemacs/layouts-transient-state/body)) - -(defun spacemacs/layouts-ts-kill () - "Kill current perspective" - (interactive) - (persp-kill (spacemacs//current-layout-name))) - -(defun spacemacs/layouts-ts-kill-other () - (interactive) - (call-interactively 'spacemacs/helm-persp-kill) - (spacemacs/layouts-transient-state/body)) - -;; Custom perspectives transient-state ------------------------------------- - -(defun spacemacs//custom-layout-func-name (name) - "Return the name of the custom-perspective function for NAME." - (intern (concat "spacemacs/custom-perspective-" name))) - -(defmacro spacemacs|define-custom-layout (name &rest props) - "Define a custom-perspective called NAME. - -FUNC is a FUNCTION defined using NAME and the result of -`spacemacs//custom-layout-func-name', it takes care of -creating the perspective NAME and executing the expressions given -in the :body property to this macro. - -NAME is a STRING. - -Available PROPS: - -`:binding STRING' - Key to be bound to the function FUNC - -`:body EXPRESSIONS' - One or several EXPRESSIONS that are going to be evaluated after - we change into the perspective NAME." - (declare (indent 1)) - (let* ((name (if (symbolp name) - (symbol-value name) - name)) - (func (spacemacs//custom-layout-func-name name)) - (binding-prop (car (spacemacs/mplist-get props :binding))) - (binding (if (symbolp binding-prop) - (symbol-value binding-prop) - binding-prop)) - (body (spacemacs/mplist-get props :body)) - (already-defined? (cdr (assoc binding - spacemacs--custom-layout-alist)))) - `(progn - (defun ,func () - ,(format "Open custom perspective %s" name) - (interactive) - (let ((initialize (not (gethash ,name *persp-hash*)))) - (persp-switch ,name) - (when initialize - (delete-other-windows) - ,@body))) - ;; Check for Clashes - (if ,already-defined? - (unless (equal ,already-defined? ,name) - (spacemacs-buffer/warning "Replacing existing binding \"%s\" for %s with %s" - ,binding ,already-defined? ,name) - (push '(,binding . ,name) spacemacs--custom-layout-alist)) - (push '(,binding . ,name) spacemacs--custom-layout-alist))))) - -(defun spacemacs/select-custom-layout () - "Update the custom-perspectives transient-state and then activate it." - (interactive) - (spacemacs//update-custom-layouts) - (spacemacs/custom-layouts-transient-state/body)) - -(defun spacemacs//custom-layouts-ms-documentation () - "Return the docstring for the custom perspectives transient-state." - (if spacemacs--custom-layout-alist - (mapconcat (lambda (custom-persp) - (format "[%s] %s" - (car custom-persp) (cdr custom-persp))) - spacemacs--custom-layout-alist " ") - (spacemacs-buffer/warning (format "`spacemacs--custom-layout-alist' variable is empty" )))) - -(defun spacemacs//update-custom-layouts () - "Ensure the custom-perspectives transient-state is updated. -Takes each element in the list `spacemacs--custom-layout-alist' -format so they are supported by the -`spacemacs/custom-layouts-transient-state' macro." - (let (bindings) - (dolist (custom-persp spacemacs--custom-layout-alist bindings) - (let* ((binding (car custom-persp)) - (name (cdr custom-persp)) - (func-name (spacemacs//custom-layout-func-name name))) - (push (list binding func-name :exit t) bindings))) - (eval `(spacemacs|define-transient-state custom-layouts - :doc (concat (spacemacs//custom-layouts-ms-documentation)) - :bindings - ,@bindings)))) - -(defun spacemacs/alternate-buffer-in-persp () - "Switch back and forth between current and last buffer in the -current perspective." - (interactive) - (with-persp-buffer-list () - (switch-to-buffer (other-buffer (current-buffer) t)))) - -(defun spacemacs-layouts/non-restricted-buffer-list () - (interactive) - (remove-hook 'ido-make-buffer-list-hook #'persp-restrict-ido-buffers) - (helm-mini) - (add-hook 'ido-make-buffer-list-hook #'persp-restrict-ido-buffers)) diff --git a/layers/+window-management/spacemacs-layouts/packages.el b/layers/+window-management/spacemacs-layouts/packages.el deleted file mode 100644 index 858fed4379c41..0000000000000 --- a/layers/+window-management/spacemacs-layouts/packages.el +++ /dev/null @@ -1,88 +0,0 @@ -;;; packages.el --- Spacemacs Layouts Layer packages File for Spacemacs -;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors -;; -;; Author: Sylvain Benner -;; URL: https://github.com/syl20bnr/spacemacs -;; -;; This file is not part of GNU Emacs. -;; -;;; License: GPLv3 -(setq spacemacs-layouts-packages - '(;; temporary switch on a fork to fix - ;; https://github.com/syl20bnr/spacemacs/issues/4120 - (persp-mode :location (recipe :fetcher github - :repo "syl20bnr/persp-mode.el" - :branch "fix-emacsclient-crash")) - spaceline - eyebrowse - helm - swiper)) - -(defun spacemacs-layouts/init-persp-mode () - (use-package persp-mode - :diminish persp-mode - :init - (progn - (setq persp-auto-resume-time (if (or dotspacemacs-auto-resume-layouts - spacemacs-force-resume-layouts) - 1 -1) - persp-nil-name dotspacemacs-default-layout-name - persp-reset-windows-on-nil-window-conf nil - persp-set-last-persp-for-new-frames nil - persp-save-dir spacemacs-layouts-directory) - - ;; always activate persp-mode - (persp-mode) - - (spacemacs/set-leader-keys "l" 'spacemacs/layouts-transient-state/body) - - (spacemacs|define-custom-layout "@Spacemacs" - :binding "e" - :body - (spacemacs/find-dotfile))) - :config - (progn - (defadvice persp-activate (before spacemacs//save-toggle-layout activate) - (setq spacemacs--last-selected-layout persp-last-persp-name)) - (add-hook 'persp-mode-hook 'spacemacs//layout-autosave) - - (spacemacs/declare-prefix "b" "persp-buffers") - (spacemacs/declare-prefix "B" "global-buffers") - - ;; Override SPC TAB to only change buffers in perspective - (spacemacs/set-leader-keys - "TAB" 'spacemacs/alternate-buffer-in-persp - "ba" 'persp-add-buffer - "br" 'persp-remove-buffer - "Bb" 'spacemacs-layouts/non-restricted-buffer-list)))) - -(defun spacemacs-layouts/post-init-spaceline () - (setq spaceline-display-default-perspective - dotspacemacs-display-default-layout)) - -(defun spacemacs-layouts/post-init-eyebrowse () - (add-hook 'persp-before-switch-functions #'spacemacs/update-eyebrowse-for-perspective) - (add-hook 'eyebrowse-post-window-switch-hook #'spacemacs/save-eyebrowse-for-perspective) - (add-hook 'persp-activated-hook #'spacemacs/load-eyebrowse-for-perspective)) - -(defun spacemacs-layouts/post-init-helm () - (spacemacs/set-leader-keys - "pl" 'spacemacs/helm-persp-switch-project)) - -(defun spacemacs-layouts/post-init-swiper () - (defun spacemacs/ivy-persp-switch-project (arg) - (interactive "P") - (ivy-read "Switch to Project Perspective: " - (if (projectile-project-p) - (cons (abbreviate-file-name (projectile-project-root)) - (projectile-relevant-known-projects)) - projectile-known-projects) - :action (lambda (project) - (let ((persp-reset-windows-on-nil-window-conf t)) - (persp-switch project) - (let ((projectile-completion-system 'ivy)) - (projectile-switch-project-by-name project)))))) - - (spacemacs/set-leader-keys - "pl" 'spacemacs/ivy-persp-switch-project)) diff --git a/layers/auto-layer.el b/layers/auto-layer.el new file mode 100644 index 0000000000000..0896191e8f22f --- /dev/null +++ b/layers/auto-layer.el @@ -0,0 +1,119 @@ +;;; auto-layer.el --- auto-mode-alist entries for layer installation +;; +;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; +;; Author: Sylvain Benner +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + +;; TODO comments placeholder means the utility function to insert form has failed + +;; agda + +(configuration-layer/lazy-install 'ansible :extensions '("\\(\\.jinja2\\'\\|\\.j2\\'\\)" jinja2-mode)) + +(configuration-layer/lazy-install 'asciidoc :extensions '("\\(\\.adoc?$\\)" adoc-mode)) + +(configuration-layer/lazy-install 'autohotkey :extensions '("\\(\\.ahk\\'\\|\\.ahk$\\)" ahk-mode)) + +(configuration-layer/lazy-install 'clojure :extensions '("\\(\\.\\(clj\\|dtm\\|edn\\)\\'\\|\\(?:build\\|profile\\)\\.boot\\'\\|\\.boot\\'\\)" clojure-mode)) + +;; common-lisp + +;; csharp + +(configuration-layer/lazy-install 'csv :extensions '("\\(\\.[Cc][Ss][Vv]\\'\\)" csv-mode)) + +(configuration-layer/lazy-install 'd :extensions '("\\(\\.d[i]?\\'\\)" d-mode)) + +(configuration-layer/lazy-install 'elixir :extensions '("\\.\\(ex\\|exs\\|elixir\\)\\'" elixir-mode)) + +(configuration-layer/lazy-install 'elm :extensions '("\\(\\.elm\\'\\)" elm-mode)) + +(configuration-layer/lazy-install 'erlang :extensions '("\\(\\.erl$\\|\\.app\\.src$\\|\\.escript\\|\\.hrl$\\|\\.xrl$\\|\\.yrl\\|/ebin/.+\\.app\\|\\.erl\\'\\|\\.hrl\\'\\)" erlang-mode)) + +;; ess + +(configuration-layer/lazy-install 'finance :extensions '("\\(\\.\\(ledger\\|ldg\\)\\'\\)" ledger-mode)) + +(configuration-layer/lazy-install 'fsharp :extensions '("\\(\\.fs[iylx]?$\\)" fsharp-mode)) + +(configuration-layer/lazy-install 'go :extensions '("\\(\\.go\\'\\)" go-mode)) + +(configuration-layer/lazy-install 'graphviz :extensions '("\\(\\.dot\\'\\|\\.gv\\'\\|\\.diag\\'\\|\\.blockdiag\\'\\|\\.nwdiag\\'\\|\\.rackdiag\\'\\)" graphviz-dot-mode)) + +(configuration-layer/lazy-install 'haskell :extensions '("\\(\\.cmm\\'\\)" cmm-mode)) +(configuration-layer/lazy-install 'haskell :extensions '("\\(\\.[gh]s\\'\\|\\.hsc\\'\\)" haskell-mode)) + +(configuration-layer/lazy-install 'html :extensions '("\\(\\.css\\'\\)" css-mode)) +(configuration-layer/lazy-install 'html :extensions '("\\(\\.haml\\'\\)" haml-mode)) +(configuration-layer/lazy-install 'html :extensions '("\\(\\.jade\\'\\)" jade-mode)) +(configuration-layer/lazy-install 'html :extensions '("\\(\\.less\\'\\)" less-css-mode)) +(configuration-layer/lazy-install 'html :extensions '("\\(\\.sass\\'\\)" sass-mode)) +(configuration-layer/lazy-install 'html :extensions '("\\(\\.scss\\'\\)" scss-mode)) +(configuration-layer/lazy-install 'html :extensions '("\\(\\.slim\\'\\)" slim-mode)) +(configuration-layer/lazy-install 'html :extensions '("\\(\\.phtml\\'\\|\\.tpl\\.php\\'\\|\\.twig\\'\\|\\.html\\'\\|\\.htm\\'\\|\\.[gj]sp\\'\\|\\.as[cp]x?\\'\\|\\.eex\\'\\|\\.erb\\'\\|\\.mustache\\'\\|\\.handlebars\\'\\|\\.hbs\\'\\|\\.eco\\'\\|\\.ejs\\'\\|\\.djhtml\\'\\)" web-mode)) + +(configuration-layer/lazy-install 'idris :extensions '("\\(\\.idr$\\|\\.lidr$\\)" idris-mode)) + +;; java + +(configuration-layer/lazy-install 'javascript :extensions '("\\(\\.coffee\\'\\|\\.iced\\'\\|Cakefile\\'\\|\\.cson\\'\\)" coffee-mode)) +(configuration-layer/lazy-install 'javascript :extensions '("\\(\\.js\\'\\)" js2-mode)) +(configuration-layer/lazy-install 'javascript :extensions '("\\(\\.json$\\)" json-mode)) + +;; latex + +(configuration-layer/lazy-install 'lua :extensions '("\\(\\.lua$\\|\\.lua\\'\\)" lua-mode)) + +(configuration-layer/lazy-install 'nginx :extensions '("\\(nginx\\.conf\\'\\|/nginx/.+\\.conf\\'\\)" nginx-mode)) + +(configuration-layer/lazy-install 'octave :extensions '("\\(\\.m\\'\\)" octave-mode)) + +(configuration-layer/lazy-install 'markdown :extensions '("\\(\\.markdown\\'\\|\\.md\\'\\|\\.m[k]d\\)" markdown-mode)) + +(configuration-layer/lazy-install 'ocaml :extensions '("\\(\\.ml[ip]?\\'\\|\\.eliomi?\\'\\)" tuareg-mode)) + +(configuration-layer/lazy-install 'php :extensions '("\\(\\.amk\\'\\|/Amkfile\\'\\|\\.phtml\\'\\|\\.php[s345t]?\\'\\|[^/]\\.\\(module\\|test\\|install\\|profile\\|tpl\\.php\\|theme\\|inc\\)\\'\\|\\.php\\'\\)" php-mode)) + +(configuration-layer/lazy-install 'purescript :extensions '("\\(\\.purs\\'\\)" purescript-mode)) + +(configuration-layer/lazy-install 'python :extensions '("\\(\\.pyx\\'\\|\\.pxd\\'\\|\\.pxi\\'\\)" cython-mode)) +(configuration-layer/lazy-install 'python :extensions '("\\(\\.hy\\'\\)" hy-mode)) +(configuration-layer/lazy-install 'python :extensions '("\\(\\.pip\\'\\|requirements\\(?:.\\|\n\\)*\\.txt\\'\\)" pip-requirements-mode)) +(configuration-layer/lazy-install 'python :extensions '("\\(\\.py\\'\\)" python-mode)) + +(configuration-layer/lazy-install 'racket :extensions '("\\(\\.rkt[dl]?\\'\\)" racket-mode)) + +;; TODO check how to support for the layer variable `restclient-use-org' +(configuration-layer/lazy-install 'restclient :extensions '("\\(\\.http\\'\\)" restclient-mode)) + +(configuration-layer/lazy-install 'ruby + :extensions '("\\(\\(?:\\.rb\\|ru\\|rake\\|thor\\|jbuilder\\|gemspec\\|podspec\\|/\\(?:Gem\\|Rake\\|Cap\\|Thor\\|Vagrant\\|Guard\\|Pod\\)file\\)\\'\\|Puppetfile\\)" ruby-mode)) + +(configuration-layer/lazy-install 'rust :extensions '("\\(\\.rs\\'\\)" rust-mode)) +(configuration-layer/lazy-install 'rust :extensions '("\\(\\.toml$\\)" toml-mode)) + +;; scala + +;; scheme + +(configuration-layer/lazy-install 'sml :extensions '("\\(\\.s\\(ml\\|ig\\)\\'\\|\\.\\(sml\\|sig\\)\\'\\)" sml-mode)) + +(configuration-layer/lazy-install 'sql :extensions '("\\(\\.sql\\'\\)" sql-mode)) + +(configuration-layer/lazy-install 'swift :extensions '("\\(\\.swift\\'\\)" swift-mode)) + +(configuration-layer/lazy-install 'shell-scripts :extensions '("\\(\\.fish\\'\\|/fish_funced\\..*\\'\\)" fish-mode)) + +(configuration-layer/lazy-install 'typescript :extensions '("\\(\\.ts$\\)" typescript-mode)) + +(configuration-layer/lazy-install 'vimscript :extensions '("\\(\\.vim\\'\\|[._]?g?vimrc\\'\\|\\.exrc\\'\\|_vimrc\\'\\|\\.vim[rc]?\\'\\)" vimrc-mode)) +(configuration-layer/lazy-install 'vimscript :extensions '("\\(_vimperatorrc\\'\\|_pentadactylrc\\'\\|\\.penta\\'\\|vimperatorrc\\'\\|\\.vimp\\'\\|pentadactylrc\\'\\)" dactyl-mode)) + +;; windows-script + +(configuration-layer/lazy-install 'yaml :extensions '("\\(\\.e?ya?ml$\\|\\.\\(yml\\|yaml\\)\\'\\|Procfile\\'\\)" yaml-mode)) diff --git a/layers/restclient/packages.el b/layers/restclient/packages.el deleted file mode 100644 index 5f583ae9f9c74..0000000000000 --- a/layers/restclient/packages.el +++ /dev/null @@ -1,26 +0,0 @@ -(setq restclient-packages - '( - restclient - ) - ) - -(defun restclient/init-restclient () - (use-package restclient - :mode ("\\.http\\'" . restclient-mode) - :defer t - :init - (progn - - (defun restclient-http-send-current-raw-stay-in-window () - (interactive) - (restclient-http-send-current t t)) - - (spacemacs/set-leader-keys-for-major-mode 'restclient-mode - "s" 'restclient-http-send-current-stay-in-window - "S" 'restclient-http-send-current - "r" 'restclient-http-send-current-raw-stay-in-window - "R" 'restclient-http-send-current-raw - "y" 'restclient-copy-curl-command - )) - ) - ) diff --git a/tests/core/core-configuration-layer-utest.el b/tests/core/core-configuration-layer-utest.el index 18b562aa805cb..0afe39bd0ff08 100644 --- a/tests/core/core-configuration-layer-utest.el +++ b/tests/core/core-configuration-layer-utest.el @@ -33,6 +33,8 @@ ;; class cfgl-package ;; --------------------------------------------------------------------------- +;; method: cfgl-package-enabledp + (ert-deftest test-cfgl-package-enabledp--default-toggle-eval-non-nil () (let ((pkg (cfgl-package "testpkg" :name 'testpkg))) (should (cfgl-package-enabledp pkg)))) @@ -537,6 +539,95 @@ (should (equal (list (cfgl-package "pkg1" :name 'pkg1 :owner 'layer18 :excluded t)) (configuration-layer/get-packages layers)))))) +(ert-deftest test-get-packages--owner-layer-can-define-toggle () + (let* ((layer19 (cfgl-layer "layer19" :name 'layer19 :dir "/path")) + (layers (list layer19)) + (layer19-packages '((pkg1 :toggle (foo-toggle)))) + (mocker-mock-default-record-cls 'mocker-stub-record)) + (defun layer19/init-pkg1 nil) + (mocker-let + ((file-exists-p (f) ((:output t :occur 1))) + (configuration-layer/layer-usedp (l) ((:output t :occur 1)))) + (should (equal (list (cfgl-package "pkg1" + :name 'pkg1 + :owner 'layer19 + :toggle '(foo-toggle))) + (configuration-layer/get-packages layers)))))) + +(ert-deftest test-get-packages--not-owner-layer-cannot-define-toggle () + (let* ((layer20 (cfgl-layer "layer20" :name 'layer20 :dir "/path")) + (layer21 (cfgl-layer "layer21" :name 'layer21 :dir "/path")) + (layers (list layer20 layer21)) + (layer20-packages '((pkg1))) + (layer21-packages '((pkg1 :toggle (foo-toggle)))) + (mocker-mock-default-record-cls 'mocker-stub-record)) + (defun layer20/init-pkg1 nil) + (defun layer21/post-init-pkg1 nil) + (mocker-let + ((file-exists-p (f) ((:output t :occur 2))) + (spacemacs-buffer/warning (msg &rest args) ((:output nil :occur 1))) + (configuration-layer/layer-usedp (l) ((:output t :occur 2)))) + (should (equal (list (cfgl-package "pkg1" + :name 'pkg1 + :owner 'layer20 + :post-layers '(layer21) + :toggle t)) + (configuration-layer/get-packages layers)))))) + +(ert-deftest test-get-packages--new-owner-layer-can-override-toggle () + (let* ((layer22 (cfgl-layer "layer22" :name 'layer22 :dir "/path")) + (layer23 (cfgl-layer "layer23" :name 'layer23 :dir "/path")) + (layers (list layer22 layer23)) + (layer22-packages '((pkg1 :toggle (foo-toggle)))) + (layer23-packages '((pkg1 :toggle (bar-toggle)))) + (mocker-mock-default-record-cls 'mocker-stub-record)) + (defun layer22/init-pkg1 nil) + (defun layer23/init-pkg1 nil) + (mocker-let + ((file-exists-p (f) ((:output t :occur 2))) + (spacemacs-buffer/warning (msg &rest args) ((:output nil :occur 1))) + (configuration-layer/layer-usedp (l) ((:output t :occur 2)))) + (should (equal (list (cfgl-package "pkg1" + :name 'pkg1 + :owner 'layer23 + :toggle '(bar-toggle))) + (configuration-layer/get-packages layers)))))) + +(ert-deftest test-get-packages--dotfile-additional-pkg-can-override-toggle () + (let* ((layer22 (cfgl-layer "layer22" :name 'layer22 :dir "/path")) + (layer23 (cfgl-layer "layer23" :name 'layer23 :dir "/path")) + (layers (list layer22 layer23)) + (layer22-packages '((pkg1 :toggle (foo-toggle)))) + (layer23-packages '((pkg1 :toggle (bar-toggle)))) + (mocker-mock-default-record-cls 'mocker-stub-record)) + (defun layer22/init-pkg1 nil) + (defun layer23/init-pkg1 nil) + (mocker-let + ((file-exists-p (f) ((:output t :occur 2))) + (spacemacs-buffer/warning (msg &rest args) ((:output nil :occur 1))) + (configuration-layer/layer-usedp (l) ((:output t :occur 2)))) + (should (equal (list (cfgl-package "pkg1" + :name 'pkg1 + :owner 'layer23 + :toggle '(bar-toggle))) + (configuration-layer/get-packages layers)))))) + +(ert-deftest test-get-packages--dotfile-additional-pkg-can-override-toggle () + (let* ((layer24 (cfgl-layer "layer24" :name 'layer24 :dir "/path")) + (layers (list layer24)) + (layer24-packages '((pkg1 :toggle (foo-toggle)))) + (dotspacemacs-additional-packages '((pkg1 :toggle (bar-toggle)))) + (mocker-mock-default-record-cls 'mocker-stub-record)) + (defun layer24/init-pkg1 nil) + (mocker-let + ((file-exists-p (f) ((:output t :occur 1))) + (configuration-layer/layer-usedp (l) ((:output t :occur 1)))) + (should (equal (list (cfgl-package "pkg1" + :name 'pkg1 + :owner 'layer24 + :toggle '(bar-toggle))) + (configuration-layer/get-packages layers t)))))) + ;; --------------------------------------------------------------------------- ;; configuration-layer//configure-package ;; --------------------------------------------------------------------------- @@ -1132,6 +1223,6 @@ (cl-letf (((symbol-function 'insert) 'identity)) (should (equal - (concat "(configuration-layer/lazy-install 'mode " - ":extensions '(\"\\\\(\\\\.ext\\\\'\\\\)\"))\n") - (configuration-layer//insert-lazy-install-form 'mode "\\(\\.ext\\'\\)"))))) + (concat "(configuration-layer/lazy-install 'layer " + ":extensions '(\"\\\\(\\\\.ext\\\\'\\\\)\" mode))\n") + (configuration-layer//insert-lazy-install-form 'layer 'mode "\\(\\.ext\\'\\)")))))