Why Spacemacs

Why would you use Spacemacs over configuring your own Emacs setup? Here are a few hightlights

Spacemacs is fast

The startup for Spacemacs is really quick, usually less than 2 seconds, even after adding a whole host of features have been added. This speed is due to Spacemacs only loading in the configuration for modes when you use them. For example, when you open a Clojure source code file for the first time, the Clojure layer is loaded and clojure mode is applied.

Discoverable commands with Which-Key

Spacemacs Which-Key

The more features you add to Emacs, the more keybindings and commands you have at your fingertips. To manage all this power, Spacemacs uses which-key to organise these keybindings and commands into groups.

Commands are grouped by their nemonic character, for example

Which-key nemonic menu
a - applications N - navigation
B - global buffers n - narrow/numbers
b - buffers p - projects
C - capture/colors q - quit
c - compile/comments r - registers/rings/resume
e - errors s - search/symbol
f - files S - spelling
g - git/version control T - UI toggles/themes
h - help t - toggles
i - insertion w - windows
j - jump/join/split x - text
k - lisp z - zoom
l - layouts-transient-state

You can still use all the keybindings that come with Emacs packages as well as type in command names using M-x command-name too, or SPC SPC command-name, if you know the the command-name you are looking for.

Helm narrowing & completion

Helm is an incremental completion and selection narrowing framework. Its the central control tower of Spacemacs, it is used to manage buffers, projects, search results, configuration layers, toggles and more.

For example, Helm helps you navigate files and directory names, only showing the matching names to the pattern you type. This minimises the need to type directory and file names in full.

If you have a rough idea of a command name, you can start to type it after SPC SPC or M-x and Helm will show you all the matching commands using fuzzy matching (matches anything that contains the pattern you have typed).

Once you have learnt the Spacemacs groupings for Helm its really fast to do anything, so take a look at the Helm documentation wiki.

ido mode is still available in Spacemacs but by default it is over-ridden by Helm. You can enable ido using dotspacemacs-use-ido t in the dotspacemacs/init section of .spacemacs, however this only replaces a few commands.

Editor states - Evil or Holy modes

When installing Spacemacs you have the choice of using either Vim or Emacs as the default editor. If you select Vim you get all the Vim states and Emacs state too.

Spacemacs states

Using a mode for different types of actions greatly simplifies the keyboard bindings and arguably makes vim faster to use, especially once you get used to multi-mode editing.

This speed is in part due to simpler keybinding when in normal mode as you are not typing content into the editor, simply running commands with each key press. This means you can have single characters to do many of the common commands, eg l instead of C-f for moving the cursor forward.

If you are deeply connected to the with Emacs keybindings, then probably best to stick to holy mode.

If you are new to Emacs or you just want to take advantage of Vim, then select Evil mode.

You can switch between Vim and Emacs with C-z.

Navigating windows, buffers & projects

Navigating is quick and simple with the use of window, buffer and project management menus

Numbered buffers

Each buffer gets a number in the status bar, allowing you to jump to any buffer using SPC and the buffer number, eg. SPC 3 jumps to buffer number 3.

Projectile

Projectile is a project interaction library for Emacs. Its goal is to provide a nice set of features operating on a project level without introducing external dependencies (when feasible). For instance - finding project files has a portable implementation written in pure Emacs Lisp without the use of GNU find (but for performance sake an indexing mechanism backed by external commands exists as well).

Projectile tries to be practical - portability is great, but if some external tools could speed up some task substantially and the tools are available, Projectile will leverage them.

This library provides easy project management and navigation. The concept of a project is pretty basic - just a folder containing special file. Currently git, mercurial, darcs and bazaar repos are considered projects by default. So are lein, maven, sbt, scons, rebar and bundler projects. If you want to mark a folder manually as a project just create an empty .projectile file in it. Some of Projectile's features:

  • jump to a file in project
  • jump to files at point in project
  • jump to a directory in project
  • jump to a file in a directory
  • jump to a project buffer
  • jump to a test in project
  • toggle between files with same names but different extensions (e.g. .h <-> .c/.cpp, Gemfile <-> Gemfile.lock)
  • toggle between code and its test (e.g. main.service.js <-> main.service.spec.js)
  • jump to recently visited files in the project
  • switch between projects you have worked on
  • kill all project buffers
  • replace in project
  • multi-occur in project buffers
  • grep in project
  • regenerate project etags or gtags (requires ggtags).
  • visit project in dired
  • run make in a project with a single key chord
  • check for dirty repositories

Smartparens and symbol balancing/highlighting

Smartparents helps speed up typing and reducing errors due to unmatched symbols. For most symbols in most modes a matching symbol is created. So if you type ( then a matching ) is created too. If you want to surround some existing text with a symbol pair, then simply highlight the text and press the opening symbol. A closing symbol is also highlighted when the cursor is at the opening symbol. Spacemacs also highlights the surrounding symbols, including any parents. So if you are in a nested list, (parent code (nested code)), then if the cursor is on the nested code, both nested & parent symbols are highlighted.

Smooth scrolling

Unlike the traditional jump-scrolling of Emacs, Spacemacs uses smooth scrolling as you fing in most other text editors.

Transient State menus

Spacemacs uses hydra to set up temporary states with menus to allow you to do specific tasks. Examples of transient state menus

  • SPC b . - buffer management
  • SPC e . - errors
  • SPC k . - lisp
  • SPC w . - window management
  • SPC z x - zoom text size
  • C-c C-f h h - clj-refactor

results matching ""

    No results matching ""