🎯 Topic Objective:
To understand what Vi Editor is and how its different modes work — in easy language.
🔷 What is Vi Editor?
- Vi Editor is a text editor used in Linux/Unix systems.
- It is used to create and edit files (like writing code, notes, or configuration).
- It is keyboard-based — works without mouse.
- It is powerful, fast, and always available in Linux.
🧾 Why is Vi Editor used?
- To write and edit programs, shell scripts, and other files.
- Mostly used by system administrators and programmers.
- Comes pre-installed in most Linux systems.
🔶 Modes of Vi Editor
Vi Editor works in three main modes:
1️⃣ Regular Mode (Command Mode)
👉 Default mode when you open Vi Editor.
- Used to give commands like save, copy, paste, delete, move.
- You cannot type text here.
- Press
Esc
key to return to this mode anytime.
✅ Example Commands:
dd
→ delete lineyy
→ copy linep
→ paste:w
→ save:q
→ quit
2️⃣ Insertion Mode (Insert Mode)
👉 Used to type or write text.
- You go to this mode from regular mode by pressing:
i
→ insert before cursora
→ insert after cursoro
→ open a new line
- Now you can type like a normal editor.
✅ To come back to Regular Mode → press Esc
.
3️⃣ Replacement Mode
👉 Used to replace existing characters.
- From regular mode, press
R
to enter replacement mode. - Now every new character you type will replace existing characters.
✅ To exit → press Esc
.
📘 EXAM NOTE:
Point | Description |
---|---|
Full Form | Vi = Visual Editor |
Use | Text editing in Linux/Unix |
Modes | Regular, Insertion, Replacement |
Regular Mode | For commands like save, delete, quit |
Insertion Mode | For writing new text (i , a , o ) |
Replacement Mode | For replacing characters (R ) |
To exit any mode | Press Esc key |
Vi Editor क्या है और इसके मोड्स क्या हैं?
🎯 विषय का उद्देश्य:
Vi Editor को समझना और इसके तीन मुख्य मोड्स — Regular (Command), Insertion, और Replacement Mode — को सरल शब्दों में समझना।
🔷 Vi Editor क्या है?
- Vi Editor एक टेक्स्ट एडिटर है जो Linux/Unix सिस्टम में इस्तेमाल होता है।
- इसका उपयोग किसी भी फाइल को बनाने और एडिट करने के लिए किया जाता है।
- यह केवल कीबोर्ड से चलता है, माउस की जरूरत नहीं होती।
- यह बहुत तेज, हल्का और हर Linux सिस्टम में उपलब्ध होता है।
🔶 Vi Editor का उपयोग क्यों करते हैं?
- प्रोग्राम, स्क्रिप्ट या नोट्स लिखने के लिए।
- System Administrator और Programmer ज़्यादा इस्तेमाल करते हैं।
- Linux में पहले से इंस्टॉल होता है।
🔷 Vi Editor के मुख्य मोड्स
Vi Editor में काम करने के लिए तीन मोड्स होते हैं:
1️⃣ Regular Mode (Command Mode)
- जब आप Vi Editor खोलते हो, आप इसी मोड में होते हो।
- इसमें आप कमान्ड देते हैं, जैसे सेव करना, डिलीट करना, कॉपी-पेस्ट करना।
- इसमें टाइपिंग नहीं कर सकते।
- इस मोड में जाने के लिए हमेशा
Esc
दबाएँ।
✅ मुख्य कमांड्स:
dd
→ लाइन डिलीट करनाyy
→ लाइन कॉपी करनाp
→ पेस्ट करना:w
→ सेव करना:q
→ क्विट करना
2️⃣ Insertion Mode (इंसर्शन मोड)
- इसमें आप नया टेक्स्ट टाइप कर सकते हैं।
- Regular Mode से
i
,a
, याo
दबाकर इस मोड में जाते हैं:i
→ करसर से पहले लिखोa
→ करसर के बाद लिखोo
→ नई लाइन पर लिखो
✅ वापस Regular Mode में आने के लिए Esc
दबाएँ।
3️⃣ Replacement Mode (रिप्लेसमेंट मोड)
- इसमें आप मौजूदा टेक्स्ट को बदल सकते हैं।
- Regular Mode में
R
दबाकर इस मोड में जाएं। - अब जो भी टाइप करोगे, वह पुराना टेक्स्ट रिप्लेस करेगा।
✅ बाहर आने के लिए Esc
दबाएँ।
🧾 परीक्षा के लिए नोट्स (Exam Notes):
बिंदु | विवरण |
---|---|
Vi का फुल फॉर्म | Visual Editor |
उपयोग | Linux में फाइल एडिटिंग |
मुख्य मोड्स | Regular, Insertion, Replacement |
Regular Mode | कमांड देने के लिए (dd , :w , :q ) |
Insertion Mode | नया टेक्स्ट लिखने के लिए (i , a , o ) |
Replacement Mode | टेक्स्ट बदलने के लिए (R ) |
बाहर आने की कुंजी | Esc सभी मोड्स से बाहर आने के लिए |