diff options
author | Bram Moolenaar <Bram@vim.org> | 2014-04-01 21:00:59 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2014-04-01 21:00:59 +0200 |
commit | c7f025536e9e5b7b95b55d09094febb627395d05 (patch) | |
tree | 18ecd63ab3352c3089125ad435d5aa2f6d493655 /runtime | |
parent | a1706c958e69086f5c9eb7d79779ed839441ff60 (diff) |
updated for version 7.4.235v7.4.235
Problem: It is not easy to get the full path of a command.
Solution: Add the exepath() function.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/eval.txt | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 66ee3aa2f2..66b3038e26 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1562,6 +1562,10 @@ v:progname Contains the name (with path removed) with which Vim was v:progpath Contains the command with which Vim was invoked, including the path. Useful if you want to message a Vim server using a |--remote-expr|. + To get the full path use: > + echo exepath(v:progpath) +< NOTE: This does not work when the command is a relative path + and the current directory has changed. Read-only. *v:register* *register-variable* @@ -1762,6 +1766,7 @@ escape( {string}, {chars}) String escape {chars} in {string} with '\' eval( {string}) any evaluate {string} into its value eventhandler( ) Number TRUE if inside an event handler executable( {expr}) Number 1 if executable {expr} exists +exepath( {expr}) String full path of the command {expr} exists( {expr}) Number TRUE if {expr} exists extend( {expr1}, {expr2} [, {expr3}]) List/Dict insert items of {expr2} into {expr1} @@ -2706,6 +2711,15 @@ executable({expr}) *executable()* 0 does not exist -1 not implemented on this system +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. + Note that the current directory is used when {expr} starts + with "./", which may be a problem for Vim: > + echo exepath(v:progpath) +< If {expr} cannot be found in $PATH or is not executable then + an empty string is returned. + *exists()* exists({expr}) The result is a Number, which is non-zero if {expr} is defined, zero otherwise. The {expr} argument is a string, |