Skip to content

YuweAEC/learn-vi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Vi Editor Guide

Overview

This repository serves as a comprehensive guide to the Vi text editor, a powerful tool for editing files in Unix-like operating systems. Whether you're a beginner or an experienced user, this guide covers the most commonly used commands and features of Vi, helping you become proficient in text editing.

Contents

  1. Introduction to Vi
  2. Getting Started
  3. Basic Commands
  4. Navigating in Vi
  5. Editing Text
  6. Searching and Replacing
  7. Saving and Exiting
  8. Advanced Techniques
  9. Customization
  10. Resources

Introduction to Vi

Vi is a terminal-based text editor known for its efficiency and versatility. It offers a wide range of commands and features for editing text files, making it a favorite among programmers, system administrators, and power users.

Getting Started

To start using Vi, simply open a terminal and type vi followed by the name of the file you want to edit. If the file does not exist, Vi will create a new one. Once Vi is open, you can begin editing your file using various commands and keystrokes.

Basic Commands

  • i - Enter insert mode
  • Esc - Return to command mode
  • :w - Save changes
  • :q - Quit Vi
  • :wq - Save changes and quit
  • :q! - Quit without saving

Navigating in Vi

  • h - Move left
  • j - Move down
  • k - Move up
  • l - Move right
  • 0 - Move to the beginning of the line
  • $ - Move to the end of the line
  • Ctrl+f - Page down
  • Ctrl+b - Page up

Editing Text

  • x - Delete character under the cursor
  • dd - Delete the current line
  • yy - Copy the current line
  • p - Paste the copied or deleted text after the cursor
  • u - Undo the last change
  • . - Repeat the last change

Searching and Replacing

  • / - Search forward
  • ? - Search backward
  • n - Repeat the search in the same direction
  • N - Repeat the search in the opposite direction
  • :s/old/new/g - Replace old with new globally in the file

Saving and Exiting

  • :w - Save changes
  • :q - Quit Vi
  • :wq - Save changes and quit
  • :q! - Quit without saving

Advanced Techniques

Explore more advanced Vi techniques such as macros, marks, and visual mode to enhance your editing capabilities.

Customization

Vi can be customized to suit your preferences. Explore configuration options and plugins to tailor Vi to your workflow.

Resources

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published