DEV Community

LaTerral Williams
LaTerral Williams

Posted on • Edited on

2

✍️Getting Started with Vim: A Beginner-Friendly Guide

✨ What is Vim?

Vim, short for "Vi IMproved", is a powerful text editor that evolved from the classic vi editor found on Unix systems. Whether you're working with configuration files, writing scripts, or editing code over SSH, Vim is a must-know tool for anyone serious about using the command line.

👋 Full transparency: I'm new to Vim myself! As I work through different Linux tools, Vim is another one to learn and add to the toolbelt. Here we are again with another post that is both a beginner's guide and my personal learning notes. If you’re just getting started too, you're in good company.

Let's figure it out together!


📚 Table of Contents


🔧 What Is Vim Used For?

Vim is a command-line based text editor used to:

  • Create new files
  • Read or open existing files
  • Append or modify text
  • Save and quit files
  • Quickly navigate large documents

🖊 Syntax

To open or create a file in Vim, use the following command:

vim doc.txt       # Open or create doc.txt in the current directory
vim /home/user/doc.txt   # Open a specific file with a full path
Enter fullscreen mode Exit fullscreen mode

🔄 The 3 Modes of Vim (and Why They Matter)

Vim operates in different modes, each designed for a specific task:

1. Normal (Command) Mode

  • Default mode when you open Vim.

  • Use this mode to navigate, copy, paste, delete, or run commands.

  • Press Esc to return to this mode from any other mode.

Examples:

  • dd – delete a line

  • yy – copy (yank) a line

  • p – paste

  • :w – save

  • :q – quit


2. Insert Mode

  • Used for typing and editing text.

  • Enter this mode by pressing i (insert before cursor), a (append after), or o (open a new line below).

  • Press Esc to return to Command Mode.

Examples:

  • i – start typing before the cursor

  • a – start typing after the cursor

  • o – create a new line below and start editing


3. Command-Line (Ex) Extended Mode

  • Accessed from Normal Mode by typing a colon :

  • Used to run extended commands like saving, quitting, searching, or replacing text.

Examples:

:w – save the file

:q! – force quit without saving

:wq – save and quit

:set number – show line numbers


🛠️ Common Use Cases for Vim

Here are some real-world examples where Vim shines:

  • Editing config files on a Linux server:
vim /etc/ssh/sshd_config
Enter fullscreen mode Exit fullscreen mode
  • Writing or debugging shell scripts:
vim myscript.sh
Enter fullscreen mode Exit fullscreen mode
  • Quick file edits over SSH without a graphical interface:
ssh user@server && vim logfile.txt
Enter fullscreen mode Exit fullscreen mode
  • Taking notes or journaling on a lightweight system:
vim notes.txt
Enter fullscreen mode Exit fullscreen mode

🤯 Three Little-Known Facts About Vim

Well... things I did not know.

Vim Has Its Own Built-In Tutor

  • Run vimtutor from your terminal to start an interactive Vim tutorial!
  • 📚 Source: Vim Documentation

You Can Play Games to Learn Vim

Vim Has Been Around Since 1991

  • That’s over 30 years of active development! Its creator, Bram Moolenaar, released it as charityware to support children in Uganda.
  • 🕰️ Source: Wikipedia - Vim (text editor)

🧠 Final Thoughts

Vim can feel a bit overwhelming, but once you get the hang of its modes and shortcuts, it becomes an incredibly efficient tool, especially inside terminal-only environments.

If you're just getting started, try this first:

vimtutor
Enter fullscreen mode Exit fullscreen mode

Whew! That seemed like a lot. If you made it this far; Thank you!

Happy Vimming! 😄

💬 Let’s Connect

https://www.linkedin.com/in/ltwilliams-tech/

Heroku

Tired of jumping between terminals, dashboards, and code?

Check out this demo showcasing how tools like Cursor can connect to Heroku through the MCP, letting you trigger actions like deployments, scaling, or provisioning—all without leaving your editor.

Learn More

Top comments (0)

MongoDB Atlas runs apps anywhere. Try it now.

MongoDB Atlas runs apps anywhere. Try it now.

MongoDB Atlas lets you build and run modern apps anywhere—across AWS, Azure, and Google Cloud. With availability in 115+ regions, deploy near users, meet compliance, and scale confidently worldwide.

Start Free

👋 Kindness is contagious

Take a moment to explore this thoughtful article, beloved by the supportive DEV Community. Coders of every background are invited to share and elevate our collective know-how.

A heartfelt "thank you" can brighten someone's day—leave your appreciation below!

On DEV, sharing knowledge smooths our journey and tightens our community bonds. Enjoyed this? A quick thank you to the author is hugely appreciated.

Okay