diff runtime/doc/eval.txt @ 17849:73ddc462979d v8.1.1921

patch 8.1.1921: more functions can be used as methods Commit: https://github.com/vim/vim/commit/a4208966fb289a505ebdef62bbc37c214069bab4 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 24 20:50:19 2019 +0200 patch 8.1.1921: more functions can be used as methods Problem: More functions can be used as methods. Solution: Make various functions usable as a method.
author Bram Moolenaar <Bram@vim.org>
date Sat, 24 Aug 2019 21:00:05 +0200
parents f71ee7b04f0b
children 285f7a700185
line wrap: on
line diff
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt*	For Vim version 8.1.  Last change: 2019 Aug 21
+*eval.txt*	For Vim version 8.1.  Last change: 2019 Aug 24
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -3925,6 +3925,7 @@ empty({expr})						*empty()*
 
 		For a long |List| this is much faster than comparing the
 		length with zero.
+
 		Can also be used as a |method|: >
 			mylist->empty()
 
@@ -3936,6 +3937,9 @@ escape({string}, {chars})				*escape()*
 			c:\\program\ files\\vim
 <		Also see |shellescape()| and |fnameescape()|.
 
+		Can also be used as a |method|: >
+			GetText()->escape(' \')
+<
 							*eval()*
 eval({string})	Evaluate {string} and return the result.  Especially useful to
 		turn the result of |string()| back into the original value.
@@ -3977,6 +3981,9 @@ executable({expr})					*executable()*
 			-1	not implemented on this system
 		|exepath()| can be used to get the full path of an executable.
 
+		Can also be used as a |method|: >
+			GetCommand()->executable()
+
 execute({command} [, {silent}])					*execute()*
 		Execute an Ex command or commands and return the output as a
 		string.
@@ -4006,6 +4013,9 @@ execute({command} [, {silent}])					*exe
 		When used recursively the output of the recursive call is not
 		included in the output of the higher level call.
 
+		Can also be used as a |method|: >
+			GetCommand()->execute()
+
 exepath({expr})						*exepath()*
 		If {expr} is an executable and is either an absolute path, a
 		relative path or found in $PATH, return the full path.
@@ -4015,6 +4025,9 @@ exepath({expr})						*exepath()*
 <		If {expr} cannot be found in $PATH or is not executable then
 		an empty string is returned.
 
+		Can also be used as a |method|: >
+			GetCommand()->exepath()
+
 							*exists()*
 exists({expr})	The result is a Number, which is |TRUE| if {expr} is defined,
 		zero otherwise.
@@ -4100,6 +4113,9 @@ exists({expr})	The result is a Number, w
 <		This doesn't check for existence of the "bufcount" variable,
 		but gets the value of "bufcount", and checks if that exists.
 
+		Can also be used as a |method|: >
+			Varname()->exists()
+
 exp({expr})						*exp()*
 		Return the exponential of {expr} as a |Float| in the range
 		[0, inf].
@@ -4200,6 +4216,9 @@ expand({expr} [, {nosuf} [, {list}]])			
 		See |glob()| for finding existing files.  See |system()| for
 		getting the raw output of an external command.
 
+		Can also be used as a |method|: >
+			Getpattern()->expand()
+
 expandcmd({expr})					*expandcmd()*
 		Expand special items in {expr} like what is done for an Ex
 		command such as `:edit`.  This expands special keywords, like
@@ -4207,6 +4226,9 @@ expandcmd({expr})					*expandcmd()*
 		{expr}.  Returns the expanded string.
 		Example: >
 			:echo expandcmd('make %<.o')
+
+<		Can also be used as a |method|: >
+			GetCommand()->expandcmd()
 <
 extend({expr1}, {expr2} [, {expr3}])			*extend()*
 		{expr1} and {expr2} must be both |Lists| or both
@@ -4296,6 +4318,9 @@ feedkeys({string} [, {mode}])				*feedke
 
 		Return value is always 0.
 
+		Can also be used as a |method|: >
+			GetInput()->feedkeys()
+
 filereadable({file})					*filereadable()*
 		The result is a Number, which is |TRUE| when a file with the
 		name {file} exists, and can be read.  If {file} doesn't exist,
@@ -4308,6 +4333,9 @@ filereadable({file})					*filereadable()
 			0
 			echo filereadable(expand('~/.vimrc'))
 			1
+
+<		Can also be used as a |method|: >
+			GetName()->filereadable()
 <							*file_readable()*
 		Obsolete name: file_readable().
 
@@ -4318,6 +4346,9 @@ filewritable({file})					*filewritable()
 		exist, or is not writable, the result is 0.  If {file} is a
 		directory, and we can write to it, the result is 2.
 
+		Can also be used as a |method|: >
+			GetName()->filewriteable()
+
 
 filter({expr1}, {expr2})				*filter()*
 		{expr1} must be a |List| or a |Dictionary|.
@@ -4383,6 +4414,9 @@ finddir({name} [, {path} [, {count}]])		
 		{only available when compiled with the |+file_in_path|
 		feature}
 
+		Can also be used as a |method|: >
+			GetName()->finddir()
+
 findfile({name} [, {path} [, {count}]])				*findfile()*
 		Just like |finddir()|, but find a file instead of a directory.
 		Uses 'suffixesadd'.
@@ -4391,6 +4425,9 @@ findfile({name} [, {path} [, {count}]])	
 <		Searches from the directory of the current file upwards until
 		it finds the file "tags.vim".
 
+		Can also be used as a |method|: >
+			GetName()->findfile()
+
 float2nr({expr})					*float2nr()*
 		Convert {expr} to a Number by omitting the part after the
 		decimal point.
@@ -4470,6 +4507,9 @@ fnameescape({string})					*fnameescape()
 			:exe "edit " . fnameescape(fname)
 <		results in executing: >
 			edit \+some\ str\%nge\|name
+<
+		Can also be used as a |method|: >
+			GetName()->fnameescape()
 
 fnamemodify({fname}, {mods})				*fnamemodify()*
 		Modify file name {fname} according to {mods}.  {mods} is a
@@ -4482,16 +4522,25 @@ fnamemodify({fname}, {mods})				*fnamemo
 <		Note: Environment variables don't work in {fname}, use
 		|expand()| first then.
 
+		Can also be used as a |method|: >
+			GetName()->fnamemodify(':p:h')
+
 foldclosed({lnum})					*foldclosed()*
 		The result is a Number.  If the line {lnum} is in a closed
 		fold, the result is the number of the first line in that fold.
 		If the line {lnum} is not in a closed fold, -1 is returned.
 
+		Can also be used as a |method|: >
+			GetLnum()->foldclosed()
+
 foldclosedend({lnum})					*foldclosedend()*
 		The result is a Number.  If the line {lnum} is in a closed
 		fold, the result is the number of the last line in that fold.
 		If the line {lnum} is not in a closed fold, -1 is returned.
 
+		Can also be used as a |method|: >
+			GetLnum()->foldclosedend()
+
 foldlevel({lnum})					*foldlevel()*
 		The result is a Number, which is the foldlevel of line {lnum}
 		in the current buffer.  For nested folds the deepest level is
@@ -4502,6 +4551,9 @@ foldlevel({lnum})					*foldlevel()*
 		foldlevel is unknown.  As a special case the level of the
 		previous line is usually available.
 
+		Can also be used as a |method|: >
+			GetLnum()->foldlevel()
+
 							*foldtext()*
 foldtext()	Returns a String, to be displayed for a closed fold.  This is
 		the default function used for the 'foldtext' option and should
@@ -4529,6 +4581,10 @@ foldtextresult({lnum})					*foldtextresu
 		Useful when exporting folded text, e.g., to HTML.
 		{not available when compiled without the |+folding| feature}
 
+
+		Can also be used as a |method|: >
+			GetLnum()->foldtextresult()
+<
 							*foreground()*
 foreground()	Move the Vim window to the foreground.  Useful when sent from
 		a client to a Vim server. |remote_send()|
@@ -4548,6 +4604,9 @@ funcref({name} [, {arglist}] [, {dict}])
 		Also for autoloaded functions. {name} cannot be a builtin
 		function.
 
+		Can also be used as a |method|: >
+			GetFuncname()->funcref([arg])
+<
 					*function()* *E700* *E922* *E923*
 function({name} [, {arglist}] [, {dict}])
 		Return a |Funcref| variable that refers to function {name}.
@@ -4623,6 +4682,9 @@ function({name} [, {arglist}] [, {dict}]
 			call Func(500)
 <		Invokes the function as with: >
 			call context.Callback('one', 500)
+<
+		Can also be used as a |method|: >
+			GetFuncname()->function([arg])
 
 
 garbagecollect([{atexit}])				*garbagecollect()*