📄 intro.txt
字号:
If the 'showmode' option is on "-- SELECT --" is shown at the bottom of the window.Insert mode In Insert mode the text you type is inserted into the buffer. See |Insert-mode|. If the 'showmode' option is on "-- INSERT --" is shown at the bottom of the window.Command-line mode In Command-line mode (also called Cmdline mode) youCmdline mode can enter one line of text at the bottom of the window. This is for the Ex commands, ":", the pattern search commands, "?" and "/", and the filter command, "!". |Cmdline-mode|Ex mode Like Command-line mode, but after entering a command you remain in Ex mode. Very limited editing of the command line. |Ex-mode|There are five ADDITIONAL modes: *Operator-pending* *Operator-pending-mode*Operator-pending mode This is like Normal mode, but after an operator command has started, and Vim is waiting for a {motion} to specify the text that the operator will work on.Replace mode Replace mode is a special case of Insert mode. You can do the same things as in Insert mode, but for each character you enter, one character of the existing text is deleted. See |Replace-mode|. If the 'showmode' option is on "-- REPLACE --" is shown at the bottom of the window.Insert Normal mode Entered when CTRL-O given in Insert mode. This is like Normal mode, but after executing one command Vim returns to Insert mode. If the 'showmode' option is on "-- (insert) --" is shown at the bottom of the window.Insert Visual mode Entered when starting a Visual selection from Insert mode, e.g., by using CTRL-O and then "v", "V" or CTRL-V. When the Visual selection ends, Vim returns to Insert mode. If the 'showmode' option is on "-- (insert) VISUAL --" is shown at the bottom of the window.Insert Select mode Entered when starting Select mode from Insert mode. E.g., by dragging the mouse or <S-Right>. When the Select mode ends, Vim returns to Insert mode. If the 'showmode' option is on "-- (insert) SELECT --" is shown at the bottom of the window.==============================================================================6. Switching from mode to mode *mode-switching*If for any reason you do not know which mode you are in, you can always getback to Normal mode by typing <Esc> twice. You will know you are back inNormal mode when you see the screen flash or hear the bell after you type<Esc>. This doesn't work for Ex mode, use ":visual". *i_esc* TO mode ~ Normal Visual Select Insert Replace Cmd-line Ex ~FROM mode ~Normal v V ^V *4 *1 R : / ? ! QVisual *2 ^G c C -- : --Select *5 ^O ^G *6 -- -- --Insert <Esc> -- -- <Insert> -- --Replace <Esc> -- -- <Insert> -- --Command-line *3 -- -- :start -- --Ex :vi -- -- -- -- --- NA-- not possible*1 Go from Normal mode to Insert mode by giving the command "i", "I", "a", "A", "o", "O", "c", "C", "s" or S".*2 Go from Visual mode to Normal mode by giving a non-movement command, which causes the command to be executed, or by hitting <Esc> "v", "V" or "CTRL-V" (see |v_v|), which just stops Visual mode without side effects.*3 Go from Command-line mode to Normal mode by: - Hitting <CR> or <NL>, which causes the entered command to be executed. - Deleting the complete line (e.g., with CTRL-U) and giving a final <BS>. - Hitting CTRL-C or <Esc>, which quits the command-line without executing the command. In the last case <Esc> may be the character defined with the 'wildchar' option, in which case it will start command-line completion. You can ignore that and type <Esc> again. {Vi: when hitting <Esc> the command-line is executed. This is unexpected for most people; therefore it was changed in Vim. But when the <Esc> is part of a mapping, the command-line is executed. If you want the Vi behaviour also when typing <Esc>, use ":cmap ^V<Esc> ^V^M"}*4 Go from Normal to Select mode by: - use the mouse to select text while 'selectmode' contains "mouse" - use a non-printable command to move the cursor while keeping the Shift key pressed, and the 'selectmode' option contains "key" - use "v", "V" or "CTRL-V" while 'selectmode' contains "cmd" - use "gh", "gH" or "g CTRL-H" |g_CTRL-H|*5 Go from Select mode to Normal mode by using a non-printable command to move the cursor, without keeping the Shift key pressed.*6 Go from Select mode to Insert mode by typing a printable character. The selection is deleted and the character is inserted.If the 'insertmode' option is on, editing a file will start in Insert mode. *CTRL-\_CTRL-N* *i_CTRL-\_CTRL-N* *c_CTRL-\_CTRL-N* *v_CTRL-\_CTRL-N*Additionally the command CTRL-\ CTRL-N or <C-\><C-N> can be used to go toNormal mode from any other mode. This can be used to make sure Vim is inNormal mode, without causing a beep like <Esc> would. *Q* *mode-Ex* *Ex-mode* *Ex* *EX*Q Switch to "Ex" mode. This is a bit like typing ":" commands one after another, except: - You don't have to keep pressing ":". - The screen doesn't get updated after each command. - There is no normal command-line editing. - Mappings and abbreviations are not used. In fact, you are editing the lines with the "standard" line-input editing commands (<Del> or <BS> to erase, CTRL-U to kill the whole line). Vim will enter this mode by default if it's invoked as "ex" on the command-line. Use the ":vi" command |:visual| to exit "Ex" mode. Note: In older versions of Vim "Q" formatted text, that is now done with |gq|.==============================================================================7. The window contents *window-contents*In Normal mode and Insert/Replace mode the screen window will show the currentcontents of the buffer: What You See Is What You Get. There are twoexceptions:- When the 'cpoptions' option contains '$', and the change is within one line, the text is not directly deleted, but a '$' is put at the last deleted character.- When inserting text in one window, other windows on the same text are not updated until the insert is finished.{Vi: The screen is not always updated on slow terminals}Lines longer than the window width will wrap, unless the 'wrap' option is off(see below). The 'linebreak' option can be set to wrap at a blank character.If the window has room after the last line of the buffer, Vim will show '~' inthe first column of the last lines in the window, like this:> some line> last line> ~ > ~ Thus the '~' lines indicate that the end of the buffer was reached.If the last line in a window doesn't fit, Vim will indicate this with a '@' inthe first column of the last lines in the window, like this:> first line> second line> @> @Thus the '@' lines indicate that there is a line that doesn't fit in thewindow.When the "lastline" flag is present in the 'display' option, you will not see'@' characters at the left side of window. If the last line doesn't fitcompletely, only the part that fits is shown, and the last three characters ofthe last line are replaced with "@@@", like this:> first line> second line> a very long line that d> oesn't fit in the wi@@@If there is a single line that is too long to fit in the window, this is aspecial situation. Vim will show only part of the line, around where thecursor is. There are no special characters shown, so that you can edit allparts of this line.{Vi: gives an "internal error" on lines that do not fit in the window}The '@' occasion in the 'highlight' option can be used to set specialhighlighting for the '@' and '~' characters. This makes it possible todistinguish them from real characters in the buffer.The 'showbreak' option contains the string to put in front of wrapped lines. *wrap-off*If the 'wrap' option is off, long lines will not wrap. Only the part thatfits on the screen is shown. If the cursor is moved to a part of the linethat is not shown, the screen is scrolled horizontally. The advantage ofthis method is that columns are shown as they are and lines that cannot fiton the screen can be edited. The disadvantage is that you cannot see all thecharacters of a line at once. The 'sidescroll' option can be set to theminimal number of columns to scroll. {Vi: has no 'wrap' option}All normal ASCII characters are displayed directly on the screen. The <Tab>is replaced with the number of spaces that it represents. Other non-printingcharacters are replaced with "^{char}", where {char} is the non-printingcharacter with 64 added. Thus character 7 (bell) will be shown as "^G".Characters between 127 and 160 are replaced with "~{char}", where {char} isthe character with 64 subtracted. These characters occupy more than oneposition on the screen. The cursor can only be positioned on the first one.If you set the 'number' option, all lines will be preceded with theirnumber. Tip: If you don't like wrapping lines to mix with the line numbers,set the 'showbreak' option to eight spaces: ":set showbreak=\ \ \ \ \ \ \ \ "If you set the 'list' option, <Tab> characters will not be shown as severalspaces, but as "^I". A '$' will be placed at the end of the line, so you canfind trailing blanks.In Command-line mode only the command-line itself is shown correctly. Thedisplay of the buffer contents is updated as soon as you go back to Commandmode.The last line of the window is used for status and other messages. Thestatus messages will only be used if an option is on:status message option default Unix default ~current mode 'showmode' on oncommand characters 'showcmd' on offcursor position 'ruler' off offThe current mode is "-- INSERT --" or "-- REPLACE --", see |'showmode'|. Thecommand characters are those that you typed but were not used yet. {Vi: doesnot show the characters you typed or the cursor position}If you have a slow terminal you can switch off the status messages to speedup editing: :set nosc noru nosmIf there is an error, an error message will be shown for at least one second(in reverse video). {Vi: error messages may be overwritten with othermessages before you have a chance to read them}Some commands show how many lines were affected. Above which threshold thishappens can be controlled with the 'report' option (default 2).On the Amiga Vim will run in a CLI window. The name Vim and the full name ofthe current file name will be shown in the title bar. When the window isresized, Vim will automatically redraw the window. You may make the window assmall as you like, but if it gets too small not a single line will fit in it.Make it at least 40 characters wide to be able to read most messages on thelast line.On most Unix systems, resizing the window is recognized and handled correctlyby Vim. {Vi: not ok} vim:ts=8:sw=8:tw=78:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -