What is Vi Editor?

What is Vi Editor?

🎯 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 line
  • yy → copy line
  • p → 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 cursor
    • a → insert after cursor
    • o → 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:

PointDescription
Full FormVi = Visual Editor
UseText editing in Linux/Unix
ModesRegular, Insertion, Replacement
Regular ModeFor commands like save, delete, quit
Insertion ModeFor writing new text (i, a, o)
Replacement ModeFor replacing characters (R)
To exit any modePress 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 सभी मोड्स से बाहर आने के लिए

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *