Mercurial > vim
comparison src/ex_docmd.c @ 17781:04245f071792 v8.1.1887
patch 8.1.1887: the +cmdline_compl feature is not in the tiny version
commit https://github.com/vim/vim/commit/0a52df50a0e8fce6f5e0eb5f5373dcd0fa24d83a
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Aug 18 22:26:31 2019 +0200
patch 8.1.1887: the +cmdline_compl feature is not in the tiny version
Problem: The +cmdline_compl feature is not in the tiny version.
Solution: Graduate the +cmdline_compl feature.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 18 Aug 2019 22:30:04 +0200 |
parents | c75da1064e33 |
children | e8a7029efa40 |
comparison
equal
deleted
inserted
replaced
17780:a65bba9901de | 17781:04245f071792 |
---|---|
3321 { | 3321 { |
3322 char_u *p; | 3322 char_u *p; |
3323 char_u *cmd, *arg; | 3323 char_u *cmd, *arg; |
3324 int len = 0; | 3324 int len = 0; |
3325 exarg_T ea; | 3325 exarg_T ea; |
3326 #ifdef FEAT_CMDL_COMPL | |
3327 int compl = EXPAND_NOTHING; | 3326 int compl = EXPAND_NOTHING; |
3328 int delim; | 3327 int delim; |
3329 #endif | |
3330 int forceit = FALSE; | 3328 int forceit = FALSE; |
3331 int usefilter = FALSE; /* filter instead of file name */ | 3329 int usefilter = FALSE; /* filter instead of file name */ |
3332 | 3330 |
3333 ExpandInit(xp); | 3331 ExpandInit(xp); |
3334 xp->xp_pattern = buff; | 3332 xp->xp_pattern = buff; |
3430 p = cmd + 1; | 3428 p = cmd + 1; |
3431 } | 3429 } |
3432 else if (cmd[0] >= 'A' && cmd[0] <= 'Z') | 3430 else if (cmd[0] >= 'A' && cmd[0] <= 'Z') |
3433 { | 3431 { |
3434 ea.cmd = cmd; | 3432 ea.cmd = cmd; |
3435 p = find_ucmd(&ea, p, NULL, xp, | 3433 p = find_ucmd(&ea, p, NULL, xp, &compl); |
3436 #if defined(FEAT_CMDL_COMPL) | |
3437 &compl | |
3438 #else | |
3439 NULL | |
3440 #endif | |
3441 ); | |
3442 if (p == NULL) | 3434 if (p == NULL) |
3443 ea.cmdidx = CMD_SIZE; // ambiguous user command | 3435 ea.cmdidx = CMD_SIZE; // ambiguous user command |
3444 } | 3436 } |
3445 } | 3437 } |
3446 if (ea.cmdidx == CMD_SIZE) | 3438 if (ea.cmdidx == CMD_SIZE) |
3660 break; | 3652 break; |
3661 if (*p == NUL) | 3653 if (*p == NUL) |
3662 { | 3654 { |
3663 xp->xp_context = EXPAND_ENV_VARS; | 3655 xp->xp_context = EXPAND_ENV_VARS; |
3664 ++xp->xp_pattern; | 3656 ++xp->xp_pattern; |
3665 #if defined(FEAT_CMDL_COMPL) | |
3666 /* Avoid that the assignment uses EXPAND_FILES again. */ | 3657 /* Avoid that the assignment uses EXPAND_FILES again. */ |
3667 if (compl != EXPAND_USER_DEFINED && compl != EXPAND_USER_LIST) | 3658 if (compl != EXPAND_USER_DEFINED && compl != EXPAND_USER_LIST) |
3668 compl = EXPAND_ENV_VARS; | 3659 compl = EXPAND_ENV_VARS; |
3669 #endif | |
3670 } | 3660 } |
3671 } | 3661 } |
3672 #if defined(FEAT_CMDL_COMPL) | |
3673 /* Check for user names */ | 3662 /* Check for user names */ |
3674 if (*xp->xp_pattern == '~') | 3663 if (*xp->xp_pattern == '~') |
3675 { | 3664 { |
3676 for (p = xp->xp_pattern + 1; *p != NUL && *p != '/'; ++p) | 3665 for (p = xp->xp_pattern + 1; *p != NUL && *p != '/'; ++p) |
3677 ; | 3666 ; |
3683 { | 3672 { |
3684 xp->xp_context = EXPAND_USER; | 3673 xp->xp_context = EXPAND_USER; |
3685 ++xp->xp_pattern; | 3674 ++xp->xp_pattern; |
3686 } | 3675 } |
3687 } | 3676 } |
3688 #endif | |
3689 } | 3677 } |
3690 | 3678 |
3691 /* | 3679 /* |
3692 * 6. Switch on command name. | 3680 * 6. Switch on command name. |
3693 */ | 3681 */ |
3757 xp->xp_context = EXPAND_NOTHING; | 3745 xp->xp_context = EXPAND_NOTHING; |
3758 return NULL; | 3746 return NULL; |
3759 } | 3747 } |
3760 return skipwhite(arg); | 3748 return skipwhite(arg); |
3761 | 3749 |
3762 #ifdef FEAT_CMDL_COMPL | 3750 #ifdef FEAT_SEARCH_EXTRA |
3763 # ifdef FEAT_SEARCH_EXTRA | |
3764 case CMD_match: | 3751 case CMD_match: |
3765 if (*arg == NUL || !ends_excmd(*arg)) | 3752 if (*arg == NUL || !ends_excmd(*arg)) |
3766 { | 3753 { |
3767 /* also complete "None" */ | 3754 /* also complete "None" */ |
3768 set_context_in_echohl_cmd(xp, arg); | 3755 set_context_in_echohl_cmd(xp, arg); |
3772 xp->xp_context = EXPAND_NOTHING; | 3759 xp->xp_context = EXPAND_NOTHING; |
3773 arg = skip_regexp(arg + 1, *arg, p_magic, NULL); | 3760 arg = skip_regexp(arg + 1, *arg, p_magic, NULL); |
3774 } | 3761 } |
3775 } | 3762 } |
3776 return find_nextcmd(arg); | 3763 return find_nextcmd(arg); |
3777 # endif | 3764 #endif |
3778 | 3765 |
3779 /* | 3766 /* |
3780 * All completion for the +cmdline_compl feature goes here. | 3767 * All completion for the +cmdline_compl feature goes here. |
3781 */ | 3768 */ |
3782 | 3769 |
4141 arg = xp->xp_pattern + 1; | 4128 arg = xp->xp_pattern + 1; |
4142 xp->xp_context = EXPAND_ARGLIST; | 4129 xp->xp_context = EXPAND_ARGLIST; |
4143 xp->xp_pattern = arg; | 4130 xp->xp_pattern = arg; |
4144 break; | 4131 break; |
4145 | 4132 |
4146 #endif /* FEAT_CMDL_COMPL */ | |
4147 | |
4148 default: | 4133 default: |
4149 break; | 4134 break; |
4150 } | 4135 } |
4151 return NULL; | 4136 return NULL; |
4152 } | 4137 } |
5552 return FAIL; | 5537 return FAIL; |
5553 } | 5538 } |
5554 return OK; | 5539 return OK; |
5555 } | 5540 } |
5556 | 5541 |
5557 #if defined(FEAT_CMDL_COMPL) || defined(PROTO) | |
5558 /* | 5542 /* |
5559 * Function given to ExpandGeneric() to obtain the list of command names. | 5543 * Function given to ExpandGeneric() to obtain the list of command names. |
5560 */ | 5544 */ |
5561 char_u * | 5545 char_u * |
5562 get_command_name(expand_T *xp UNUSED, int idx) | 5546 get_command_name(expand_T *xp UNUSED, int idx) |
5563 { | 5547 { |
5564 if (idx >= (int)CMD_SIZE) | 5548 if (idx >= (int)CMD_SIZE) |
5565 return get_user_command_name(idx); | 5549 return get_user_command_name(idx); |
5566 return cmdnames[idx].cmd_name; | 5550 return cmdnames[idx].cmd_name; |
5567 } | 5551 } |
5568 #endif | |
5569 | 5552 |
5570 static void | 5553 static void |
5571 ex_colorscheme(exarg_T *eap) | 5554 ex_colorscheme(exarg_T *eap) |
5572 { | 5555 { |
5573 if (*eap->arg == NUL) | 5556 if (*eap->arg == NUL) |
9176 } | 9159 } |
9177 else | 9160 else |
9178 semsg(_(e_invarg2), eap->arg); | 9161 semsg(_(e_invarg2), eap->arg); |
9179 } | 9162 } |
9180 | 9163 |
9181 #if defined(FEAT_CMDL_COMPL) || defined(PROTO) | |
9182 /* | 9164 /* |
9183 * Function given to ExpandGeneric() to obtain the possible arguments of the | 9165 * Function given to ExpandGeneric() to obtain the possible arguments of the |
9184 * ":behave {mswin,xterm}" command. | 9166 * ":behave {mswin,xterm}" command. |
9185 */ | 9167 */ |
9186 char_u * | 9168 char_u * |
9202 { | 9184 { |
9203 if (idx == 0) | 9185 if (idx == 0) |
9204 return (char_u *)"clear"; | 9186 return (char_u *)"clear"; |
9205 return NULL; | 9187 return NULL; |
9206 } | 9188 } |
9207 #endif | 9189 |
9208 | |
9209 #if defined(FEAT_CMDL_COMPL) || defined(PROTO) | |
9210 char_u * | 9190 char_u * |
9211 get_mapclear_arg(expand_T *xp UNUSED, int idx) | 9191 get_mapclear_arg(expand_T *xp UNUSED, int idx) |
9212 { | 9192 { |
9213 if (idx == 0) | 9193 if (idx == 0) |
9214 return (char_u *)"<buffer>"; | 9194 return (char_u *)"<buffer>"; |
9215 return NULL; | 9195 return NULL; |
9216 } | 9196 } |
9217 #endif | |
9218 | 9197 |
9219 static int filetype_detect = FALSE; | 9198 static int filetype_detect = FALSE; |
9220 static int filetype_plugin = FALSE; | 9199 static int filetype_plugin = FALSE; |
9221 static int filetype_indent = FALSE; | 9200 static int filetype_indent = FALSE; |
9222 | 9201 |