Challenge - 5 Problems
Vim Basics Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the output after saving and quitting in Vim?
You open a file in Vim, enter insert mode, type Hello World, then save and quit. What will be the content of the file?
Linux CLI
vim example.txt # In Vim: # Press i # Type Hello World # Press Esc # Type :wq # Press Enter
Attempts:
2 left
💡 Hint
Remember that typing i enters insert mode and :wq saves and quits.
✗ Incorrect
Typing i enters insert mode where you can type text. Pressing Esc exits insert mode. The command :wq writes (saves) the file and quits Vim. So the file will contain exactly what you typed: Hello World.
💻 Command Output
intermediate2:00remaining
What happens if you quit Vim without saving?
You open a file in Vim, enter insert mode, type some text, then try to quit with
:q. What will Vim do?Linux CLI
vim example.txt # In Vim: # Press i # Type Some text # Press Esc # Type :q # Press Enter
Attempts:
2 left
💡 Hint
Think about what Vim does when you try to quit with unsaved changes.
✗ Incorrect
If you try to quit with :q but have unsaved changes, Vim warns you and refuses to quit to prevent data loss. You must use :q! to quit without saving or :wq to save and quit.
📝 Syntax
advanced1:30remaining
Which Vim command saves the file without quitting?
You want to save your changes in Vim but keep editing. Which command do you use?
Attempts:
2 left
💡 Hint
Think about the command that writes changes but does not exit.
✗ Incorrect
The :w command writes (saves) the file but keeps Vim open. :q quits, :wq saves and quits, :x saves and quits if changes were made.
💻 Command Output
advanced1:00remaining
What is the effect of pressing in Vim?
You are in insert mode typing text in Vim. What happens when you press the key?
Attempts:
2 left
💡 Hint
Think about how to stop typing text and use commands.
✗ Incorrect
Pressing exits insert mode and returns you to normal mode where you can run commands like saving or quitting.
🚀 Application
expert2:30remaining
How to save a file with a new name and quit Vim?
You opened a file in Vim but want to save your changes to a new file named
newfile.txt and then quit. Which command do you use?Attempts:
2 left
💡 Hint
Think about how to write to a new file and then quit in two steps.
✗ Incorrect
The command :w newfile.txt writes the current buffer to newfile.txt but does not quit. The command :q quits Vim. Combining them with | runs both commands in sequence.