If you’re a Linux enthusiast like me—or just a nobody user trying to survive daily terminal work—you’ve probably stumbled across Vim at least once. At first glance, Vim can be intimidating: there are modes, commands, and shortcuts that feel like a secret language.
I remember the first time I opened Vim—I couldn’t even figure out how to exit. But once you understand the basics, Vim isn’t just a text editor—it becomes an extension of your brain for editing text efficiently. Today, I’ll walk you through Vim commands that will transform you from a hesitant beginner into a confident Linux power user.
Vim vs Neovim: Quick Overview
Before we dive into commands, let’s quickly clarify the difference between Vim and Neovim. Vim is the classic, reliable editor that has been around for decades. Neovim, on the other hand, is a modernized fork of Vim with better plugin support, asynchronous tasks, and a slightly more polished experience. For a beginner, both work almost identically, and all the commands we’ll cover are valid in both editors. If you’re just starting, I’d recommend trying Neovim, especially if you plan to use plugins or integrate with other modern tools.
The choice between Vim and Neovim is mostly about personal preference and workflow. Vim is rock-solid and available everywhere, while Neovim gives you extra modern features that make editing and automation smoother.
Beginners: Essential Vim Commands
When you first start with Vim, the main challenge is navigation and editing. Unlike a regular editor, you don’t rely on a mouse; every keystroke is intentional. Learning a few basic commands will save you hours of frustration.
Navigation Basics
Vim has a mode called Normal mode, where most commands work. Here’s a quick breakdown:
h,j,k,l– move left, down, up, and right. Mastering these makes navigation faster than using arrow keys.0and$– jump to the beginning or end of a line. For example, if you’re editing a configuration file and need to change a parameter at the end of a line,$lets you do it instantly.ggandG– go to the beginning or end of the file. I useGall the time when scrolling through log files; it’s much faster than repeatedly pressing Page Down.
Think of these commands like a mini-map for your file. Once you can move around without arrow keys, editing becomes much smoother.
Editing Text
Vim’s insert mode allows you to type text, while normal mode is for commands. Some key commands:
i– insert before the cursora– insert after the cursoro/O– open a new line below or above. For instance, when documenting scripts, I often useoto quickly add comments above functions.x– delete a character under the cursordd– delete a line;yy– copy a line;p– paste. These simple commands allow you to perform most basic edits without leaving the keyboard.
Imagine editing a configuration file with hundreds of lines. Instead of using a mouse or repeatedly pressing backspace, you can yank, delete, and paste entire blocks in seconds.
Searching & Replacing
Vim shines when it comes to searching. You can navigate and modify text efficiently without ever touching your mouse:
/text– search forward?text– search backwardn/N– repeat searches forward/backward
For replacements: :%s/old/new/g is a lifesaver. Once, I had to update variable names across a 500-line script. Instead of manually changing each one, this command handled it in seconds.
Saving and Quitting
Beginners often panic here. Remember:
:w– save:q– quit:wq– save and quit:q!– quit without saving
Think of :q! as a safety net—you can experiment without the fear of breaking your file.
Pros: Advanced Vim Commands
Once you’re comfortable, Vim becomes a tool for power users. The difference lies in combining motions, operators, and text objects to do complex edits with minimal keystrokes. Learning these advanced commands will save you hours, especially when editing code or large configuration files.
Smart Navigation
w,e,b– jump words forward, to the end, or backward. For example, editing a long sentence in a README,wlets you jump word by word instead of letter by letter.{and}– jump paragraphs. This is perfect when working with Markdown files or code documentation.
Mastering motions makes your workflow feel natural and fluid.
Text Manipulation
c+ motion – change text (e.g.,cwchanges the current word)d+ motion – delete (e.g.,d$deletes to the end of line)y+ motion – yank text (e.g.,y}yanks a paragraph)>/<– indent/unindent lines or selections.– repeat last change
Using operators and motions together allows you to perform complex edits with minimal keystrokes. For example, d} deletes until the end of the paragraph in a single command, which would take multiple steps in a standard editor.
Macros and Registers
q{letter}– start recording a macro@{letter}– replay it
Macros save hours of repetitive edits. I once formatted dozens of function headers using a single macro. Registers let you store multiple copies or snippets for later use.
Working with Buffers and Windows
:bn/:bp– switch buffers:split filename/:vsplit filename– split windows horizontally or verticallyCtrl+w+ arrow – move between splits
This allows you to compare files side by side or edit multiple files simultaneously, essential for developers or sysadmins managing complex projects.
Search and Replace Like a Pro
*/#– search word under cursor forward/backward:g/pattern/d– delete all lines matching a pattern
For instance, :g/^#/d removes all commented lines from a script before sharing it with your team.
Customization
:set number– show line numbers:set relativenumber– show relative line numbers:set hlsearch– highlight search results:set incsearch– search incrementally
Relative line numbers make commands like 5dd intuitive, while highlighting search results reduces mistakes and improves speed.
Conclusion
Vim isn’t just a text editor—it’s a productivity powerhouse. From a hesitant nobody user to a confident Linux professional, mastering these commands will dramatically improve your workflow. Start with navigation and basic editing, gradually adopt advanced text manipulation, macros, and buffers. Before long, editing files in Vim will feel natural, almost like second nature.
Whether you choose Vim or Neovim, the key is practice. Open a file, experiment, and don’t be afraid to make mistakes. Every keystroke builds your muscle memory and turns Vim from a mysterious tool into your secret weapon on Linux. Remember, even small improvements in your command usage will save you hours in the long run.






Pingback: I Replaced cat With bat. You Might Want To Do The Same - iDoLinux
Pingback: The Ultimate Guide for Using Netcat (nc) on Linux - iDoLinux
Pingback: Kernel 7.0 RC2 Can Now Be Installed on Ubuntu and Derivatives - iDoLinux
Pingback: BleachBit 5.1.0 Beta Brings a Cookie Manager, Expert Mode & Powerful Cleanup Improvements - iDoLinux
Pingback: The Ultimate Guide to Using the pwd Command in Linux - iDoLinux
Pingback: Waterfox on Linux: A Privacy-Focused Firefox Alternative with Legacy Add-on Support - iDoLinux
Pingback: How to Split the Screen in Vim (Horizontal and Vertical Windows) - iDoLinux
Pingback: How to Change the visudo Editor on Ubuntu and Debian - iDoLinux
Pingback: How to Edit a File After You Have Opened It With the less Command (or more) - iDoLinux
Pingback: How to Deactivate Caps Lock in Linux (Temporarily or Permanently) - iDoLinux
Pingback: Mastering the Linux tail Command: Real-Time Log Monitoring, Practical Examples, and Advanced Usage - iDoLinux
Pingback: How to Get Root Access Inside Vim If You Forgot to Run It with Sudo - iDoLinux
Pingback: Pinta Is Still the Best Paint.NET Alternative for Linux - iDoLinux
Pingback: BlueFish 2.4.1 HTML Editor – Lightweight Code Editor Update - iDoLinux
Pingback: Clonezilla Explained: The Ultimate Free Tool for Disk Cloning and System Backup - iDoLinux