Screen Too Small

This course material requires a larger screen to properly display the terminal and editor interfaces.

Please use a tablet, laptop, or desktop computer for the best learning experience.

You can continue browsing, but the experience will be significantly limited.

Vim Skills Integration Challenge

Estimated time: 10 minutes

Task Instructions

Apply all your Vim skills in a real-world editing scenario

Refactor this code using all your skills: navigate with hjkl/words/lines, use appropriate insert modes, delete unnecessary content, and move code blocks. This simulates real development work.

Learning objectives

  • Integrate all Vim skills
  • Practice real-world code refactoring
  • Build confidence with complex edits
Before
vim
// Todo List Application function TodoApp() { var todos = [] // CHANGE: to 'const' var completed = [] // CHANGE: to 'const' function addTodo(text) { todos.push({ text: text, done: false }) // SIMPLIFY: text: text } function completeTodo(index) { if (index >= 0 && index < todos.length) { todos[index].done = true completed.push(todos[index]) todos.splice(index, 1) // ADD: semicolon } } // MOVE this function between addTodo and completeTodo function getTodos() { return todos } function clearCompleted() { completed = [] // ADD: semicolon } } Refactor this code using all your Vim skills!
After
vim
// Todo List Application function TodoApp() { const todos = []; const completed = []; function addTodo(text) { todos.push({ text, done: false }); } function getTodos() { return todos; } function completeTodo(index) { if (index >= 0 && index < todos.length) { todos[index].done = true; completed.push(todos[index]); todos.splice(index, 1); } } function clearCompleted() { completed = []; } }

Helpful commands:

Command Description
cw Change word
dd Cut line
p Paste after cursor
>> Indent line
<< Unindent line

Hints

  • Plan your approach before starting
  • Use word navigation for variable name changes
  • Remember: dd to cut lines, p to paste them elsewhere

Ready for Vim?

Before starting this lesson, be prepared.

Read the directions on the left, and when you're ready, let's go!