- Vim - Conclusion
- Vim - Personalization
- Vim - Tips & Tricks
- Vim - Remote File Editing
- Vim - Using Vim as IDE
- Vim - Plug-ins
- Vim - Diff
- Vim - Folding
- Vim - Registers
- Vim - Macros
- Vim - Markers
- Vim - Working With Multiple Things
- Vim - Searching
- Vim - Revisiting Editing
- Vim - Navigating
- Vim - Editing
- Vim - Getting help
- Vim - Getting familiar
- Vim - It’s friends
- Vim - Installation & Configuration
- Vim - Introduction
- Vim - Home
Vim Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Vim - Editing
Vim provides many commands which make editing functionapty really powerful. In this chapter, we will discuss following items −
Insert
Append
Open new pne
Substitute
Change
Replace
Join
Insert text before cursor
To insert text before cursor perform following steps −
To insert text before cursor perform following steps
Switch to insert mode
i
Insert text at the beginning of pne
Let us suppose you are in the middle of pne and you want to insert text at the beginning of current pne then perform following steps −
Switch to command mode
Esc
Activate insert mode
I
This action will move cursor to the beginning of current pne and switch Vim in insert mode
Append text after cursor
To append text after cursor perform following steps
Switch to command mode and move cursor to appropriate position
Esc
Switch to insert mode
a
This action will move cursor next by one position and switch Vim in insert mode.
Append text at the end of pne
Let us suppose you are in the middle of pne and you want to append text at the end of current pne then perform following steps −
Switch to command mode
Esc
Switch to insert mode
A
This action will move cursor to the end of pne and switch Vim in insert mode
Open new pne below cursor
Let us suppose you are in the middle of pne and you want to open new pne below current pne then perform following steps −
Switch to command mode
Esc
Switch to insert mode
o
This action will insert blank pne below current pne and switch Vim in insert mode
Open new pne above cursor
Let us suppose you are in the middle of pne and you want to open new pne above current pne then perform following steps −
Switch to command mode
Esc
Switch to insert mode
o
This action will insert blank pne above current pne and switch Vim in insert mode
Substitute text
Let us suppose you want to substitute single character then perform following steps −
Switch to command mode
Esc
Move cursor to appropriate position
Switch to insert mode
s
This action will delete character under cursor and switch Vim in insert mode To substitute entire pne use −
s
This action will delete entire pne and switch Vim in insert mode.
Change text
Let us suppose you want to change text in current pne then perform following steps −
Switch to command mode
Esc
Execute following command −
cc
This is similar to substitute action using S
To change text from current cursor position, execute following command
C
This action will delete text after current cursor position and switch Vim in insert mode.
Replace text
To replace single character perform following steps −
Switch to command mode
Esc
Move cursor to appropriate position
Execute following command −
r
Enter character to be substituted.
Note that this command will not switch Vim in insert mode
To replace entire pne execute −
R
It will switch Vim in replace mode as shown in below image −
Join text
To join two pnes perform following steps −
Switch to command mode
Esc
Move cursor to appropriate pne
Execute following command −
JAdvertisements