Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the parameters of Vim

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Today, the editor will share with you the relevant knowledge points about the parameters of Vim, which are detailed and logical. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.

Syntax vim [parameters] [file..] Edit the specified file or: vim [parameter]-read text from standard input (stdin) or: vim [parameter]-t tag edit the file at the tag definition or: vim [parameter]-Q [errorfile] edit the file parameter at the first error:-- after that, only the file name-v Vi mode (same as "vi")-e Ex mode (same as "ex")-E Improved Ex mode -s quiet (batch) mode (can only be used with "ex")-d Diff mode (same as "vimdiff")-y easy mode (same as "evim") No mode)-R read-only mode (same as "view")-Z restricted mode (same as "rvim")-m unmodifiable (write to file)-M text unmodifiable-b binary mode-l Lisp mode-C compatible with traditional Vi: 'compatible'-N is not fully compatible with traditional Vi:' nocompatible'-V [N] [fname] Be verbose [level N] [log messages to fname]-D debug mode-n does not use swap files Only use memory-r to list swap files and exit-r (with filename) to resume crashed sessions-L same-r Mura starts in Arabic mode-H starts in Hebrew mode-F starts in Farsi mode-T sets terminal type to-- not-a-term Skip warning for input/output not being a terminal-u uses instead of any .vimrc-- noplugin does not load plugin scripts-P [N] Open N Tabs (default: one per file)-o [N] Open N windows (default: one per file)-O [N] same as-o but vertical split + jump to the end of file after startup + jump to line after startup-execute before cmd loads any vimrc file-c load first file-execute after S loads first file File-s commands for reading into normal mode from a file-w appends all entered commands to the file-W writes all entered commands to the file-x edits encrypted files-startuptime Write startup timing messages to-I uses print help instead of .viminfo-h or-- help (this information) and exits-- version prints version information and exits

Editor mode:

Vi has three basic modes of operation:

Command line mode

At any time, no matter what mode the user is in, just press the ESC key to put Vi into command mode; we enter the startup Vi command in the shell environment (prompt $), which is also in this mode when we enter the editor. In this mode, users can enter a variety of legitimate Vi commands to manage their own documents. At this time, any character entered from the keyboard is interpreted as an editing command. If the character entered is a legitimate Vi command, Vi completes the corresponding action after accepting the user's command. Note, however, that the commands entered are not displayed on the screen. If the character entered is not a legitimate command of Vi, Vi will ring the alarm.

Text input mode

Enter insert command I, add command a, open command o, modify command c, replace command r, or replace command s in command mode to enter text input mode. In this mode, any characters entered by the user are saved by Vi as the contents of the file and displayed on the screen. During text entry, if you want to return to command mode, press ESC.

Last row mode

The last line mode is also known as the ex escape mode. In command mode, the user presses the ":" key to enter the last line mode, where Vi displays a ":" on the last line of the display window (usually the last line of the screen) as a prompt for the last line mode, waiting 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). After the last-line command is executed, Vi automatically returns to command mode. For example:

: sp newfile

Then a window is split out to edit the newfile file. If you want to switch from command mode to edit mode, you can type the command an or I; if you need to return from text mode, press Esc. Enter ":" in command mode to switch to the last line mode, and then enter the command.

Enter insert mode:

I: insert the first character before the cursor I: insert the beginning of the line a: insert the first character of the cursor A: insert the line not o: open a new line down, insert the beginning of the line O: open a new line up, insert the beginning of the line

Enter command mode:

ESC: move the cursor from insert mode or last line mode to command mode: h: move left j: move down k: move up l: move right M: move the cursor to the middle line L: move the cursor to the beginning of the last line of the screen G: move to the specified line, line number-Gw: move one word at a time b: move forward one word {: move by segment, move up}: move by segment Move down Ctr-d: flip half screen down Ctr-u: flip half screen up Ctr-f: turn down one screen Ctr-b: turn up one screen gg: move the cursor to the beginning of the file G: move the cursor to the end of the file

Delete command:

X: delete one character after the cursor, equivalent to Del X: delete one character before the cursor, equivalent to Backspacedd: delete the line of the cursor, n dd delete the specified number of lines D: delete all the contents of the line after deleting the cursor, including the character D0: delete all the contents of the line before the cursor, excluding the character of the cursor dw: delete the word at the beginning of the cursor, including the character where the cursor is located

Revoke the order:

U: undo Ctr-r step by step: reverse undo

Repeat the command:

.: repeat the command line of the last operation to move: > >: move the text line to the right >

Replace the command:

Replace all the abc with 123 last line mode, replace all the abc in the current file with the last line mode of 123:%s/abc/123/g, replace the abc between the first line and the 10th line with 123 abc 1, and execute the shell command in 10s/abc/123/gvim: input in the last line mode!, followed by the command above is "what are the parameters of Vim?" all the contents of this article, thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report