ns namespace definitions
ns forms using
clojure-mode, meaning these refactor commands work even when the REPL is not running.
Pull request to be merged
Defined in pull request 13755 so will only be available once this PR is merged.
||Add current namespace (from file name) to top of buffer|
||Add current namespace (from file name) at point|
||Sort namespaces inside an
clj-refactor contains commands to add require forms to the
Adding a namespace
, r a n will add a namespace definition to the top of the buffer, useful when creating a new Clojure/Script file. The namespace is taken from the file name, using kebab case for separate names.
, r a N is useful if a comment block is used at the start of source code files or if you want to control the placement of the namespace definition.
Updating a namespace
clojure-update-ns has an outstanding bug, so its not possible to update the name of an existing namespace.
One option is to use
, r N to add a new namespace at point and cut/paste the name over the original namespace name.
Sorting namespaces within an
, r s n alphabetically sorts the required namespace names within an
Organizing by purpose
When there are more than a few required namespaces, it can be valuable to group namespaces by their purpose rather than alphabetically.