Reverse Golf Example
Switch the "Before" and "After" cases for a Helix Golf example.
Before
# snake_case to camelCase
Rename all fields to be camelCase.
## Before
```js
const user_profile = {first_name: "John"};
```
## After
```js
const userProfile = {firstName: "John"};
```
After
# camelCase to snake_case
Rename all fields to be snake_case.
## Before
```js
const userProfile = {firstName: "John"};
```
## After
```js
const user_profile = {first_name: "John"};
```
Preview
Command
ebyxb*Rv""Nn<alt-)>
%s`+j<enter>f;<alt-(>
eb
selects the next word and trims whitespacey
copies the selected word and yanks it into the " (double quote) registerxb
selects the last word in the line*
sets the current selection as the search patternR
replaces the selected word with the copied selection from earlierv
enters select mode""
selects the " (double quote) register. PressingN
will add a new selection at the previous occurrence of the word saved to the registern
adds a new selection at the next occurrence of the search pattern assigned earlier<alt-)>
rotates the contents of the selections forward%
selects the entire contents of the files
brings up a prompt to select sub-selections by a given regex. We type in`+j
for the regex and select all matches with<enter>
- Since we're still in select mode, typing
f;
moves each cursor to select up until (and including) the next occurrence of a semicolon <alt-(>
rotates the contents of the selections backwards