Skip to content

Commit

Permalink
Merge pull request #1 from David-Else/main
Browse files Browse the repository at this point in the history
Add text to array example
  • Loading branch information
nik-rev authored Dec 16, 2024
2 parents a08b4d3 + e5cad2f commit 47cd3f6
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,40 @@ import Hexagons from "../../Hexagons.astro";

*For all examples, we'll assume that your cursor is on the very first character*

#### Text into Array

##### Before

```txt
Hello
This
Is
Helix
```

##### After

```
[ "Hello", "This", "Is", "Helix" ]
```

##### Command

<details>

<summary>
`%<A-s>ms"<A-J>i,<esc>xms ms[`
</summary>

1. `%` selects full file
1. `<A-s>` split selection into multiple selections on newlines
1. `ms"` surrounds each word with `"`'s
1. `<A-J>i,` join lines inside selection, select the inserted space, and insert `,`'s
1. `<esc>xms ` enter normal mode, select line and surround by spaces
1. `ms[` surround by `[]`

</details>

#### Object into Array

##### Before
Expand Down

0 comments on commit 47cd3f6

Please sign in to comment.