Newsletter #01: About the 0.200 release

5 min read Original article ↗

Here is the scary section, the one feared by most users :-) Let be honest, there is a rather big amount of changes for users jumping from master 0.105 to 0.200.

First of all the most visible change is for SPC SPC which triggers now M-x instead of avy to jump to a character. The SPC key in Spacemacs is a central key as it acts as the leader key for all the key bindings, it made sense to give the same sense of "root" key to the sequence SPC SPC, so now SPC SPC is the central sequence to execute any interactive function in Emacs.

Where is the avy command then ? We reorganised from the ground up the prefix SPC j for all jump commands. In the conventions a doubled key is often used for the default command under a given prefix, for instance SPC b b is for buffer selection, SPC f f for file selection etc… The "jump to character" command of avy is then under SPC j j. Here is a detailed list of the new SPC j prefix:

  • avy commands are now behind the prefix SPC j for jump:
    • SPC j j to jump to a character in the buffer (works as an evil motion)
    • SPC j l to jump to a line with avy (works as an evil motion)
    • SPC j w to jump to a word in the current buffer (works as an evil motion)
  • the following key bindings have been moved:
    • SPC j j to split a line has been moved to SPC j n (mnemonic is New line)
    • SPC j h and SPC j l have been moved to SPC j 0 and SPC j $ respectively.
    • SPC J to split a string or sexp has been moved to SPC j s

A lot of other handy commands are under this prefix, I let you discover them with the which key menus.

Closing, deleting or killing things ? This can be a tough call to distinguish them and we can find such confusion in the Spacemacs key bindings, for instance we close a window but we delete a buffer and we can also kill a buffer. Whereas it can make sense for a lot of users, there are still users finding this confusing. So we decided to simplify the notion of "closing/deleting" things under the d key for delete. We moved SPC w c and SPC w C to SPC w d and SPC w D.

More generally we tried to map prefixes SPC b and SPC w to the same actions and bring a convention with avy commands with the capital letter to manipulate windows and buffers. The result is detailed here:

  • SPC b k has been removed.
  • SPC b C-k (kill buffer matching regexp) is now SPC b C-d
  • SPC b m (buffer move) has been removed because the functionality is available via SPC w with SPC w h/j/k/l, SPC w H/J/K/L and SPC w M.
  • SPC b K (kill other buffers) is now SPC b m to map with SPC w m (maximize buffer/window which effectively delete other windows).
  • SPC b D now kills a buffer using ace-window.
  • Buffer actions don't delete the windows by default, use the universal prefix argument to do so, for instance SPC u SPC b d and SPC u SPC b D will delete the buffer and also the window. Another example is SPC u SPC b m to maximize a buffer.

Helm has a new friend in this release, it is called ivy and it has more and more adopters. Since we have now a new package capable of doing helm commands we decided to remove all helm related command from the prefix SPC h. SPC h is now exclusively for help commands and the following helm commands has been moved:

  • SPC h b for =helm-filetered-bookmarks~is now SPC f b
  • SPC h l for helm-resume is now SPC r l
  • SPC h L for helm-locate-library is now SPC f e l

The git related commands have been drastically simplified to leverage the magit dispatch menu. Instead of replicating all the magit dispatch keys under the SPC g prefix we now only define the key binding SPC g m to display the magit dispatch menu. We get several benefits by doing so: first we free up a lot of valuable keys under SPC g, second we have now more consistent key bindings since we always use the magit dispatch menu. Previously we have some actions bound to different keys between SPC g and the magit dispatch menu accessible under ?. The new available keys allowed us to move some key bindings directly under SPC g like git-link which is now under SPC g l, it makes more sense to have it under SPC g l since it is agnostic of the hosting platform (i.e. it works with GitHub, GitLab etc…).

Spacemacs layouts now restrict the scope of the buffer list opened with SPC b b. Use SPC b B to list all the buffers of all the layouts. Also 1,2,...,9,0 keys now select a layout and close the layout menu, use C-1,C-2,...,C-9,C-0 to switch to a layout and keep the menu opened.

To conclude this section about key binding changes and breaking changes the micro-states in Spacemacs are dead, say hi to the transient-states. We took advantage of the micro-states refactoring to change the name to a more accurate new name transient-states, indeed these states leverage the notion of transient maps in Emacs. The refactoring replaces the custom back-end by hydra a powerful and very popular package to define transient maps. In effect the macro spacemacs|define-micro-state is deprecated and is replaced by the new hydra powered macro spacemacs|define-transient-state.