KwickAcademy Course Topics · 7 min · free
Vim modes and commands
Learn Vim: Normal, Insert, Command-line and Visual modes, i a o, moving the cursor, x dd yy p u, :w :q :wq :q!, and search and replace. Vim opens in Normal mode; press i to type and Esc to go back.
Follows the syllabus of: GSEB Std 11 Computer Studies
On screen in this lesson
What is Vim?
| A text editor that runs in the terminal |
| Vim means Vi IMproved |
| Works without a mouse, only keys |
| Found on almost every Linux system |
The modes of Vim
| Mode | Used for | Enter with |
|---|---|---|
| Normal | move, delete, copy | Esc |
| Insert | typing text | i, a or o |
| Command-line | save, quit, search | : or / |
| Visual | selecting text | v |
Entering Insert mode
| Key | Starts typing | Example use |
|---|---|---|
| i | before the cursor | add a letter |
| a | after the cursor | add at word end |
| o | on a new line below | add a new line |
| A | at end of line | add a full stop |
Moving the cursor
| Key | Moves | Tip |
|---|---|---|
| h j k l | left down up right | arrows also work |
| 0 and $ | line start and end | same line |
| gg and G | first and last line | whole file |
| 5G | to line 5 | any number |
Editing in Normal mode
| Key | Does | Example |
|---|---|---|
| x | delete a character | fix a typo |
| dd | delete a line | 3dd deletes 3 |
| yy | copy a line | yank means copy |
| p | paste below | after dd or yy |
| u | undo | Ctrl+R redoes |
Save and quit commands
| Command | Does | When |
|---|---|---|
| :w | save | keep working |
| :q | quit | no unsaved changes |
| :wq | save and quit | most common |
| :q! | quit, do not save | discard changes |
| ZZ | save and quit | Normal mode |
Quick answers
In Insert mode you type :wq and press Enter. Is the file saved?
No. It is typed as text; press Esc first.
What does :q! do?
Quits without saving.
KwickClips from this lesson
Short clips, one idea each. Good for revision the night before.
The full lesson, in text
Hello students, welcome to Kwickprep. You opened Vim, typed your name, and strange things happened. Then you could not even quit! Why? Because Vim has modes. Today we will learn its modes and the commands to type, edit, save and quit.
First, what is Vim? Vim is a text editor, a program to write and change text files, and it runs in the terminal. Its name means Vi Improved, because it is an improved version of the older vi editor. Everything is done with keys, so no mouse is needed. It is found on almost every Linux system, including servers.
To open a file, type vim followed by the file name. If notes dot txt does not exist, Vim opens an empty screen and creates the file when you save. On many systems, typing vi also opens Vim. The screen shows the text, with tilde signs on empty lines.
Vim has different modes, and each key means something different in each mode. Normal mode, also called command mode, is for moving, deleting and copying, and Esc brings you here. Insert mode is for typing text, and you enter it with i, a or o. Command-line mode, also called last line mode, is for saving, quitting and searching, and starts with colon or slash. Visual mode is for selecting text, and starts with v.
Let us see how the modes connect. Vim always opens in Normal mode. If you need to type, press i for Insert mode, then press Esc to come back. If you do not need to type, simply stay in Normal mode. From Normal mode, type colon to give a command like save or quit.
There are several keys to start typing, and each puts the cursor in a different place. Small i starts typing before the cursor. Small a starts typing after the cursor. Small o opens a new empty line below and starts typing there. Capital A jumps to the end of the line, which is handy for adding a full stop.
In Normal mode, we move the cursor with keys. H, j, k and l move left, down, up and right, and arrow keys also work. Zero goes to the start of the line, and dollar goes to the end. Small gg goes to the first line of the file, and capital G goes to the last line. A number before capital G, like five G, goes to line five.
Now the editing keys, all used in Normal mode. X deletes the character under the cursor. Dd deletes the whole line, and three dd deletes three lines. Yy copies a line, and Vim calls copying yanking. P pastes the deleted or copied text below the cursor line. U undoes the last change, and Ctrl+R redoes it.
These commands start with a colon and end with Enter. Colon w writes, which means saves, the file. Colon q quits, but only if there are no unsaved changes. Colon w q saves and quits, and it is the one you will use most. Colon q with an exclamation mark quits without saving and throws away the changes. Capital ZZ in Normal mode also saves and quits.
Vim can also find and replace text. Slash followed by a word searches forward, and n jumps to the next match. Question mark followed by a word searches backward, and capital N goes to the previous match. Colon percent s, slash old, slash new, slash g, replaces every old word with the new word in the whole file.
Let us fix a real mistake. The file marks dot txt says Riya twenty eight, but her marks are eighty two. Place the cursor on the digit two, and press x to delete it. Now it says Riya eight. Press a to type after the eight, type two, and press Esc. Now it says Riya eighty two, so type colon w q to save and quit.
Pause and predict. You are still in Insert mode. You type colon w q and press Enter. Is the file saved? No, the letters colon w q are simply typed into your text, because Insert mode treats keys as text. Press Esc first, then type colon w q.
Here are mistakes every beginner makes. Typing text in Normal mode runs random commands, because letters like d and x are commands there. Forgetting to press Esc before colon w q types it into the file. Using colon q with unsaved changes shows error E thirty seven, no write since last change. When you feel lost, press Esc twice to return safely to Normal mode.
Let us revise what we learned today. Vim always opens in Normal mode. Press i, a or o for Insert mode, and Esc to come back. In Normal mode, x, dd, yy, p and u delete, copy, paste and undo. Colon w saves, colon q quits, colon w q does both, and colon q exclamation mark discards changes. Slash word searches, and n finds the next match.
Courses that teach this
| Course | Unit |
|---|---|
| GSEB Std 11 Computer Studies | Vim Editor and Basic Scripting |
Voice-over in this lesson is AI-generated. The script is written and checked by Kajal Ma'am. Boards can revise a syllabus mid-year, so confirm anything you plan around against the official board circular. Keep your passwords, OTPs and ID numbers to yourself — we never ask for them. To reach Kajal Ma'am, use the WhatsApp button; sharing your number there is how we call you back.
Free to watch, no sign-up. Live classes with Kajal Ma'am are the paid course; these lessons stay free either way.


