⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 map.txt

📁 MSYS在windows下模拟了一个类unix的终端
💻 TXT
📖 第 1 页 / 共 3 页
字号:
the first 'q' will not appear on the screen until you type anothercharacter.  This is because Vim cannot know if the next character will be a'q' or not.  If the 'timeout' option is on (which is the default) Vim willonly wait for one second (or as long as specified with the 'timeoutlen'option).  After that it assumes that the 'q' is to be interpreted as such.  Iftype slowly, or your system is slow, reset the 'timeout' option.  Then youmight want to set the 'ttimeout' option.							*map-keys-fails*There is one situation where key codes might not be recognized:- Vim can only read part of the key code.  Mostly this is only the first  character.  This happens on some Unix versions in an xterm.- The key code is after character(s) that are mapped.  E.g., "<F1><F1>" or  "g<F1>".The result is that the key code is not recognized in this situation, and themapping fails.There are two actions needed to avoid this problem:- Remove the 'K' flag from 'cpoptions'.  This will make Vim wait for the rest  of the characters of the function key.- When using <F1> to <F4> the actual key code generated may correspond to  <xF1> to <xF4>.  There are mappings from <xF1> to <F1>, <xF2> to <F2>, etc.,  but these are not recognized after another half a mapping.  Make sure the  key codes for <F1> to <F4> are correct:>	:set <F1>=<type CTRL-V><type F1>  Type the <F1> as four characters.  The part after the "=" must be done with  the actual keys, not the literal text.Another solution is to use the actual key code in the mapping for the secondspecial key:>	:map <F1><Esc>OP :echo "yes"<CR>Don't type a real <Esc>, Vim will recognize the key code and replace it with<F1> anyway.						*recursive_mapping*If you include the {lhs} in the {rhs} you have a recursive mapping.  When{lhs} is typed, it will be replaced with {rhs}.  When the {lhs} which isincluded in {rhs} is encountered it will be replaced with {rhs}, and so on.This makes it possible to repeat a command an infinite number of times.  Theonly problem is that the only way to stop this is by causing an error.  Themacros to solve a maze uses this, look there for an example.  There is oneexception: If the {rhs} starts with {lhs}, the first character is not mappedagain (this is Vi compatible).For example:>  :map ab abcdwill execute the "a" command and insert "bcd" in the text.  The "ab" in the{rhs} will not be mapped again.If you want to exchange the meaning of two keys you should use the :noremapcommand.  For example:>  :noremap k j>  :noremap j kThis will exchange the cursor up and down commands.With the normal :map command, when the 'remap' option is on, mapping takesplace until the text is found not to be a part of a {lhs}.  For example, ifyou use:>  :map x y>  :map y xVim will replace x with y, and then y with x, etc.  When this has happened'maxmapdepth' times (default 1000), Vim will give the error message"recursive mapping".							*:map-undo*If you include an undo command inside a mapped sequence, this will bring thetext back in the state before executing the macro.  This is compatible withthe original Vi, as long as there is only one undo command in the mappedsequence (having two undo commands in a mapped sequence did not make sensein the original Vi, you would get back the text before the first undo).							*:map-special-keys*There are three ways to map a special key:1. The Vi-compatible method: Map the key code.  Often this is a sequence that   starts with <Esc>.  To enter a mapping like this you type ":map " and then   you have to type CTRL-V before hitting the function key.  Note that when   the key code for the key is in the termcap (the t_ options), it will   automatically be translated into the internal code and become the second   way of mapping (unless the 'k' flag is included in 'cpoptions').2. The second method is to use the internal code for the function key.  To   enter such a mapping type CTRL-K and then hit the function key, or use   the form "#1", "#2", .. "#9", "#0", "<Up>", "<S-Down>", "<S-F7>", etc.   (see table of keys |key-notation|, all keys from <Up> can be used).  The   first ten function keys can be defined in two ways: Just the number, like   "#2", and with "<F>", like "<F2>".  Both stand for function key 2.  "#0"   refers to function key 10, defined with option 't_f10', which may be   function key zero on some keyboards.  The <> form cannot be used when   'cpoptions' includes the '<' flag.3. Use the termcap entry, with the form <t_xx>, where "xx" is the name of the   termcap entry.  Any string entry can be used.  For example:>    :map <t_F3> G   Maps function key 13 to "G".  This does not work if 'cpoptions' includes   the '<' flag.The advantage of the second and third method is that the mapping will work ondifferent terminals without modification (the function key will betranslated into the same internal code or the actual key code, no matter whatterminal you are using.  The termcap must be correct for this to work, and youmust use the same mappings).DETAIL: Vim first checks if a sequence from the keyboard is mapped.  If itisn't the terminal key codes are tried (see |terminal-options|).  If aterminal code is found it is replaced with the internal code.  Then the checkfor a mapping is done again (so you can map an internal code to somethingelse).  What is written into the script file depends on what is recognized.If the terminal key code was recognized as a mapping the key code itself iswritten to the script file.  If it was recognized as a terminal code theinternal code is written to the script file.==============================================================================2. Abbreviations			*abbreviations* *Abbreviations*Abbreviations are used in Insert mode, Replace mode and Command-line mode.If you enter a word that is an abbreviation, it is replaced with the word itstands for.  This can be used to save typing for often used long words.  Andyou can use it to automatically correct obvious spelling errors.Examples:	:iab ms MicroSoft	:iab tihs thisThere are three types of abbreviations:full-id	  The "full-id" type consists entirely of keyword characters (letters	  and characters from 'iskeyword' option).  This is the most common	  abbreviation.	  Examples: "foo", "g3", "-1"end-id	  The "end-id" type ends in a keyword character, but all the other	  characters are not keyword characters.	  Examples: "#i", "..f", "$/7"non-id	  The "non-id" type ends in a non-keyword character, the other	  characters may be of any type, excluding space and Tab.  {this type	  is not supported by Vi}	  Examples: "def#", "4/7$"Examples of strings that cannot be abbreviations: "a.b", "#def", "a b", "_$r"An abbreviation is only recognized when you type a non-keyword character.This can also be the <Esc> that ends insert mode or the <CR> that ends acommand.  The non-keyword character which ends the abbreviation is insertedafter the expanded abbreviation.  An exception to this is the character <C-]>,which is used to expand an abbreviation without inserting any extracharacters.Example:>   :ab hh	hello	    "hh<Space>" is expanded to "hello<Space>"	    "hh<C-]>" is expanded to "hello"The characters before the cursor must match the abbreviation.  Each type hasan additional rule:full-id	  In front of the match is a non-keyword character, or this is where	  the line or insertion starts.  Exception: When the abbreviation is	  only one character, it is not recognized if there is a non-keyword	  character in front of it, other than a space or a <Tab>.end-id	  In front of the match is a keyword character, or a space or a <Tab>,	  or this is where the line or insertion starts.non-id	  In front of the match is a space, <Tab> or the start of the line or	  the insertion.Examples: ({CURSOR} is where you type a non-keyword character)>  :ab foo   four old otters		" foo{CURSOR}"	  is expanded to " four old otters"		" foobar{CURSOR}" is not expanded		"barfoo{CURSOR}"  is not expanded>  :ab #i #include		"#i{CURSOR}"	  is expanded to "#include"		">#i{CURSOR}"	  is not expanded>  :ab ;; <endofline>"		"test;;"	  is not expanded		"test ;;"	  is expanded to "test <endofline>"To avoid the abbreviation in insert mode: Type part of the abbreviation, exitinsert mode with <Esc>, re-enter insert mode with "a" and type the rest.  Ortype CTRL-V before the character after the abbreviation.To avoid the abbreviation in Command-line mode: Type CTRL-V twice somewhere inthe abbreviation to avoid it to be replaced.  A CTRL-V in front of a normalcharacter is mostly ignored otherwise.It is possible to move the cursor after an abbreviation:>  :iab if if ()<Left>This does not work if 'cpoptions' includes the '<' flag. |<>|There are no default abbreviations.Abbreviations are never recursive.  You can use ":ab f f-o-o" without anyproblem.  But abbreviations can be mapped.  {some versions of Vi supportrecursive abbreviations, for no apparent reason}Abbreviations are disabled if the 'paste' option is on.						*:ab* *:abbreviate*:ab[breviate]		list all abbreviations.  The character in the first			column indicates the mode where the abbreviation is			used: 'i' for insert mode, 'c' for Command-line			mode, '!' for both.:ab[breviate] {lhs}	list the abbreviations that start with {lhs}:ab[breviate] {lhs} {rhs}			add abbreviation for {lhs} to {rhs}.  If {lhs} already			existed it is replaced with the new {rhs}.  {rhs} may			contain spaces.						*:una* *:unabbreviate*:una[bbreviate] {lhs}	remove abbreviation for {lhs} from the list						*:norea* *:noreabbrev*:norea[bbrev] [lhs] [rhs]			same as ":ab", but no remapping for this {rhs} {not			in Vi}						*:ca* *:cabbrev*:ca[bbrev] [lhs] [rhs]	same as ":ab", but for Command-line mode only.  {not			in Vi}						*:cuna* *:cunabbrev*:cuna[bbrev] {lhs}	same as ":una", but for Command-line mode only.  {not			in Vi}						*:cnorea* *:cnoreabbrev*:cnorea[bbrev] [lhs] [rhs]			same as ":ab", but for Command-line mode only and no			remapping for this {rhs} {not in Vi}						*:ia* *:iabbrev*:ia[bbrev] [lhs] [rhs]	same as ":ab", but for Insert mode only.  {not in Vi}						*:iuna* *:iunabbrev*:iuna[bbrev] {lhs}	same as ":una", but for insert mode only.  {not in			Vi}						*:inorea* *:inoreabbrev*:inorea[bbrev] [lhs] [rhs]			same as ":ab", but for Insert mode only and no			remapping for this {rhs} {not in Vi}							*:abc* *:abclear*:abc[lear]		Remove all abbreviations.  {not in Vi}							*:iabc* *:iabclear*:iabc[lear]		Remove all abbreviations for Insert mode.  {not in Vi}							*:cabc* *:cabclear*:cabc[lear]		Remove all abbreviations for Command-line mode.  {not			in Vi}							*using_CTRL-V*It is possible to use special characters in the rhs of an abbreviation.CTRL-V has to be used to avoid the special meaning of most non printablecharacters.  How many CTRL-Vs need to be typed depends on how you enter theabbreviation.  This also applies to mappings.  Let's use an example here.Suppose you want to abbreviate "esc" to enter an <Esc> character.  When youtype the ":ab" command in Vim, you have to enter this: (here ^V is a CTRL-V

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -