forked from aniani/vim
updated for version 7.2.353
Problem: No command line completion for ":profile". Solution: Complete the subcommand and file name.
This commit is contained in:
@@ -1115,6 +1115,79 @@ ex_profile(eap)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Command line expansion for :profile. */
|
||||||
|
static enum
|
||||||
|
{
|
||||||
|
PEXP_SUBCMD, /* expand :profile sub-commands */
|
||||||
|
PEXP_FUNC, /* expand :profile func {funcname} */
|
||||||
|
} pexpand_what;
|
||||||
|
|
||||||
|
static char *pexpand_cmds[] = {
|
||||||
|
"start",
|
||||||
|
#define PROFCMD_START 0
|
||||||
|
"pause",
|
||||||
|
#define PROFCMD_PAUSE 1
|
||||||
|
"continue",
|
||||||
|
#define PROFCMD_CONTINUE 2
|
||||||
|
"func",
|
||||||
|
#define PROFCMD_FUNC 3
|
||||||
|
"file",
|
||||||
|
#define PROFCMD_FILE 4
|
||||||
|
NULL
|
||||||
|
#define PROFCMD_LAST 5
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function given to ExpandGeneric() to obtain the profile command
|
||||||
|
* specific expansion.
|
||||||
|
*/
|
||||||
|
char_u *
|
||||||
|
get_profile_name(xp, idx)
|
||||||
|
expand_T *xp UNUSED;
|
||||||
|
int idx;
|
||||||
|
{
|
||||||
|
switch (pexpand_what)
|
||||||
|
{
|
||||||
|
case PEXP_SUBCMD:
|
||||||
|
return (char_u *)pexpand_cmds[idx];
|
||||||
|
/* case PEXP_FUNC: TODO */
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Handle command line completion for :profile command.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
set_context_in_profile_cmd(xp, arg)
|
||||||
|
expand_T *xp;
|
||||||
|
char_u *arg;
|
||||||
|
{
|
||||||
|
char_u *end_subcmd;
|
||||||
|
int len;
|
||||||
|
|
||||||
|
/* Default: expand subcommands. */
|
||||||
|
xp->xp_context = EXPAND_PROFILE;
|
||||||
|
pexpand_what = PEXP_SUBCMD;
|
||||||
|
xp->xp_pattern = arg;
|
||||||
|
|
||||||
|
end_subcmd = skiptowhite(arg);
|
||||||
|
if (*end_subcmd == NUL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
len = end_subcmd - arg;
|
||||||
|
if (len == 5 && STRNCMP(arg, "start", 5) == 0)
|
||||||
|
{
|
||||||
|
xp->xp_context = EXPAND_FILES;
|
||||||
|
xp->xp_pattern = skipwhite(end_subcmd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TODO: expand function names after "func" */
|
||||||
|
xp->xp_context = EXPAND_NOTHING;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dump the profiling info.
|
* Dump the profiling info.
|
||||||
*/
|
*/
|
||||||
|
@@ -3804,6 +3804,11 @@ set_one_cmd_context(xp, buff)
|
|||||||
xp->xp_context = EXPAND_NOTHING;
|
xp->xp_context = EXPAND_NOTHING;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(FEAT_PROFILE)
|
||||||
|
case CMD_profile:
|
||||||
|
set_context_in_profile_cmd(xp, arg);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* FEAT_CMDL_COMPL */
|
#endif /* FEAT_CMDL_COMPL */
|
||||||
|
|
||||||
|
@@ -4522,6 +4522,9 @@ ExpandFromContext(xp, pat, num_file, file, options)
|
|||||||
#ifdef FEAT_SIGNS
|
#ifdef FEAT_SIGNS
|
||||||
{EXPAND_SIGN, get_sign_name, TRUE},
|
{EXPAND_SIGN, get_sign_name, TRUE},
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef FEAT_PROFILE
|
||||||
|
{EXPAND_PROFILE, get_profile_name, TRUE},
|
||||||
|
#endif
|
||||||
#if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
|
#if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
|
||||||
&& (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE))
|
&& (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE))
|
||||||
{EXPAND_LANGUAGE, get_lang_arg, TRUE},
|
{EXPAND_LANGUAGE, get_lang_arg, TRUE},
|
||||||
|
@@ -24,6 +24,8 @@ void profile_sub_wait __ARGS((proftime_T *tm, proftime_T *tma));
|
|||||||
int profile_equal __ARGS((proftime_T *tm1, proftime_T *tm2));
|
int profile_equal __ARGS((proftime_T *tm1, proftime_T *tm2));
|
||||||
int profile_cmp __ARGS((proftime_T *tm1, proftime_T *tm2));
|
int profile_cmp __ARGS((proftime_T *tm1, proftime_T *tm2));
|
||||||
void ex_profile __ARGS((exarg_T *eap));
|
void ex_profile __ARGS((exarg_T *eap));
|
||||||
|
char_u *get_profile_name __ARGS((expand_T *xp, int idx));
|
||||||
|
void set_context_in_profile_cmd __ARGS((expand_T *xp, char_u *arg));
|
||||||
void profile_dump __ARGS((void));
|
void profile_dump __ARGS((void));
|
||||||
void script_prof_save __ARGS((proftime_T *tm));
|
void script_prof_save __ARGS((proftime_T *tm));
|
||||||
void script_prof_restore __ARGS((proftime_T *tm));
|
void script_prof_restore __ARGS((proftime_T *tm));
|
||||||
|
@@ -681,6 +681,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
353,
|
||||||
/**/
|
/**/
|
||||||
352,
|
352,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -718,6 +718,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
|
|||||||
#define EXPAND_SHELLCMD 32
|
#define EXPAND_SHELLCMD 32
|
||||||
#define EXPAND_CSCOPE 33
|
#define EXPAND_CSCOPE 33
|
||||||
#define EXPAND_SIGN 34
|
#define EXPAND_SIGN 34
|
||||||
|
#define EXPAND_PROFILE 35
|
||||||
|
|
||||||
/* Values for exmode_active (0 is no exmode) */
|
/* Values for exmode_active (0 is no exmode) */
|
||||||
#define EXMODE_NORMAL 1
|
#define EXMODE_NORMAL 1
|
||||||
|
Reference in New Issue
Block a user