Built in snippets
Yasnippet Built-in Snippetsλ︎
Yasnippet official snippet collection contains Emacs mode specific snippets that are automatically included in Spacemacs.
Web-mode HTML Linkλ︎
web major mode, typing
link and pressing
M-/ expands to
<link rel="stylesheet" href="url" type="text/css" media="screen" /> placing the cursor on
TAB moves the cursor to
url to change the name of the CSS file.
TAB again until the end marker is reached.
Clojure mode snippetsλ︎
There are numerous snippets that provide short-cuts for the minimal amount of common code structure in Clojure.
defn M-/ will expand to a function definition expression with the cursor in the position for the function name.
TAB will jump to the argument list, docstring and body of the function definition in turn.
With snippets added to the auto-completion tooltip, typing
def show the matching snippets and function names. Where a menu item as an
-> it denotes a snippet, e.g.
def -> defand
defn -> defn.
Common Clojure snippets includeλ︎
||name, docstring, args, body|
||name, value, body|
||test description, value/expected|
See the Clojure Snippets Reference for a complete list
Write your own snippets
writing your own snippets is fairly simple for Clojure or any other language you use with Spacemacs / Emacs
Clojure namespace snippetλ︎
ns snippet adds a namespace expression with the namespace of the current file, this requires a running REPL.
Space f f to create a new file, using underscores in the file name to separate words. Any underscores in the file name are converted into dashes in the
ns and then Tab / to expand the snippet, which included the namespace of the current file.
If using snippets with auto-completion tool-tips, Tab or arrow keys to select
ns -> ns snippet, Enter to insert snippet using the buffer file name