add textobject and indent queries for Clojure #14524
Open
+132
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Clojure Text Objects and Indentation
Text Objects (textobjects.scm)
Match in/around selections for Clojure code:
f (function)
(defn foo [x] |body|)
- body only|(defn foo [x] body)|
- entire forme (class/data structure)
(defrecord Point [x y] |methods|)
- body after name|(defrecord Point [x y] methods)|
- entire formT (test)
(deftest my-test |(is (= 1 1))|)
- test body|(deftest my-test (is (= 1 1)))|
- entire forma (parameter)
[|x y z|]
- parameters only|[x y z]|
- includes bracketsentry
(foo |bar| baz)
- same, selects individual elementc (comment)
|; single comment|
- one comment|; comment 1\n; comment 2|
- consecutive comments (matches upward from cursor)Indentation (indents.scm)
Indentation rules for Clojure code:
true
,false
,nil
, string, number, keyword), align to itdef*
,let*
,binding
,loop
,for
,doseq
,when-*
,if-*
,with-*
,fn
, andns
forms indent their body by one levellet
bindings), align subsequent pairs to them