summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-06-08 15:24:48 +0200
committerBram Moolenaar <Bram@vim.org>2013-06-08 15:24:48 +0200
commitcd9c46265e4a12cf716187bc8188c7399797f806 (patch)
tree0cc2bad99620cf39396dcb929d51225745588267
parent87f764a891ff717cd84f361afa5e2220820431e3 (diff)
downloadvim-git-cd9c46265e4a12cf716187bc8188c7399797f806.tar.gz
updated for version 7.3.1148v7.3.1148
Problem: No command line completion for ":syntime". Solution: Implement the completion. (Dominique Pelle)
-rw-r--r--runtime/doc/map.txt1
-rw-r--r--src/ex_cmds.h2
-rw-r--r--src/ex_docmd.c9
-rw-r--r--src/ex_getln.c3
-rw-r--r--src/proto/syntax.pro1
-rw-r--r--src/syntax.c23
-rw-r--r--src/version.c2
-rw-r--r--src/vim.h1
8 files changed, 41 insertions, 1 deletions
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index 039b77b36..0ae0cf3e5 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -1242,6 +1242,7 @@ completion can be enabled:
-complete=shellcmd Shell command
-complete=sign |:sign| suboptions
-complete=syntax syntax file names |'syntax'|
+ -complete=syntime |:syntime| suboptions
-complete=tag tags
-complete=tag_listfiles tags, file names are shown when CTRL-D is hit
-complete=user user names
diff --git a/src/ex_cmds.h b/src/ex_cmds.h
index 19740884b..86bcead76 100644
--- a/src/ex_cmds.h
+++ b/src/ex_cmds.h
@@ -926,7 +926,7 @@ EX(CMD_swapname, "swapname", ex_swapname,
EX(CMD_syntax, "syntax", ex_syntax,
EXTRA|NOTRLCOM|CMDWIN),
EX(CMD_syntime, "syntime", ex_syntime,
- WORD1|TRLBAR|CMDWIN),
+ NEEDARG|WORD1|TRLBAR|CMDWIN),
EX(CMD_syncbind, "syncbind", ex_syncbind,
TRLBAR),
EX(CMD_t, "t", ex_copymove,
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 6b616ca8a..a8b0fb320 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3994,6 +3994,12 @@ set_one_cmd_context(xp, buff)
xp->xp_pattern = arg;
break;
#endif
+#if defined(FEAT_PROFILE)
+ case CMD_syntime:
+ xp->xp_context = EXPAND_SYNTIME;
+ xp->xp_pattern = arg;
+ break;
+#endif
#endif /* FEAT_CMDL_COMPL */
@@ -5436,6 +5442,9 @@ static struct
{EXPAND_MAPPINGS, "mapping"},
{EXPAND_MENUS, "menu"},
{EXPAND_OWNSYNTAX, "syntax"},
+#if defined(FEAT_PROFILE)
+ {EXPAND_SYNTIME, "syntime"},
+#endif
{EXPAND_SETTINGS, "option"},
{EXPAND_SHELLCMD, "shellcmd"},
#if defined(FEAT_SIGNS)
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 9fdb37712..6fe91488c 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -4674,6 +4674,9 @@ ExpandFromContext(xp, pat, num_file, file, options)
#ifdef FEAT_SYN_HL
{EXPAND_SYNTAX, get_syntax_name, TRUE, TRUE},
#endif
+#ifdef FEAT_PROFILE
+ {EXPAND_SYNTIME, get_syntime_arg, TRUE, TRUE},
+#endif
{EXPAND_HIGHLIGHT, get_highlight_name, TRUE, TRUE},
#ifdef FEAT_AUTOCMD
{EXPAND_EVENTS, get_event_name, TRUE, TRUE},
diff --git a/src/proto/syntax.pro b/src/proto/syntax.pro
index 2f57051ca..af81ac68e 100644
--- a/src/proto/syntax.pro
+++ b/src/proto/syntax.pro
@@ -20,6 +20,7 @@ int syn_get_sub_char __ARGS((void));
int syn_get_stack_item __ARGS((int i));
int syn_get_foldlevel __ARGS((win_T *wp, long lnum));
void ex_syntime __ARGS((exarg_T *eap));
+char_u *get_syntime_arg __ARGS((expand_T *xp, int idx));
void init_highlight __ARGS((int both, int reset));
int load_colors __ARGS((char_u *name));
void do_highlight __ARGS((char_u *line, int forceit, int init));
diff --git a/src/syntax.c b/src/syntax.c
index f2df13a3f..323889ef8 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -6577,6 +6577,27 @@ syntime_clear()
}
}
+#if defined(FEAT_CMDL_COMPL) || defined(PROTO)
+/*
+ * Function given to ExpandGeneric() to obtain the possible arguments of the
+ * ":syntime {on,off,clear,report}" command.
+ */
+ char_u *
+get_syntime_arg(xp, idx)
+ expand_T *xp UNUSED;
+ int idx;
+{
+ switch (idx)
+ {
+ case 0: return (char_u *)"on";
+ case 1: return (char_u *)"off";
+ case 2: return (char_u *)"clear";
+ case 3: return (char_u *)"report";
+ }
+ return NULL;
+}
+#endif
+
typedef struct
{
proftime_T total;
@@ -6610,7 +6631,9 @@ syntime_report()
{
int idx;
synpat_T *spp;
+# ifdef FEAT_FLOAT
proftime_T tm;
+# endif
int len;
proftime_T total_total;
int total_count = 0;
diff --git a/src/version.c b/src/version.c
index f83750188..5ed917064 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1148,
+/**/
1147,
/**/
1146,
diff --git a/src/vim.h b/src/vim.h
index 5fb0481d5..3f01ab737 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -783,6 +783,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
#define EXPAND_LOCALES 40
#define EXPAND_HISTORY 41
#define EXPAND_USER 42
+#define EXPAND_SYNTIME 43
/* Values for exmode_active (0 is no exmode) */
#define EXMODE_NORMAL 1