VIM Editor Operation Guide
vim [参数] [文件 ..] 编辑指定的文件 或: vim [参数] - 从标准输入(stdin)读取文本 或: vim [参数] -t tag 编辑 tag 定义处的文件 或: vim [参数] -q [errorfile] 编辑第一个出错处的文件
-- 在这以后只有文件名 -v Vi 模式 (同 "vi") -e Ex 模式 (同 "ex") -E Improved Ex mode -s 安静(批处理)模式 (只能与 "ex" 一起使用) -d Diff 模式 (同 "vimdiff") -y 容易模式 (同 "evim",无模式) -R 只读模式 (同 "view") -Z 限制模式 (同 "rvim") -m 不可修改(写入文件) -M 文本不可修改 -b 二进制模式 -l Lisp 模式 -C 兼容传统的 Vi: 'compatible' -N 不完全兼容传统的 Vi: 'nocompatible' -V[N][fname] Be verbose [level N] [log messages to fname] -D 调试模式 -n 不使用交换文件,只使用内存 -r 列出交换文件并退出 -r(跟文件名) 恢复崩溃的会话 -L 同 -r -A 以 Arabic 模式启动 -H 以 Hebrew 模式启动 -F 以 Farsi 模式启动 -T 设定终端类型为 --not-a-term Skip warning for input/output not being a terminal -u 使用 替代任何 .vimrc --noplugin 不加载 plugin 脚本 -P[N] 打开 N 个标签页 (默认值: 每个文件一个) -o[N] 打开 N 个窗口 (默认值: 每个文件一个) -O[N] 同 -o 但垂直分割 + 启动后跳到文件末尾 + 启动后跳到第 行 --cmd <command></command> 加载任何 vimrc 文件前执行 <command></command> -c <command></command> 加载第一个文件后执行 <command></command> -S 加载第一个文件后执行文件 <command></command> -s 从文件 读入正常模式的命令 <command></command> -w 将所有输入的命令追加到文件 <command></command> -W 将所有输入的命令写入到文件 <command></command> -x 编辑加密的文件 <command></command> --startuptime Write startup timing messages to <command></command> -i 使用 取代 .viminfo <command></command> -h 或 --help 打印帮助(本信息)并退出 <command></command> --version 打印版本信息并退出
Vi has three basic working modes:
At any time, no matter what mode the user is in, just press the ESC key to enter Vi into the command mode; when we enter the start Vi command in the shell environment (the prompt is $), when entering the editor, we are also in in this mode. In this mode, users can enter various legal Vi commands to manage their own documents. At this time, any character entered from the keyboard is interpreted as an editing command. If the entered character is a legal Vi command, Vi completes the corresponding action after accepting the user command. However, it should be noted that the entered commands are not displayed on the screen. If the characters entered are not legal commands for Vi, Vi will ring the alarm.
In command mode, enter the insert command i, append command a, open command o, modify command c, replace command r or replace command s to enter text input mode. In this mode, any characters entered by the user are saved by Vi as file content and displayed on the screen. During the text input process, if you want to return to the command mode, just press the ESC key.
Last line mode is also called ex escape mode. In command mode, the user presses the ":" key to enter the last line mode. At this time, Vi will display a ":" on the last line of the display window (usually the last line of the screen) as the prompt for the last line mode. Wait for the user to enter a command. Most file management commands are executed in this mode (such as writing the contents of the edit buffer to a file, etc.). After the last command line is executed, Vi automatically returns to command mode. For example:
:sp newfile
will separate a window to edit the newfile file. If you want to switch from command mode to edit mode, you can type the command a or i; if you need to return from text mode, just press the Esc key. Enter ":" in command mode to switch to last line mode, and then enter the command.
Enter insert mode:
i: 插入光标前一个字符 I: 插入行首 a: 插入光标后一个字符 A: 插入行未 o: 向下新开一行,插入行首 O: 向上新开一行,插入行首
Enter command mode:
ESC:从插入模式或末行模式进入命令模式 移动光标: h: 左移 j: 下移 k: 上移 l: 右移 M: 光标移动到中间行 L: 光标移动到屏幕最后一行行首 G: 移动到指定行,行号 -G w: 向后一次移动一个字 b: 向前一次移动一个字 {: 按段移动,上移 }: 按段移动,下移 Ctr-d: 向下翻半屏 Ctr-u: 向上翻半屏 Ctr-f: 向下翻一屏 Ctr-b: 向上翻一屏 gg: 光标移动文件开头 G: 光标移动到文件末尾
Delete command:
x: 删除光标后一个字符,相当于 Del X: 删除光标前一个字符,相当于 Backspace dd: 删除光标所在行,n dd 删除指定的行数 D: 删除光标后本行所有内容,包含光标所在字符 d0: 删除光标前本行所有内容,不包含光标所在字符 dw: 删除光标开始位置的字,包含光标所在字符
Cancel command:
u: 一步一步撤销 Ctr-r: 反撤销
Repeat command:
.: 重复上一次操作的命令 文本行移动: >>: 文本行右移 >, <p>Replace command: </p> <pre class="brush:php;toolbar:false">把abc全部替换成123 末行模式下,将当前文件中的所有abc替换成123 :%s/abc/123/g 末行模式下,将第一行至第10行之间的abc替换成123 :1, 10s/abc/123/g vim里执行 shell 下命令: 末行模式里输入!,后面跟命令
The above is the detailed content of VIM Editor Operation Guide. For more information, please follow other related articles on the PHP Chinese website!

A GUI for Effortless Flatpak Management: Introducing Warehouse Managing a growing collection of Flatpak applications can be cumbersome using only the command line. Enter Warehouse, a user-friendly graphical interface designed to streamline Flatpak a

This article provides a comprehensive guide to identifying and resolving hard drive bottlenecks in Linux systems. Experienced server administrators will find this particularly useful. Slow disk operations can severely impact application performance,

Efficient QR code generation tool under Linux system In today's digital world, QR codes have become a way to quickly and conveniently share information, simplifying data access from URLs, texts, contacts, Wi-Fi credentials, and even payment information. Linux users can use a variety of tools to create QR codes efficiently. Let's take a look at some popular QR code generators that can be used directly on Linux systems. QRencode QRencode is a lightweight command line tool for generating QR codes on Linux. It is well-received for its simplicity and efficiency and is popular with Linux users who prefer direct methods. Using QRencode, you can use the URL,

Elementary OS 8 Circe: A Smooth and Stylish Linux Experience Elementary OS, a Ubuntu-based Linux distribution, has evolved from a simple theme pack into a fully-fledged, independent operating system. Known for its user-friendly interface, elegant de

Mastering Linux is crucial for any machine learning (ML) engineer. Its command-line interface offers unparalleled flexibility and control, streamlining workflows and boosting productivity. This article outlines essential Linux commands, explained fo

Arch Linux: A Beginner's Command-Line Cheat Sheet Arch Linux offers unparalleled control but can feel daunting for newcomers. This cheat sheet provides essential commands to confidently manage your system. System Information & Updates These com

This guide provides a comprehensive walkthrough of installing and using the Scikit-learn machine learning library on Linux systems. Scikit-learn (sklearn) is a powerful, open-source Python library offering a wide array of tools for various machine l

This guide explains how to leverage Docker for accessing Kali Linux tools, a safer and more efficient alternative to outdated methods like Katoolin. Katoolin is no longer actively maintained and may cause compatibility problems on modern systems. Do


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 English version
Recommended: Win version, supports code prompts!

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft
