Liking cljdoc? Tell your friends :D

rewrite-cljc.paredit

Paredit zipper operations for Clojure/ClojureScript/EDN.

You might find inspiration from examples here: http://pub.gajendra.net/src/paredit-refcard.pdf

Paredit zipper operations for Clojure/ClojureScript/EDN.

You might find inspiration from examples here: http://pub.gajendra.net/src/paredit-refcard.pdf
raw docstring

barf-backwardclj/s

(barf-backward zloc)

Push out the leftmost node of the current S-expression into outer left form.

  • [1 2 [3 |4] 5] => [1 2 3 [|4] 5]
Push out the leftmost node of the current S-expression into outer left form.

- `[1 2 [3 |4] 5] => [1 2 3 [|4] 5]`
sourceraw docstring

barf-forwardclj/s

(barf-forward zloc)

Push out the rightmost node of the current S-expression into outer right form.

  • [1 2 [|3 4] 5] => [1 2 [|3] 4 5]
Push out the rightmost node of the current S-expression into outer right form.

- `[1 2 [|3 4] 5] => [1 2 [|3] 4 5]`
sourceraw docstring

joinclj/s

(join zloc)

Join S-expression to the left and right of current loc. Also works for strings.

  • [[1 2] |[3 4]] => [[1 2 3 4]]
  • ["Hello " | "World"] => ["Hello World"]
Join S-expression to the left and right of current loc. Also works for strings.

- `[[1 2] |[3 4]] => [[1 2 3 4]]`
- `["Hello " | "World"] => ["Hello World"]`
sourceraw docstring

killclj/s

(kill zloc)

Kill all sibling nodes to the right of the current node in zloc.

  • [1 2| 3 4] => [1 2|]
Kill all sibling nodes to the right of the current node in `zloc`.

- `[1 2| 3 4] => [1 2|]`
sourceraw docstring

kill-at-posclj/s

(kill-at-pos zloc pos)

In string and comment aware kill

Perform kill for given position pos Like kill, but:

  • if inside string kills to end of string and stops there
  • If inside comment kills to end of line (not including linebreak)

pos should provide {:row :col } which are relative to the start of the given form the zipper represents zloc must be positioned at a node previous (given depth first) to the node at given pos

In string and comment aware kill

Perform kill for given position `pos` Like [[kill]], but:

- if inside string kills to end of string and stops there
- If inside comment kills to end of line (not including linebreak)

`pos` should provide `{:row :col }` which are relative to the start of the given form the zipper represents
`zloc` must be positioned at a node previous (given depth first) to the node at given pos
sourceraw docstring

kill-one-at-posclj/s

(kill-one-at-pos zloc pos)

In string and comment aware kill for one node/word at pos in zloc.

  • (+ |100 100) => (+ |100)
  • (for |(bar do)) => (foo)
  • "|hello world" => "| world"
  • ; |hello world => ; |world
In string and comment aware kill for one node/word at `pos` in `zloc`.

- `(+ |100 100) => (+ |100)`
- `(for |(bar do)) => (foo)`
- `"|hello world" => "| world"`
- ` ; |hello world => ;  |world`
sourceraw docstring

move-to-prevclj/s

(move-to-prev zloc)

Move node at current location to the position of previous location given a depth first traversal

  • (+ 1 (+ 2 |3) 4) => (+ 1 (+ |3 2) 4)
  • (+ 1 (+ 2 3) |4) => (+ 1 (+ 2 3 |4))

returns zloc after move or given zloc if a move isn't possible

Move node at current location to the position of previous location given a depth first traversal

  -  `(+ 1 (+ 2 |3) 4) => (+ 1 (+ |3 2) 4)`
  - `(+ 1 (+ 2 3) |4) => (+ 1 (+ 2 3 |4))`

returns zloc after move or given zloc if a move isn't possible
sourceraw docstring

raiseclj/s

(raise zloc)

Delete siblings and raise node at zloc one level up

  • [1 [2 |3 4]] => [1 |3]
Delete siblings and raise node at zloc one level up

- `[1 [2 |3 4]] => [1 |3]`
sourceraw docstring

slurp-backwardclj/s

(slurp-backward zloc)

