usr_01
usr_01.1 Two manuals
- The User manual
- The Reference manual
JUMPING AROUND
Press CTRL-] to jump to a subject under the cursor.
Press CTRL-O to jump back.
usr_01.2 Vim installed
if you start Vim now , the ‘compatible’ option should be off.
:!cp -i $VIMRUNTIME/vimrc_example.vim ~/.vimrc
:set compatible?
:scriptnames
If you file is not in the list, check its location and name.
usr_01.3 Using the Vim tutor
vimtutor
usr_02
02.1 Running Vim for the First Time
The tilde (~) lines indicate lines not in the file.
tilde: 我也不认识这个单词,不过只要知道它代表的是 ~ 就够了, 学英语不一定要去记住它的中文意思。
02.2 Inserting text
To be able see what mode you are in.
:set showmode
02.3 Moving around
h left
j down
k up
l right
02.4 Deleting characters
move the cursor over a character and type “x”.
To delete a whole line use the “dd” command.
Join two lines together, the “J” command does this.
02.5 Undo and Redo
The “u” command undoes the last edit.
You can pree CTRL-R (redo) to reverse the preceding command.
The “U” (undo line) command undoes all the changes made on the last line.
02.6 Other editing commands
APPENDING
“a” command
OPENING UP A NEW LINE
“o” command
The “O” command opens a line above the cursor.
USING A COUNT
“3a!” The count of 3 tells the command that follows to triple its effect.
我没有实现这种方式,我也不知道怎么实现,3a 之后就直接进入 insert mode。
但是我在 .vimrc 里实现了
map !! 3a!<Esc>
02.7 Getting out
To exit, use the “ZZ” command. This command writes the file and exits.
DISCARDING CHANGES
:q!
: enters Command-line mode.
If you want to continue editing with Vim: The “:e!” command reloads the original version of the file.
02.8 Finding help
To get generic help use this command:
:help
or
|help| is hyperlink
After a few jumps, you might want to go back.
CTRL-T (pop tag) takes you back to the preceding position.
CTRL-O (jump to older position) also works nicely here.
This name between “*” characters is used by the help system to define a tag (hyperlink destination).
:help {subject}
:help x
To get a complete index of all Vim commands, use the following command:
:help index
:help CTRL-A
:help CTRL-H
:help i_CTRL-H
:help -t
:help 'number'
:help i_<UP>
You can use the error ID at the start to find help about it:
:help E37
summary:
- press Tab to complete:
:help some
how to use help:
:help helphelp - :help pattern.txt
- Options are enclosed in single apostrophes.
我也不知道这是干什么的,应该是查选项
:help ‘list’
:help options.txt
:help cpo-
- Normal mode commands do not hava a prefix.
:help gt
当打开多个文件的时候会有 tabpage
- Insert mode commands start with i_.
:help i_CTRL-W - Visual mode commands start with v_.
:help v_o - Command line editing and arguments start with c_.
:help c_% - Ex-commands always start with “:”.
:help 😒 - Commands specifically for debugging start with “>”.
:help >cont
这个测试功能怎么用
- Key combinations.
:help i_CTRL-X
:help c_CTRL-R
:help v_Ctrl-A
:help g_CTRL-A - Regexp items always start with /.
:help /+
:help pattern.txt - Registers always start with “quote”.
:help quote: - Vim script is available at
:help eval.txt
:help expr-!
:help function-list
:help append() - Mappings in :h |map.txt|.
:help mapmode-i - Command definitions.
:help command-topic - Window management commands always with CTRL-W.
:help windows.txt - Use |:helpgrep| to search in all help pages.
:helpgrep topic
:cnext
:copen - The user manual.
:help usr_toc.txt
:help 10.1 - Highlighting groups.
:help hl-WarningMsg - Syntax highlighting:
:help :syn-conceal - Quickfix commands usually start with :c while location list commands :l
- Autocommand events can be found by their name:
:help BufWinLeave
:help autocommand-events - Command-line start with “-”.
:help -f - Optional features start with “+”.
:help +conceal - Documentation in the ft--.
:help ft-c-syntax
:help ft-php-omni
:help ft-tex-plugin - Error and Warnings codes can be looked up directly in the help.
:help E297
:help W10