📄 eval.txt
字号:
hangul_input Compiled with Hangul input support. |hangul|insert_expand Compiled with support for CTRL-X expansion commands in Insert mode.langmap Compiled with 'langmap' support.linebreak Compiled with 'linebreak', 'breakat' and 'showbreak' support.lispindent Compiled with support for lisp indenting.mac Macintosh version of Vim.menu Compiled with support for |:menu|.mksession Compiled with support for |:mksession|.modify_fname Compiled with file name modifiers. |filename-modifiers|mouse Compiled with support mouse.mouse_dec Compiled with support for Dec terminal mouse.mouse_gpm Compiled with support for gpm (Linux console mouse)mouse_netterm Compiled with support for netterm mouse.mouse_xterm Compiled with support for xterm mouse.multi_byte Compiled with support for Korean et al.multi_byte_ime Compiled with support for IME input methodole Compiled with OLE automation support for Win32.os2 OS/2 version of Vim.osfiletype Compiled with support for osfiletypes |+osfiletype|perl Compiled with Perl interface.python Compiled with Python interface.quickfix Compiled with |quickfix| support.rightleft Compiled with 'rightleft' support.scrollbind Compiled with 'scrollbind' support.showcmd Compiled with 'showcmd' support.smartindent Compiled with 'smartindent' support.sniff Compiled with SniFF interface support.statusline Compiled with support for 'statusline', 'rulerformat' and special formats of 'titlestring' and 'iconstring'.syntax Compiled with syntax highlighting support.syntax_items There are active syntax highlighting items for the current buffer.system Compiled to use system() instead of fork()/exec().tag_binary Compiled with binary searching in tags files |tag-binary-search|.tag_old_static Compiled with support for old static tags |tag-old-static|.tag_any_white Compiled with support for any white characters in tags files |tag-any-white|.tcl Compiled with Tcl interface.terminfo Compiled with terminfo instead of termcap.textobjects Compiled with support for |text-objects|.tgetent Compiled with tgetent support, able to use a termcap or terminfo file.title Compiled with window title support |'title'|.unix Unix version of Vim.user_commands User-defined commands.viminfo Compiled with viminfo support.vim_starting True while initial source'ing takes place.visualextra Compiled with extra Visual mode commands |blockwise-operators|.vms VMS version of Vim.wildmenu Compiled with 'wildmenu' option.wildignore Compiled with 'wildignore' option.winaltkeys Compiled with 'winaltkeys' option.win16 Win16 version of Vim (Windows 3.1).win32 Win32 version of Vim (Windows 95/NT).writebackup Compiled with 'writebackup' default on.xim Compiled with X input method support |xim|.xfontset Compiled with X fontset support |xfontset|.xterm_clipboard Compiled with support for xterm clipboard.xterm_save Compiled with support for saving and restoring the xterm screen.x11 Compiled with X11 support.==============================================================================5. Defining functions *user-functions*New functions can be defined. These can be called just like builtinfunctions.The function name must start with an uppercase letter, to avoid confusion withbuiltin functions. To prevent from using the same name in different scriptsavoid obvious, short names. A good habit is to start the function name withthe name of the script, e.g., "HTMLcolor()". *:fu* *:function*:fu[nction] List all functions and their arguments.:fu[nction] {name} List function {name}.:fu[nction][!] {name}([arguments]) [range] [abort] Define a new function by the name {name}. The name must be made of alphanumeric characters and '_', and must start with a capital. An argument can be defined by giving its name. In the function this can then be used as "a:name" ("a:" for argument). Up to 20 arguments can be given, separated by commas. Finally, an argument "..." can be specified, which means that more arguments may be following. In the function they can be used as "a:1", "a:2", etc. "a:0" is set to the number of extra arguments (which can be 0). When not using "...", the number of arguments in a function call must be equal the number of named arguments. When using "...", the number of arguments may be larger. It is also possible to define a function without any arguments. You must still supply the () then. The body of the function follows in the next lines, until the matching |:endfunction|. It is allowed to define another function inside a function body. When a function by this name already exists and [!] is not used an error message is given. When [!] is used, an existing function is silently replaced. When the [range] argument is added, the function is expected to take care of a range itself. The range is passed as "a:firstline" and "a:lastline". If [range] is excluded, ":{range}call" will call the function for each line in the range, with the cursor on the start of each line. See |function-range-example|. When the [abort] argument is added, the function will abort as soon as an error is detected. The last used search pattern and the redo command "." will not be changed by the function. *:endf* *:endfunction*:endf[unction] The end of a function definition. *:delf* *:delfunction*:delf[unction] {name} Delete function {name}. *:retu* *:return*:retu[rn] [expr] Return from a function. When "[expr]" is given, it is evaluated and returned as the result of the function. If "[expr]" is not given, the number 0 is returned. When a function ends without an explicit ":return", the number 0 is returned. Note that there is no check for unreachable lines, thus there is no warning if commands follow ":return".Inside a function variables can be used. These are local variables, whichwill disappear when the function returns. Global variables need to beaccessed with "g:".Example:> :function Table(title, ...)> : echohl Title> : echo a:title> : echohl None> : let idx = 1> : while idx <= a:0> : exe "echo a:" . idx> : let idx = idx + 1> : endwhile> : return idx> :endfunctionThis function can then be called with:> let lines = Table("Table", "line1", "line2")> let lines = Table("Empty Table")To return more than one value, pass the name of a global variable:> :function Compute(n1, n2, divname)> : if a:n2 == 0> : return "fail"> : endif> : exe "let g:" . a:divname . " = ". a:n1 / a:n2> : return "ok"> :endfunctionThis function can then be called with:> :let success = Compute(13, 1324, "div")> :if success == "ok"> : echo div> :endifAn alternative is to return a command that can be executed. This also workswith local variables in a calling function. Example:> :function Foo()> : execute Bar()> : echo "line " . lnum . " column " . col> :endfunction>> :function Bar()> : return "let lnum = " . line(".") . " | let col = " . col(".")> :endfunctionThe names "lnum" and "col" could also be passed as argument to Bar(), to allowthe caller to set the names. *:cal* *:call*:[range]cal[l] {name}([arguments]) Call a function. The name of the function and its arguments are as specified with |:function|. Up to 20 arguments can be used. Without a range and for functions that accept a range, the function is called once, with the cursor at the current position. When a range is given and the function doesn't handle it itself, the function is executed for each line in the range, with the cursor in the first column of that line. The cursor is left at the last line (possibly moved by the last function call). The arguments are re-evaluated for each line. Thus this works: *function-range-example*> :function Mynumber(arg)> : echo line(".") . " " . a:arg> :endfunction> :1,5call Mynumber(getline(".")) The "a:firstline" and "a:lastline" are defined anyway, they can be used to do something different at the start or end of the range. Example of a function that handles the range itself:> :function Cont() range> : execute (a:firstline + 1) . "," . a:lastline . 's/^/\t\\ '> :endfunction> :4,8call Cont() This function inserts the continuation character "\" in front of all the lines in the range, except the first one.The recursiveness of user functions is restricted with the |'maxfuncdepth'|option.==============================================================================6. Commands *expression-commands*:let {var-name} = {expr1} *:let* Set internal variable {var-name} to the result of the expression {expr1}. The variable will get the type from the {expr}. if {var-name} didn't exist yet, it is created.:let ${env-name} = {expr1} *:let-environment* *:let-$* Set environment variable {env-name} to the result of the expression {expr1}. The type is always String.:let @{reg-name} = {expr1} *:let-register* *:let-@* Write the result of the expression {expr1} in register {reg-name}. {reg-name} must be a single letter, and must be the name of a writable register (see |registers|). "@@" can be used for the unnamed register, "@/" for the search pattern. If the result of {expr1} ends in a <CR> or <NL>, the register will be linewise, otherwise it will be set to characterwise.:let &{option-name} = {expr1} *:let-option* *:let-star* Set option {option-name} to the result of the expression {expr1}. The type of the option is always used. *:unlet* *:unl*:unl[et][!] {var-name} ... Remove the internal variable {var-name}. Several variable names can be given, they are all removed. With [!] no error message is given for non-existing variables.:if {expr1} *:if* *:endif* *:en*:en[dif] Execute the commands until the next matching ":else" or ":endif" if {expr1} evaluates to non-zero. From Vim version 4.5 until 5.0, every Ex command in between the ":if" and ":endif" is ignored. These two commands were just to allow for future expansions in a backwards compatible way. Nesting was allowed. Note that any ":else" or ":elseif" was ignored, the "else" part was not executed either. You can use this to remain compatible with older versions:> :if version >= 500> : version-5-specific-commands> :endif *:else* *:el*:el[se] Execute the commands until the next matching ":else" or ":endif" if they previously were not being executed. *:elseif* *:elsei*:elsei[f] {expr1} Short for ":else" ":if", with the addition that there is no extra ":endif".:wh[ile] {expr1} *:while* *:endwhile* *:wh* *:endw*:endw[hile] Repeat the commands between ":while" and ":endwhile", as long as {expr1} evaluates to non-zero. When an error is detected from a command inside the loop, execution continues after the "endwhile". NOTE: The ":append" and ":insert" commands don't work properly inside a ":while" loop. *:continue* *:con*:con[tinue] When used inside a ":while", jumps back to the ":while". *:break* *:brea*:brea[k] When used inside a ":while", skips to the command after the matching ":endwhile". *:ec* *:echo*:ec[ho] {expr1} .. Echoes each {expr1}, with a space in between and a terminating <EOL>. Also see |:comment|. Use "\n" to start a new line. Use "\r" to move the cursor to the first column. Cannot be followed by a comment. Example:> :echo "the value of 'shell' is" &shell *:echon*:echon {expr1} .. Echoes each {expr1}, without anything added. Also see |:comment|. Cannot be followed by a comment. Example:> :echon "the value of 'shell' is " &shell Note the difference between using ":echo", which is a Vim command, and ":!echo", which is an external shell command:> :!echo % --> filename The arguments of ":!" are expanded, see |:_%|.> :!echo "%" --> filename or "filename" Like the previous example. Whether you see the double quotes or not depends on your 'shell'.> :echo % --> nothing The '%' is an illegal character in an expression.> :echo "%" --> % This just echoes the '%' character.> :echo expand("%") --> filename This calls the expand() function to expand the '%'. *:echoh* *:echohl*:echoh[l] {name} Use the highlight group {name} for the following ":echo[n]" commands. Example:> :echohl WarningMsg | echo "Don't panic!" | echohl None Don't forget to set the group back to "None", otherwise all following echo's will be highlighted. *:exe* *:execute*:exe[cute] {expr1} .. Executes the string that results from the evaluation of {expr1} as an Ex command. Multiple arguments are concatenated, with a space in between. Cannot be followed by a comment. Examples:> :execute "buffer " nextbuf> :ex
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -