diff options
author | Shougo Matsushita <Shougo.Matsu@gmail.com> | 2018-06-19 08:50:15 +0900 |
---|---|---|
committer | Shougo Matsushita <Shougo.Matsu@gmail.com> | 2018-07-23 08:47:51 +0900 |
commit | 03bd5a4b91f4b555be9fc44b7fab6a64923667c8 (patch) | |
tree | 45a86fdc35738ef86a642e5941400650f3b38565 | |
parent | 13d29cb9ed0d6fba734dc5a96ed543326ee14b3f (diff) | |
download | rneovim-03bd5a4b91f4b555be9fc44b7fab6a64923667c8.tar.gz rneovim-03bd5a4b91f4b555be9fc44b7fab6a64923667c8.tar.bz2 rneovim-03bd5a4b91f4b555be9fc44b7fab6a64923667c8.zip |
Make "v:errmsg", "v:shell_error" and "v:this_session" distinct
-rw-r--r-- | runtime/doc/eval.txt | 5 | ||||
-rw-r--r-- | runtime/doc/vim_diff.txt | 3 | ||||
-rw-r--r-- | src/nvim/eval.c | 6 | ||||
-rw-r--r-- | test/functional/eval/special_vars_spec.lua | 12 |
4 files changed, 19 insertions, 7 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index c460e65c64..a306c77829 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1508,7 +1508,6 @@ v:errmsg Last given error message. It's allowed to set this variable. :silent! next :if v:errmsg != "" : ... handle error -< "errmsg" also works, for backwards compatibility. *v:errors* *errors-variable* v:errors Errors found by assert functions, such as |assert_true()|. @@ -1813,8 +1812,7 @@ v:shell_error Result of the last shell command. When non-zero, the last :if v:shell_error : echo 'could not rename "foo" to "bar"!' :endif -< "shell_error" also works, for backwards compatibility. - +< *v:statusmsg* *statusmsg-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 |:mksession|. It is allowed to set this variable. When no session file has been saved, this variable is empty. - "this_session" also works, for backwards compatibility. *v:throwpoint* *throwpoint-variable* v:throwpoint The point where the exception most recently caught and not diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 8bda114639..ef0b54fa33 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -352,6 +352,9 @@ TUI: VimL (Vim script) compatibility: `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* diff --git a/src/nvim/eval.c b/src/nvim/eval.c index e6880f58e7..36662b2a39 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -344,11 +344,11 @@ static struct vimvar { VV(VV_COUNT, "count", VAR_NUMBER, VV_RO), VV(VV_COUNT1, "count1", 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_STATUSMSG, "statusmsg", VAR_STRING, 0), - VV(VV_SHELL_ERROR, "shell_error", VAR_NUMBER, VV_COMPAT+VV_RO), - VV(VV_THIS_SESSION, "this_session", VAR_STRING, VV_COMPAT), + VV(VV_SHELL_ERROR, "shell_error", VAR_NUMBER, VV_RO), + VV(VV_THIS_SESSION, "this_session", VAR_STRING, 0), VV(VV_VERSION, "version", VAR_NUMBER, VV_COMPAT+VV_RO), VV(VV_LNUM, "lnum", VAR_NUMBER, VV_RO_SBX), VV(VV_TERMRESPONSE, "termresponse", VAR_STRING, VV_RO), diff --git a/test/functional/eval/special_vars_spec.lua b/test/functional/eval/special_vars_spec.lua index b5773a5529..97a12d490d 100644 --- a/test/functional/eval/special_vars_spec.lua +++ b/test/functional/eval/special_vars_spec.lua @@ -174,5 +174,17 @@ describe('Special values', function() command('let count = []') -- v:count is readonly eq(1, eval('count is# g:["count"]')) 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) |