diff options
author | Bram Moolenaar <bram@vim.org> | 2014-04-01 19:55:49 +0200 |
---|---|---|
committer | Bram Moolenaar <bram@vim.org> | 2014-04-01 19:55:49 +0200 |
commit | f8697a560e44b31aa542d451cdc5903ae8db4318 (patch) | |
tree | c132dab31c31ed984838c2a2a3deb5ad69ad3a1e | |
parent | ebc6b38c4359a05c91102f1812a06e887f7599bc (diff) | |
download | vim-f8697a560e44b31aa542d451cdc5903ae8db4318.tar.gz |
Problem: Can't get the command that was used to start Vim.
Solution: Add v:progpath. (Viktor Kojouharov)
-rw-r--r-- | runtime/doc/eval.txt | 6 | ||||
-rw-r--r-- | src/eval.c | 1 | ||||
-rw-r--r-- | src/main.c | 1 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim.h | 3 |
5 files changed, 12 insertions, 1 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 78237ec9..66ee3aa2 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1558,6 +1558,12 @@ v:progname Contains the name (with path removed) with which Vim was |evim| etc., or any other name you might symlink to Vim. Read-only. + *v:progpath* *progpath-variable* +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|. + Read-only. + *v:register* *register-variable* v:register The name of the register in effect for the current normal mode command (regardless of whether that command actually used a @@ -361,6 +361,7 @@ static struct vimvar {VV_NAME("hlsearch", VAR_NUMBER), 0}, {VV_NAME("oldfiles", VAR_LIST), 0}, {VV_NAME("windowid", VAR_NUMBER), VV_RO}, + {VV_NAME("progpath", VAR_STRING), VV_RO}, }; /* shorthand */ @@ -1602,6 +1602,7 @@ parse_command_name(parmp) #ifdef FEAT_EVAL set_vim_var_string(VV_PROGNAME, initstr, -1); + set_vim_var_string(VV_PROGPATH, (char_u *)parmp->argv[0], -1); #endif if (TOLOWER_ASC(initstr[0]) == 'r') diff --git a/src/version.c b/src/version.c index 0fcea78a..542342f3 100644 --- a/src/version.c +++ b/src/version.c @@ -735,6 +735,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 234, +/**/ 233, /**/ 232, @@ -1880,7 +1880,8 @@ typedef int proftime_T; /* dummy for function prototypes */ #define VV_HLSEARCH 54 #define VV_OLDFILES 55 #define VV_WINDOWID 56 -#define VV_LEN 57 /* number of v: vars */ +#define VV_PROGPATH 57 +#define VV_LEN 58 /* number of v: vars */ #ifdef FEAT_CLIPBOARD |