Skip to content

Instantly share code, notes, and snippets.

@junderhill
Last active October 6, 2021 08:02
Show Gist options
  • Save junderhill/8da03fd6bd19b64be86a6c9751a56423 to your computer and use it in GitHub Desktop.
Save junderhill/8da03fd6bd19b64be86a6c9751a56423 to your computer and use it in GitHub Desktop.
Vim Kata Daily Training
# Vim Daily Training
## Sorting (Command Line Util)
Sort the below sentances into alphabetical order:
```
Leslie Burch
Ahmad Valenzuela
Eduardo Palmer
Harry Woodard
Marlin Mcmahon
Neal Chavez
Lindsey Holt
Colette Miranda
Sheree Washington
Bridget Shepard
Caitlin Espinoza
Verna Knapp
```
## Filtering (grep)
Filter the list of names to only those containing a certain letter.
```
Leslie Burch
Ahmad Valenzuela
Eduardo Palmer
Harry Woodard
Marlin Mcmahon
Neal Chavez
Lindsey Holt
Colette Miranda
Sheree Washington
Bridget Shepard
Caitlin Espinoza
Verna Knapp
```
## Using Marks
Using marker for your current location, go yank the text from the bottom of this file and return to this marker to paste it in the correct place.
```
Sometimes it just doesn't make sense. The man walking down the street in a banana suit.
REPLACE THIS TEXT. The fairies dancing in front of the car
window. The fact that all of this was actually happening and wasn't a dream.
```
## Joining lines
Join the below lines with a space
```
Hello
world,
what
a
wonderful
day
```
Join the below lines without a space
```
hel
lo wor
ld, wh
at a wonde
rful day.
```
## Find and Replace
Replace all the occurences of `Boban` in the below paragraph with `Dave`.
```
A letter regarding His-Highness-the-Great Boban to the people.
Your great King Boban would like you to all to know,
that as King Boban he wishes you all.
This letter is officially sanctioned propaganda from Boban
```
## Prefix all lines
Append `{'somekey', ` to each line below using block visual select and insert.
```
{
'somevalue'},
'somevalue'},
'somevalue'},
'somevalue'},
'somevalue'}
}
```
## Upper/Lower/Indent/Paragraphs etc.
Indent this paragraph without a selection
```
Beef chicken pork bacon chuck shortloin sirloin shank, bresaola kielbasa pariatur shoulder tenderloin aliqua groundround sausage, tempor venison et meatloaf tail.
Meatball pancetta andouille hamhock tail chicken doner tongue ullamco shoulder cow capicola, bacon shortloin turkey incididunt tempor jowl reprehenderit ribeye turducken.
Nulla nisi andouille veniam turducken tempor dolore porchetta flank, irure eiusmod voluptate eu aute laboris non sunt, excepteur aliqua shankle anim leberkas incididunt officia.
Magna labore groundround tri-tip meatloaf ut tail ullamco bacon, balltip irure aliquip landjaeger velit deserunt pork porkloin, porchetta tenderloin spareribs minim sausage sed esse.
Ham hamhock leberkas beefribs biltong ad prosciutto magna sirloin, chuck in kielbasa shank pork elit drumstick, nisi andouille filetmignon aliqua shankle sunt est.
Filetmignon capicola kielbasa porchetta duis consectetur ullamco enim excepteur hamhock esse, porkloin shortribs qui porkchop reprehenderit fatback cupidatat mollit stripsteak in ad, tenderloin turducken nulla sint nisi brisket eiusmod jowl ut.
Landjaeger minim jowl boudin tenderloin esse, tri-tip porkloin beef nisi sirloin anim, et leberkas mollit magna.
```
Upper case the word `very`
```
That soup was very hot.
```
Lower case the word soup.
```
That SOUP was VERY HOT.
```
Upper case the entire paragraph:
```
She counted. One. She could hear the steps coming closer.
Two. Puffs of breath could be seen coming from his mouth. Three.
He stopped beside her. Four. She pulled the trigger of the gun.
```
Use Big word text object to copy the Boban prefix to all other boban's in the text
```
A letter regarding His-Highness-the-Great Boban to the people.
Your great King Boban would like you to all to know,
that as King Boban he wishes you all.
This letter is officially sanctioned propaganda from Boban
```
Upper case this paragraph by using a selection and then reuse the selection with the `reselect last command` to lower case it again.
```
A letter regarding His-Highness-the-Great Boban to the people.
Your great King Boban would like you to all to know,
that as King Boban he wishes you all.
This letter is officially sanctioned propaganda from Boban
```
## Advanced visual selection
Use block mode to select only the `X` characters and then lower case them.
```
-------------------------
-------------------------
-----XXXXXXXXXXXXX-------
-----XXXXXXXXXXXXX-------
-----XXXXXXXXXXXXX-------
-----XXXXXXXXXXXXX-------
-----XXXXXXXXXXXXX-------
-------------------------
-------------------------
```
Use line visual select mode to replace the lines in the middle with something else.
```
-------------------------
-------------------------
-----XXXXXXXXXXXXX-------
-----XXXXXXXXXXXXX-------
-----XXXXXXXXXXXXX-------
-----XXXXXXXXXXXXX-------
-----XXXXXXXXXXXXX-------
-------------------------
-------------------------
```
## System clipboard
Yank the following URL to the system clipboard, open it in the browser and paste back the current time. (I know! there's better ways of adding a timestamp in VIM)
```
https://www.utctime.net/utc-timestamp
```
The current time is: `???`
# Text for marker exercise -
The llama standing in the middle of the road.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment