Patch 8.0.1832 made ":unlet" work on environment variables. No change was made to allow completion to work like with:
:unlet $<TAB> This patch makes completion work as expected. A test is included to ensure that ":unlet" completion works properly. -- Jason Franklin -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
>From 0d0808c6dafb09cd37f44db3f8b37d6f2e1dd4b3 Mon Sep 17 00:00:00 2001 From: Jason Franklin <[email protected]> Date: Wed, 30 May 2018 10:45:00 -0400 Subject: [PATCH] Allow environment var completion with "unlet" --- src/ex_docmd.c | 8 ++++++++ src/testdir/test_unlet.vim | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 82dd049..117d6fa 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -4056,8 +4056,16 @@ set_one_cmd_context( case CMD_unlet: while ((xp->xp_pattern = vim_strchr(arg, ' ')) != NULL) arg = xp->xp_pattern + 1; + xp->xp_context = EXPAND_USER_VARS; xp->xp_pattern = arg; + + if (*xp->xp_pattern == '$') + { + xp->xp_context = EXPAND_ENV_VARS; + ++xp->xp_pattern; + } + break; case CMD_function: diff --git a/src/testdir/test_unlet.vim b/src/testdir/test_unlet.vim index 6636f6d..0a9f3c6 100644 --- a/src/testdir/test_unlet.vim +++ b/src/testdir/test_unlet.vim @@ -45,3 +45,13 @@ func Test_unlet_env() unlet $MUST_NOT_BE_AN_ERROR endfunc + +func Test_unlet_complete() + let g:FOOBAR = 1 + call feedkeys(":unlet g:FOO\t\n", 'tx') + call assert_true(!exists('g:FOOBAR')) + + let $FOOBAR = 1 + call feedkeys(":unlet $FOO\t\n", 'tx') + call assert_true(!exists('$FOOBAR') || empty($FOOBAR)) +endfunc -- 2.7.4