Pull in prev left outer node (if none at first level, tries next etc) into current S-expression

  • [1 2 [|3] 4 5] => [1 [2 |3] 4 5]
Pull in prev left outer node (if none at first level, tries next etc) into
current S-expression

- `[1 2 [|3] 4 5] => [1 [2 |3] 4 5]`
sourceraw docstring

slurp-backward-fullyclj/s

(slurp-backward-fully zloc)

Pull in all left outer-nodes into current S-expression, but only the ones at the same level as the the first one.

  • [1 2 [|3] 4 5] => [[1 2 |3] 4 5]
Pull in all left outer-nodes into current S-expression, but only the ones at the same level
as the the first one.

- `[1 2 [|3] 4 5] => [[1 2 |3] 4 5]`
sourceraw docstring

slurp-forwardclj/s

(slurp-forward zloc)

Pull in next right outer node (if none at first level, tries next etc) into current S-expression

  • [1 2 [|3] 4 5] => [1 2 [|3 4] 5]
Pull in next right outer node (if none at first level, tries next etc) into
current S-expression

- `[1 2 [|3] 4 5] => [1 2 [|3 4] 5]`
sourceraw docstring

slurp-forward-fullyclj/s

(slurp-forward-fully zloc)

Pull in all right outer-nodes into current S-expression, but only the ones at the same level as the the first one.

  • [1 2 [|3] 4 5] => [1 2 [|3 4 5]]
Pull in all right outer-nodes into current S-expression, but only the ones at the same level
as the the first one.

- `[1 2 [|3] 4 5] => [1 2 [|3 4 5]]`
sourceraw docstring

spliceclj/s

See [[rewrite-cljc.zip/splice]]
sourceraw docstring

splice-killing-backwardclj/s

(splice-killing-backward zloc)

Remove left siblings of current given node in S-Expression and unwrap remaining into enclosing S-expression

  • (foo (let ((x 5)) |(sqrt n)) bar) => (foo (sqrt n) bar)
Remove left siblings of current given node in S-Expression and unwrap remaining into enclosing S-expression

- `(foo (let ((x 5)) |(sqrt n)) bar) => (foo (sqrt n) bar)`
sourceraw docstring

splice-killing-forwardclj/s

(splice-killing-forward zloc)

Remove current given node and its right siblings in S-Expression and unwrap remaining into enclosing S-expression

  • (a (b c |d e) f) => (a b |c f)
Remove current given node and its right siblings in S-Expression and unwrap remaining into enclosing S-expression

- `(a (b c |d e) f) => (a b |c f)`
sourceraw docstring

splitclj/s

(split zloc)

Split current s-sexpression in two at given node zloc

  • [1 2 |3 4 5] => [1 2 3] [4 5]
Split current s-sexpression in two at given node `zloc`

-  `[1 2 |3 4 5] => [1 2 3] [4 5]`
sourceraw docstring

split-at-posclj/s

(split-at-pos zloc pos)

In string aware split

Perform split at given position pos Like split, but:

  • if inside string splits string into two strings

pos should provide {:row :col } which are relative to the start of the given form the zipper represents zloc must be positioned at a node previous (given depth first) to the node at given pos

In string aware split

Perform split at given position `pos` Like split, but:

- if inside string splits string into two strings

`pos` should provide `{:row :col }` which are relative to the start of the given form the zipper represents
`zloc` must be positioned at a node previous (given depth first) to the node at given pos
sourceraw docstring

wrap-aroundclj/s

(wrap-around zloc t)

Wrap current node with a given type t where t can be one of :vector, :list, :set, :map :fn.

  • |123 => [|123] given :vector
  • |[1 [2]] => [|[1 [2]]]
Wrap current node with a given type `t` where `t` can be one of `:vector`, `:list`, `:set`, `:map` `:fn`.

- `|123 => [|123]` given `:vector`
- `|[1 [2]] => [|[1 [2]]]`
sourceraw docstring

wrap-fully-forward-slurpclj/s

(wrap-fully-forward-slurp zloc t)

Create a new seq node of type t left of zloc then slurp fully into the new node

  • [1 |2 3 4] => [1 [|2 3 4]]
Create a new seq node of type `t` left of `zloc` then slurp fully into the new node

- `[1 |2 3 4] => [1 [|2 3 4]]`
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close