comparison runtime/doc/eval.txt @ 9430:e70fd2eb3ae1 v7.4.1996

commit https://github.com/vim/vim/commit/1e5e1231ac9e1ba9678812c96f9d554a078eeec4 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jul 7 17:33:02 2016 +0200 patch 7.4.1996 Problem: Capturing the output of a command takes a few commands. Solution: Add evalcmd().
author Christian Brabandt <cb@256bit.org>
date Thu, 07 Jul 2016 17:45:04 +0200
parents f93704b11e43
children 9da0cb39cbee
comparison
equal deleted inserted replaced
9429:649e8cffa36f 9430:e70fd2eb3ae1
1959 diff_filler({lnum}) Number diff filler lines about {lnum} 1959 diff_filler({lnum}) Number diff filler lines about {lnum}
1960 diff_hlID({lnum}, {col}) Number diff highlighting at {lnum}/{col} 1960 diff_hlID({lnum}, {col}) Number diff highlighting at {lnum}/{col}
1961 empty({expr}) Number |TRUE| if {expr} is empty 1961 empty({expr}) Number |TRUE| if {expr} is empty
1962 escape({string}, {chars}) String escape {chars} in {string} with '\' 1962 escape({string}, {chars}) String escape {chars} in {string} with '\'
1963 eval({string}) any evaluate {string} into its value 1963 eval({string}) any evaluate {string} into its value
1964 evalcmd({command}) String execute {command} and get the output
1964 eventhandler() Number |TRUE| if inside an event handler 1965 eventhandler() Number |TRUE| if inside an event handler
1965 executable({expr}) Number 1 if executable {expr} exists 1966 executable({expr}) Number 1 if executable {expr} exists
1966 exepath({expr}) String full path of the command {expr} 1967 exepath({expr}) String full path of the command {expr}
1967 exists({expr}) Number |TRUE| if {expr} exists 1968 exists({expr}) Number |TRUE| if {expr} exists
1968 extend({expr1}, {expr2} [, {expr3}]) 1969 extend({expr1}, {expr2} [, {expr3}])
3229 turn the result of |string()| back into the original value. 3230 turn the result of |string()| back into the original value.
3230 This works for Numbers, Floats, Strings and composites of 3231 This works for Numbers, Floats, Strings and composites of
3231 them. Also works for |Funcref|s that refer to existing 3232 them. Also works for |Funcref|s that refer to existing
3232 functions. 3233 functions.
3233 3234
3235 evalcmd({command}) *evalcmd()*
3236 Execute Ex {command} and return the output as a string. This
3237 is equivalent to: >
3238 redir => var
3239 {command}
3240 redir END
3241 < To get a list of lines use: >
3242 split(evalcmd(cmd), "\n")
3243
3234 eventhandler() *eventhandler()* 3244 eventhandler() *eventhandler()*
3235 Returns 1 when inside an event handler. That is that Vim got 3245 Returns 1 when inside an event handler. That is that Vim got
3236 interrupted while waiting for the user to type a character, 3246 interrupted while waiting for the user to type a character,
3237 e.g., when dropping a file on Vim. This means interactive 3247 e.g., when dropping a file on Vim. This means interactive
3238 commands cannot be used. Otherwise zero is returned. 3248 commands cannot be used. Otherwise zero is returned.