Merge #8589 'VimL: Remove legacy v:xx aliases'

This commit is contained in:
Justin M. Keyes
2018-07-23 03:18:10 +02:00
6 changed files with 29 additions and 17 deletions

View File

@ -1508,8 +1508,7 @@ v:errmsg Last given error message. It's allowed to set this variable.
:silent! next :silent! next
:if v:errmsg != "" :if v:errmsg != ""
: ... handle error : ... handle error
< "errmsg" also works, for backwards compatibility. <
*v:errors* *errors-variable* *v:errors* *errors-variable*
v:errors Errors found by assert functions, such as |assert_true()|. v:errors Errors found by assert functions, such as |assert_true()|.
This is a list of strings. This is a list of strings.
@ -1813,8 +1812,7 @@ v:shell_error Result of the last shell command. When non-zero, the last
:if v:shell_error :if v:shell_error
: echo 'could not rename "foo" to "bar"!' : echo 'could not rename "foo" to "bar"!'
:endif :endif
< "shell_error" also works, for backwards compatibility. <
*v:statusmsg* *statusmsg-variable* *v:statusmsg* *statusmsg-variable*
v:statusmsg Last given status message. It's allowed to set this variable. v:statusmsg Last given status message. It's allowed to set this variable.
@ -1888,7 +1886,6 @@ v:testing Must be set before using `test_garbagecollect_now()`.
v:this_session Full filename of the last loaded or saved session file. See v:this_session Full filename of the last loaded or saved session file. See
|:mksession|. It is allowed to set this variable. When no |:mksession|. It is allowed to set this variable. When no
session file has been saved, this variable is empty. session file has been saved, this variable is empty.
"this_session" also works, for backwards compatibility.
*v:throwpoint* *throwpoint-variable* *v:throwpoint* *throwpoint-variable*
v:throwpoint The point where the exception most recently caught and not v:throwpoint The point where the exception most recently caught and not

View File

@ -837,7 +837,7 @@ resulting file, when executed with a ":source" command:
such as creating menu items in the GUI version. such as creating menu items in the GUI version.
After restoring the Session, the full filename of your current Session is After restoring the Session, the full filename of your current Session is
available in the internal variable "v:this_session" |this_session-variable|. available in the internal variable |v:this_session|.
An example mapping: > An example mapping: >
:nmap <F2> :wa<Bar>exe "mksession! " . v:this_session<CR>:so ~/sessions/ :nmap <F2> :wa<Bar>exe "mksession! " . v:this_session<CR>:so ~/sessions/
This saves the current Session, and starts off the command to load another. This saves the current Session, and starts off the command to load another.

View File

@ -352,6 +352,9 @@ TUI:
VimL (Vim script) compatibility: VimL (Vim script) compatibility:
`count` does not alias to |v:count| `count` does not alias to |v:count|
`errmsg` does not alias to |v:errmsg|
`shell_error` does not alias to |v:shell_error|
`this_session` does not alias to |v:this_session|
============================================================================== ==============================================================================
5. Missing legacy features *nvim-features-missing* 5. Missing legacy features *nvim-features-missing*

View File

@ -344,11 +344,11 @@ static struct vimvar {
VV(VV_COUNT, "count", VAR_NUMBER, VV_RO), VV(VV_COUNT, "count", VAR_NUMBER, VV_RO),
VV(VV_COUNT1, "count1", VAR_NUMBER, VV_RO), VV(VV_COUNT1, "count1", VAR_NUMBER, VV_RO),
VV(VV_PREVCOUNT, "prevcount", VAR_NUMBER, VV_RO), VV(VV_PREVCOUNT, "prevcount", VAR_NUMBER, VV_RO),
VV(VV_ERRMSG, "errmsg", VAR_STRING, VV_COMPAT), VV(VV_ERRMSG, "errmsg", VAR_STRING, 0),
VV(VV_WARNINGMSG, "warningmsg", VAR_STRING, 0), VV(VV_WARNINGMSG, "warningmsg", VAR_STRING, 0),
VV(VV_STATUSMSG, "statusmsg", VAR_STRING, 0), VV(VV_STATUSMSG, "statusmsg", VAR_STRING, 0),
VV(VV_SHELL_ERROR, "shell_error", VAR_NUMBER, VV_COMPAT+VV_RO), VV(VV_SHELL_ERROR, "shell_error", VAR_NUMBER, VV_RO),
VV(VV_THIS_SESSION, "this_session", VAR_STRING, VV_COMPAT), VV(VV_THIS_SESSION, "this_session", VAR_STRING, 0),
VV(VV_VERSION, "version", VAR_NUMBER, VV_COMPAT+VV_RO), VV(VV_VERSION, "version", VAR_NUMBER, VV_COMPAT+VV_RO),
VV(VV_LNUM, "lnum", VAR_NUMBER, VV_RO_SBX), VV(VV_LNUM, "lnum", VAR_NUMBER, VV_RO_SBX),
VV(VV_TERMRESPONSE, "termresponse", VAR_STRING, VV_RO), VV(VV_TERMRESPONSE, "termresponse", VAR_STRING, VV_RO),

View File

@ -7920,7 +7920,7 @@ static void ex_mkrc(exarg_T *eap)
if (failed) { if (failed) {
EMSG(_(e_write)); EMSG(_(e_write));
} else if (eap->cmdidx == CMD_mksession) { } else if (eap->cmdidx == CMD_mksession) {
// successful session write - set this_session var // successful session write - set v:this_session
char *const tbuf = xmalloc(MAXPATHL); char *const tbuf = xmalloc(MAXPATHL);
if (vim_FullName(fname, tbuf, MAXPATHL, false) == OK) { if (vim_FullName(fname, tbuf, MAXPATHL, false) == OK) {
set_vim_var_string(VV_THIS_SESSION, tbuf, -1); set_vim_var_string(VV_THIS_SESSION, tbuf, -1);
@ -8784,15 +8784,15 @@ makeopens(
if (ssop_flags & SSOP_BUFFERS) if (ssop_flags & SSOP_BUFFERS)
only_save_windows = FALSE; /* Save ALL buffers */ only_save_windows = FALSE; /* Save ALL buffers */
/* // Begin by setting v:this_session, and then other sessionable variables.
* Begin by setting the this_session variable, and then other if (put_line(fd, "let v:this_session=expand(\"<sfile>:p\")") == FAIL) {
* sessionable variables.
*/
if (put_line(fd, "let v:this_session=expand(\"<sfile>:p\")") == FAIL)
return FAIL; return FAIL;
if (ssop_flags & SSOP_GLOBALS) }
if (store_session_globals(fd) == FAIL) if (ssop_flags & SSOP_GLOBALS) {
if (store_session_globals(fd) == FAIL) {
return FAIL; return FAIL;
}
}
/* /*
* Close all windows but one. * Close all windows but one.

View File

@ -174,5 +174,17 @@ describe('Special values', function()
command('let count = []') -- v:count is readonly command('let count = []') -- v:count is readonly
eq(1, eval('count is# g:["count"]')) eq(1, eval('count is# g:["count"]'))
end) end)
it('v:errmsg is distinct from errmsg', function()
command('let errmsg = 1')
eq(1, eval('errmsg is# g:["errmsg"]'))
end)
it('v:shell_error is distinct from shell_error', function()
command('let shell_error = []') -- v:shell_error is readonly
eq(1, eval('shell_error is# g:["shell_error"]'))
end)
it('v:this_session is distinct from this_session', function()
command('let this_session = []')
eq(1, eval('this_session is# g:["this_session"]'))
end)
end) end)
end) end)