Creating Vim Recordings

15 minutes
  • 2 Learning Objectives

About this Hands-on Lab

One of the features of Vim that makes it popular and easy to use with nuanced but repeatable tasks is the ability to create recordings, or repeatable actions, that we then assign to a reference key. In this lab, we’ll create and use recordings to update some inconsistently written code.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create Recordings

Add recordings to keys d, s, and e based on the parameters provided in the instructions.

Use Recordings

Use the recordings to update the files based on the parameters in the instructions.

Additional Resources

You are a junior developer who has discovered some issues while linting your code. To make resolving the issue go faster, you have decided to make a series of Vim recordings to use while updating the app.js file found in /home/cloud_user/app.

Create the following recordings:

  • d should wrap a parameter or word in double quotes — be sure non-letter characters are included!
  • s should do the same but for single quotes.
  • e should change a single instance of = to ===.

Use these recordings to then perform the following tasks:

  • Wrap the required constants in single quotes on lines:
    • 2 (supertest)
    • 3 (express)
    • 4 (body-parser)
  • Wrap the first parameter of the function in double quotes on lines:
    • 18 (/addtask)
    • 25 (/removetask)
    • 41 (/)
  • Change the single equal sign (=) to a triple one (===) on lines:
    • 27
    • 31

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?