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

📄 eval.txt

📁 MSYS在windows下模拟了一个类unix的终端
💻 TXT
📖 第 1 页 / 共 5 页
字号:
*eval.txt*      For Vim version 5.8.  Last change: 2001 May 29		  VIM REFERENCE MANUAL    by Bram MoolenaarExpression evaluation					*expression* *expr*Note: Expression evaluation can be disabled at compile time.  If this has beendone, the features in this document are not available.  See |+eval| and thelast chapter below.1. Variables		|variables|2. Expression syntax	|expression-syntax|3. Internal variable	|internal-variables|4. Builtin Functions	|functions|5. Defining functions	|user-functions|6. Commands		|expression-commands|7. Examples		|eval-examples|8. No +eval feature	|no-eval-feature|{Vi does not have any of these commands}==============================================================================1. Variables						*variables*There are two types of variables:Number		a 32 bit signed number.String		a NUL terminated string of 8-bit unsigned characters.These are converted automatically, depending on how they are used.Conversion from a Number to a String is by making the ASCII representation ofthe Number.  Examples:>	Number 123	-->	String "123">	Number 0	-->	String "0">	Number -1	-->	String "-1"Conversion from a String to a Number is done by converting the first digitsto a number.  Hexadecimal "0xf9" and Octal "017" numbers are recognized.  Ifthe String doesn't start with digits, the result is zero.  Examples:>	String "456"	-->	Number 456>	String "6bar"	-->	Number 6>	String "foo"	-->	Number 0>	String "0xf1"	-->	Number 241>	String "0100"	-->	Number 64To force conversion from String to Number, add zero to it:>	:echo "0100" + 0For boolean operators Numbers are used.  Zero is FALSE, non-zero is TRUE.Note that in the command	:if "foo""foo" is converted to 0, which means FALSE.  To test for a non-empty string,use strlen():	:if strlen("foo")When the '!' flag is included in the 'viminfo' option, global variables thatstart with an uppercase letter, and don't contain a lowercase letter, arestored in the viminfo file |viminfo-file|.When the 'sessionoptions' option contains "global", global variables thatstart with an uppercase letter and contain at least one lowercase letter arestored in the session file |session-file|.variable name		can be stored where ~my_var_6		notMy_Var_6		session fileMY_VAR_6		viminfo file==============================================================================2. Expression syntax					*expression-syntax*Expression syntax summary, from least to most significant:|expr1|	expr2 || expr2 ..	logical OR|expr2|	expr3 && expr3 ..	logical AND|expr3|	expr4 == expr4		equal	expr4 != expr4		not equal	expr4 >	 expr4		greater than	expr4 >= expr4		greater than or equal	expr4 <	 expr4		smaller than	expr4 <= expr4		smaller than or equal	expr4 =~ expr4		regexp matches	expr4 !~ expr4		regexp doesn't match	expr4 ==? expr4		equal, ignoring case	expr4 ==# expr4		equal, match case	etc.  As above, append ? for ignoring case, # for matching case|expr4|	expr5 +	 expr5 ..	number addition	expr5 -	 expr5 ..	number subtraction	expr5 .	 expr5 ..	string concatenation|expr5|	expr6 *	 expr6 ..	number multiplication	expr6 /	 expr6 ..	number division	expr6 %	 expr6 ..	number modulo|expr6|	! expr6			logical NOT	- expr6			unary minus	expr7|expr7|	expr8[expr1]		index in String|expr8|	number			number constant	"string"		string constant	'string'		literal string constant	&option			option value	(expr1)			nested expression	variable		internal variable	$VAR			environment variable	@r			contents of register 'r'	function(expr1, ...)	function call".." indicates that the operations in this level can be concatenated.Example:>	&nu || &list && &shell == "csh"All expressions within one level are parsed from left to right.expr1 and expr2						*expr1* *expr2*---------------						*expr-barbar* *expr-&&*The "||" and "&&" operators take one argument on each side.  The argumentsare (converted to) Numbers.  The result is:	 input				 output		    ~    n1		n2		n1 || n2	n1 && n2    ~    zero	zero		zero		zero    zero	non-zero	non-zero	zero    non-zero	zero		non-zero	zero    non-zero	non-zero	non-zero	non-zeroThe operators can be concatenated, for example:>	&nu || &list && &shell == "csh"Note that "&&" takes precedence over "||", so this has the meaning of:>	&nu || (&list && &shell == "csh")Once the result is known, the expression "short-circuits", that is, furtherarguments are not evaluated.  This is like what happens in C.  For example:>	let a = 1>	echo a || bThis is valid even if there is no variable called "b" because "a" is non-zero,so the result must be non-zero.  Similarly below:>	echo exists("b") && b == "yes"This is valid whether "b" has been defined or not.  The second clause willonly be evaluated if "b" has been defined.expr3							*expr3*-----	expr4 {cmp} expr4Compare two expr4 expressions, resulting in a 0 if it evaluates to false, or 1if it evaluates to true.				*expr-==*  *expr-!=*  *expr->*   *expr->=*				*expr-<*   *expr-<=*  *expr-=~*  *expr-!~*				*expr-==#* *expr-!=#* *expr->#*  *expr->=#*				*expr-<#*  *expr-<=#* *expr-=~#* *expr-!~#*				*expr-==?* *expr-!=?* *expr->?*  *expr->=?*				*expr-<?*  *expr-<=?* *expr-=~?* *expr-!~?*		use 'ignorecase'    match case	   ignore case ~equal			==		==#		==?not equal		!=		!=#		!=?greater than		>		>#		>?greater than or equal	>=		>=#		>=?smaller than		<		<#		<?smaller than or equal	<=		<=#		<=?regexp matches		=~		=~#		=~?regexp doesn't match	!~		!~#		!~?Examples:	"abc" ==# "Abc"	  evaluates to 0	"abc" ==? "Abc"	  evaluates to 1	"abc" == "Abc"	  evaluates to 1 if 'ignorecase' is set, 0 otherwiseWhen comparing a String with a Number, the String is converted to a Number,and the comparison is done on Numbers.When comparing two Strings, this is done with strcmp() or stricmp().  Thisresults in the mathematical difference (comparing byte values), notnecessarily the alphabetical difference in the local language.When using the operators with a trailing '#", or the short version and'ignorecase' is off, the comparing is done with strcmp().When using the operators with a trailing '?', or the short version and'ignorecase' is set, the comparing is done with stricmp().The "=~" and "!~" operators match the lefthand argument with the righthandargument, which is used as a pattern.  See |pattern| for what a pattern is.This matching is always done like 'magic' was set and 'cpoptions' is empty, nomatter what the actual value of 'magic' or 'cpoptions' is.  This makes scriptsportable.  To avoid backslashes in the regexp pattern to be doubled, use asingle-quote string, see |literal-string|.expr4 and expr5						*expr4* *expr5*---------------	expr5 +	 expr5 ..	number addition		*expr-+*	expr5 -	 expr5 ..	number subtraction	*expr--*	expr5 .	 expr5 ..	string concatenation	*expr-.*	expr6 *	 expr6 ..	number multiplication	*expr-star*	expr6 /	 expr6 ..	number division		*expr-/*	expr6 %	 expr6 ..	number modulo		*expr-%*For all, except ".", Strings are converted to Numbers.Note the difference between "+" and ".":	"123" + "456" = 579	"123" . "456" = "123456"When the righthand side of '/' is zero, the result is 0xfffffff.When the righthand side of '%' is zero, the result is 0.expr6							*expr6*-----	! expr6			logical NOT		*expr-!*	- expr6			unary minus		*expr-unary--*For '!' non-zero becomes zero, zero becomes one.For '-' the sign of the number is changed.A String will be converted to a Number first.These two can be repeated and mixed.  Examples:    !-1	    == 0    !!8	    == 1    --9	    == 9expr7							*expr7*-----	expr8[expr1]		index in String		*expr-[]*This results in a String that contains the expr1'th single character fromexpr8.  expr8 is used as a String, expr1 as a Number.Note that index zero gives the first character.  This is like it works in C.Careful: column numbers start with one!  Example, to get the character underthe cursor:>   c = getline(line("."))[col(".") - 1]If the length of the String is less than the index, the result is an emptyString.							*expr8*number------	number			number constant		*expr-number*Decimal, Hexadecimal (starting with 0x or 0X), or Octal (starting with 0).string							*expr-string*------	"string"		string constant		*expr-quote*Note that double quotes are used.A string constant accepts these special characters:	\...	three-digit octal number (e.g., "\316")	\..	two-digit octal number (must be followed by non-digit)	\.	one-digit octal number (must be followed by non-digit)	\x..	two-character hex number (e.g., "\x1f")	\x.	one-character hex number (must be followed by non-hex)	\X..	same as \x..	\X.	same as \x.	\b	backspace <BS>	\e	escape <Esc>	\f	formfeed <FF>	\n	newline <NL>	\r	return <CR>	\t	tab <Tab>	\\	backslash	\"	double quote	\<xxx>	Special key named "xxx".  e.g. "\<C-W>" for CTRL-W.Note that "\000" and "\x00" force the end of the string.literal-string						*literal-string*---------------	'string'		literal string constant		*expr-'*Note that single quotes are used.This string is taken literally.  No backslashes are removed or have a specialmeaning.  A literal-string cannot contain a single quote.  Use a normal stringfor that.option							*expr-option*------	&option			option valueAny option name can be used here.  See |options|.register						*expr-register*--------	@r			contents of register 'r'The result is the contents of the named register, as a single string.Newlines are inserted where required.  To get the contents of the unnamedregister use @@.  The '=' register can not be used here.  See |registers| foran explanation of the available registers.nesting							*expr-nesting*-------	(expr1)			nested expressionenvironment variable					*expr-env*--------------------	$VAR			environment variableThe String value of any environment variable.  When it is not defined, theresult is an empty string.							*expr-env-expand*Note that there is a difference between using $VAR directly and usingexpand("$VAR").  Using it directly will only expand environment variables thatare known inside the current Vim session.  Using expand() will first try usingthe environment variables known inside the current Vim session.  If thatfails, a shell will be used to expand the variable.  This can be slow, but itdoes expand all variables that the shell knows about.  Example:>   echo $version>   echo expand("$version")The first one probably doesn't echo anything, the second echoes the $versionvariable (if your shell supports it).

⌨️ 快捷键说明

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