https://github.com/yuweaec/learn-vi
https://github.com/yuweaec/learn-vi
vi vi-editor
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/yuweaec/learn-vi
- Owner: YuweAEC
- Created: 2022-12-04T11:12:51.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-09T17:45:18.000Z (over 1 year ago)
- Last Synced: 2025-01-21T06:27:37.610Z (5 months ago)
- Topics: vi, vi-editor
- Homepage:
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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](#introduction-to-vi)
2. [Getting Started](#getting-started)
3. [Basic Commands](#basic-commands)
4. [Navigating in Vi](#navigating-in-vi)
5. [Editing Text](#editing-text)
6. [Searching and Replacing](#searching-and-replacing)
7. [Saving and Exiting](#saving-and-exiting)
8. [Advanced Techniques](#advanced-techniques)
9. [Customization](#customization)
10. [Resources](#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
- [Vi Cheat Sheet](https://www.lagmonster.org/docs/vi.html) - A handy reference for Vi commands and shortcuts.
- [Vi Tutorial](https://www.guru99.com/the-vi-editor.html) - A comprehensive tutorial for beginners to learn Vi.
- [Vi Reference Manual](https://www.gnu.org/software/gv/manual/html_node/Vi-Reference-Manual.html) - The official reference manual for Vi.