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|
Write your own snippets
Its easy to write your own snippets 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.
SPC 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
M-/ 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,
RET to insert snippet using the buffer file name