DEV Community

Amanda Igwe
Amanda Igwe

Posted on

Day 4 of 30 Days of Linux Mastery: Getting Comfortable with Vim

Table of Contents

Introduction

Welcome back to the series! If you have been following from Day 1, we have already set up our environment, practiced basic commands, and started working like real Cloud Sys Admins.

Today, we go deeper by learning something every Linux user must eventually get comfortable with: vim, the powerful text editor that lives in almost every Unix-based system.

What is Vim?

vim stands for Vi Improved or Visual Improved. It is a better, faster, and more capable version of the original vi editor. Built for speed and precision, Vim is a go-to tool for editing files when working directly on Linux servers or cloud instances.

Understanding Vim Modes

This is where beginners get confused. Vim operates in three modes;

  • Command Mode: The default mode when you open a file. Used for moving around, deleting lines, copying, and pasting.

  • Insert Mode: Where you can actually type and edit text. Press i to enter.

  • Extended Mode: Triggered by typing : in Command Mode. It allows you to save, quit, search, and more (e.g., :wq, :q!, :set number).

Core Vim Commands You Should Know

Vim Commands Purpose
i Enter Insert Mode.
Esc Exit to Command Mode
:w Save file
:q Quit Vim
:wq Save & Quit vim
:q! Force Quit (no save)
yy Copy a line
yw Copy the current word
nyy Copy number of lines
p Paste
dd Delete the current line
dw Delete the current word
ndd Delete number of lines
u Undo last change
ctrl+r redo
gg Go to the top of the line
G Go to the bottom of the line
ngg/nG Go to a specific line number
:se nu Enable line numbers
:se nonu Disable line numbers

Conclusion

Learning Vim is one of those skills that pays off long-term. It is fast, efficient, and often the only editor available when you are logged into a cloud server or managing containers. You don’t have to master it all in a day, but the earlier you start, the better you get.

If this helped you, feel free to bookmark, comment, like and follow me for Day 5!

Let's Connect!

If you want to connect or share your journey, feel free to reach out on LinkedIn.
I am always happy to learn and build with others in the tech space.

#30DaysLinuxChallenge #Redhat#RHCSA #RHCE #CloudWhistler #Linux #Rhel #Ansible #Vim #CloudComputing #DevOps #LinuxAutomation #IaC #SysAdmin#CloudEngineer

Top comments (8)

Collapse
 
danschnau profile image
Dan Schnau

Awesome! Vim and vim emulators have been my go-to text editing tool for over a decade. It truly has paid off long term. I started learning it because I noticed my mouse hand was hurting and I wanted to keep my hands on the keyboard more often.

Later I found that there are vim like emulators for just about everything - including visual studio, vs code, and every web browser ❤️

Collapse
 
amandaigwe profile image
Amanda Igwe

Its such a good handy tool. Do you have any shortcuts you might share?

Collapse
 
danschnau profile image
Dan Schnau

Using hjkl, $ to EOL, and b and w to move words are some of the motions I learned first and use the most.

One configuration I always use is to map an escape from insert to normal mode so I don’t have to reach for the ESC key. I use jj for escape with this config:

inoremap jj ESC

Thread Thread
 
amandaigwe profile image
Amanda Igwe

I will have to implement the ESC key configuration. Learned something valuable from you just now. Thank you!

Collapse
 
nevodavid profile image
Nevo David

Neat, this makes using Vim way less scary for beginners.

Collapse
 
amandaigwe profile image
Amanda Igwe

Happy you found it valuable. Thank you!

Collapse
 
hcody profile image
Hesham Alnahas

Nice

Collapse
 
amandaigwe profile image
Amanda Igwe

Thank you!