Skip to content

Commit 1983401

Browse files
committed
patch 8.1.0047: no completion for :unlet $VAR
Problem: No completion for :unlet $VAR. Solution: Add completion. (Jason Franklin)
1 parent 1c3c104 commit 1983401

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

src/ex_docmd.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4056,8 +4056,16 @@ set_one_cmd_context(
40564056
case CMD_unlet:
40574057
while ((xp->xp_pattern = vim_strchr(arg, ' ')) != NULL)
40584058
arg = xp->xp_pattern + 1;
4059+
40594060
xp->xp_context = EXPAND_USER_VARS;
40604061
xp->xp_pattern = arg;
4062+
4063+
if (*xp->xp_pattern == '$')
4064+
{
4065+
xp->xp_context = EXPAND_ENV_VARS;
4066+
++xp->xp_pattern;
4067+
}
4068+
40614069
break;
40624070

40634071
case CMD_function:
@@ -11277,7 +11285,10 @@ makeopens(
1127711285
* winminheight and winminwidth need to be set to avoid an error if the
1127811286
* user has set winheight or winwidth.
1127911287
*/
11280-
if (put_line(fd, "set winminheight=1 winheight=1 winminwidth=1 winwidth=1") == FAIL)
11288+
if (put_line(fd, "set winminheight=0") == FAIL
11289+
|| put_line(fd, "set winheight=1") == FAIL
11290+
|| put_line(fd, "set winminwidth=0") == FAIL
11291+
|| put_line(fd, "set winwidth=1") == FAIL)
1128111292
return FAIL;
1128211293
if (nr > 1 && ses_winsizes(fd, restore_size, tab_firstwin) == FAIL)
1128311294
return FAIL;

src/testdir/test_unlet.vim

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,13 @@ func Test_unlet_env()
4545

4646
unlet $MUST_NOT_BE_AN_ERROR
4747
endfunc
48+
49+
func Test_unlet_complete()
50+
let g:FOOBAR = 1
51+
call feedkeys(":unlet g:FOO\t\n", 'tx')
52+
call assert_true(!exists('g:FOOBAR'))
53+
54+
let $FOOBAR = 1
55+
call feedkeys(":unlet $FOO\t\n", 'tx')
56+
call assert_true(!exists('$FOOBAR') || empty($FOOBAR))
57+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,8 @@ static char *(features[]) =
761761

762762
static int included_patches[] =
763763
{ /* Add new patch number below this line */
764+
/**/
765+
47,
764766
/**/
765767
46,
766768
/**/

0 commit comments

Comments
 (0)