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.
- Introduction to Vi
- Getting Started
- Basic Commands
- Navigating in Vi
- Editing Text
- Searching and Replacing
- Saving and Exiting
- Advanced Techniques
- Customization
- Resources
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.
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.
i
- Enter insert modeEsc
- Return to command mode:w
- Save changes:q
- Quit Vi:wq
- Save changes and quit:q!
- Quit without saving
h
- Move leftj
- Move downk
- Move upl
- Move right0
- Move to the beginning of the line$
- Move to the end of the lineCtrl+f
- Page downCtrl+b
- Page up
x
- Delete character under the cursordd
- Delete the current lineyy
- Copy the current linep
- Paste the copied or deleted text after the cursoru
- Undo the last change.
- Repeat the last change
/
- Search forward?
- Search backwardn
- Repeat the search in the same directionN
- Repeat the search in the opposite direction:s/old/new/g
- Replaceold
withnew
globally in the file
:w
- Save changes:q
- Quit Vi:wq
- Save changes and quit:q!
- Quit without saving
Explore more advanced Vi techniques such as macros, marks, and visual mode to enhance your editing capabilities.
Vi can be customized to suit your preferences. Explore configuration options and plugins to tailor Vi to your workflow.
- Vi Cheat Sheet - A handy reference for Vi commands and shortcuts.
- Vi Tutorial - A comprehensive tutorial for beginners to learn Vi.
- Vi Reference Manual - The official reference manual for Vi.