📖 Quick Note: This introduction gives you a high-level overview of VIM to spark your interest. Don’t worry about memorizing and understanding everything here — we’ll learn step by step in the following sections. Feel free to scan through this as a starting point and then dive into the detailed guides!
Why VI Over Simple Text Commands?
While the cat command is handy for viewing small files, it falls short when you need to actually edit text:
# cat is great for viewing...
cat myfile.txt
# But what if you need to edit, search, or manipulate text?
# This is where VI shines!
VI (pronounced “vee-eye”) is a powerful console-based text editor that comes pre-installed on virtually every Linux distribution. It’s your reliable companion whether you’re editing configuration files, writing code, or managing text on remote servers.
What is VI Really?
VI is short for “visual” — it was revolutionary when introduced because it allowed full-screen editing, unlike earlier line-based editors.
Here’s an important fact: VI has been replaced by VIM (Vi IMproved). Many Linux distributions (like Ubuntu) use Vim to provide the vi command, meaning when you type vi in the terminal, you are actually running a version of Vim configured to behave like the original Vi, or a more feature-rich version with specific settings.
Why Choose VI/VIM Over Other Editors?
Better Than Nano
While nano is simpler for beginners, VI/VIM offers:
- More powerful editing capabilities
- Better for large files
- Extensive customization options
- Available on every Unix-like system
VIM is Like a Language
VIM uses a unique approach with verbs, nouns (objects), and adjectives:
Verb + Object = Action
d + w = delete word
c + w = change word
y + w = yank (copy) word
# Add numbers (adjectives) for even more power:
d + 3w = delete 3 words
c + 2w = change 2 words
y + 5w = yank 5 words
This makes it incredibly efficient once you learn the “vocabulary.”
Basic Example Commands
# Start editing a file
vi myfile.txt
# Basic navigation (in normal mode)
h # Move left
j # Move down
k # Move up
l # Move right
# Essential commands
i # Enter insert mode
Esc # Return to normal mode
:w # Save file
:q # Quit
:wq # Save and quit
VIM’s Built-in Help System
One of VIM’s best features is its comprehensive help system:
# Access help (from within VIM)
:help # General help
:help w # Help for 'w' command
:help :w # Help for ':w' command
You can even split your screen to view help while editing your file — no need to leave the editor!
VIM Modes
Mode Usage Summary:
- Normal Mode: Navigate, delete, copy, search, and execute commands
- Insert Mode: Actually type and add text to your file
- Visual Mode: Select text for copying, deleting, or formatting
The Joy of Efficiency
VIM encourages creative problem-solving. There are usually multiple ways to accomplish the same task:
# Delete a word - multiple methods:
dw # Delete word (cursor to end)
cw # Change word (delete and enter insert mode)
x # Delete single character (repeat as needed)
You can even make it a game: “How can I accomplish this edit with the fewest keystrokes?” This mindset naturally leads to becoming more efficient over time.
Summary & Tips
- VI = VIM in most modern systems
- Three main modes: Normal (command), Insert (typing), Visual (selection)
- Think in terms of verbs and objects for powerful combinations
- Use :help extensively - it's your best learning resource
- Practice regularly — muscle memory is key to VIM mastery
💡 Pro Tip: Don’t try to learn everything at once. Start with basic navigation and insertion, then gradually add new commands to your toolkit.
Next: Continue your VI/VIM journey with VIM Modes section and other resources for hands-on learning and practical techniques!
✈️ This is a article I wrote as a contribution to a open-source DevOps Roadmap repository . While it focuses on the Vi editor, the repo includes many other valuable resources to support your DevOps journey — be sure to check them out too!
Top comments (0)