1 To: vim_dev@googlegroups.com
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: No completion for :history command.
12 Solution: Add the completion and update the docs. Also fix ":behave"
13 completion. (Dominique Pelle)
14 Files: runtime/doc/cmdline.txt, runtime/doc/map.txt, src/ex_docmd.c,
15 src/ex_getln.c, src/vim.h
18 *** ../vim-7.3.513/runtime/doc/cmdline.txt 2010-08-15 21:57:17.000000000 +0200
19 --- runtime/doc/cmdline.txt 2012-04-30 18:30:00.000000000 +0200
23 :his[tory] [{name}] [{first}][, [{last}]]
24 List the contents of history {name} which can be:
25 ! c[md] or : command-line history
26 ! s[earch] or / search string history
27 ! e[xpr] or = expression register history
28 ! i[nput] or @ input line history
29 ! d[ebug] or > debug command history
30 ! a[ll] all of the above
33 If the numbers {first} and/or {last} are given, the respective
36 :his[tory] [{name}] [{first}][, [{last}]]
37 List the contents of history {name} which can be:
38 ! c[md] or : command-line history
39 ! s[earch] or / or ? search string history
40 ! e[xpr] or = expression register history
41 ! i[nput] or @ input line history
42 ! d[ebug] or > debug command history
43 ! a[ll] all of the above
46 If the numbers {first} and/or {last} are given, the respective
47 *** ../vim-7.3.513/runtime/doc/map.txt 2011-07-20 16:36:35.000000000 +0200
48 --- runtime/doc/map.txt 2012-04-30 18:30:00.000000000 +0200
53 -complete=augroup autocmd groups
54 -complete=buffer buffer names
55 + -complete=behave :behave suboptions
56 -complete=color color schemes
57 -complete=command Ex command (and arguments)
58 -complete=compiler compilers
62 -complete=function function name
63 -complete=help help subjects
64 -complete=highlight highlight groups
65 + -complete=history :history suboptions
66 -complete=locale locale names (as output of locale -a)
67 -complete=mapping mapping name
69 *** ../vim-7.3.513/src/ex_docmd.c 2012-02-12 20:13:55.000000000 +0100
70 --- src/ex_docmd.c 2012-04-30 18:33:27.000000000 +0200
76 xp->xp_context = EXPAND_BEHAVE;
77 + xp->xp_pattern = arg;
80 + #if defined(FEAT_CMDHIST)
82 + xp->xp_context = EXPAND_HISTORY;
83 + xp->xp_pattern = arg;
87 #endif /* FEAT_CMDL_COMPL */
93 } command_complete[] =
95 {EXPAND_AUGROUP, "augroup"},
96 + {EXPAND_BEHAVE, "behave"},
97 {EXPAND_BUFFERS, "buffer"},
98 {EXPAND_COLORS, "color"},
99 {EXPAND_COMMANDS, "command"},
102 {EXPAND_FUNCTIONS, "function"},
103 {EXPAND_HELP, "help"},
104 {EXPAND_HIGHLIGHT, "highlight"},
105 #if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
106 ! && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE))
107 {EXPAND_LOCALES, "locale"},
109 {EXPAND_MAPPINGS, "mapping"},
111 {EXPAND_FUNCTIONS, "function"},
112 {EXPAND_HELP, "help"},
113 {EXPAND_HIGHLIGHT, "highlight"},
114 + #if defined(FEAT_CMDHIST)
115 + {EXPAND_HISTORY, "history"},
117 #if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
118 ! && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE))
119 {EXPAND_LOCALES, "locale"},
121 {EXPAND_MAPPINGS, "mapping"},
122 *** ../vim-7.3.513/src/ex_getln.c 2012-03-07 19:16:49.000000000 +0100
123 --- src/ex_getln.c 2012-04-30 18:36:04.000000000 +0200
126 int cmdlen; /* number of chars in command line */
127 int cmdpos; /* current cursor position */
128 int cmdspos; /* cursor column on screen */
129 ! int cmdfirstc; /* ':', '/', '?', '=' or NUL */
130 int cmdindent; /* number of spaces before cmdline */
131 char_u *cmdprompt; /* message in front of cmdline */
132 int cmdattr; /* attributes for prompt */
134 int cmdlen; /* number of chars in command line */
135 int cmdpos; /* current cursor position */
136 int cmdspos; /* cursor column on screen */
137 ! int cmdfirstc; /* ':', '/', '?', '=', '>' or NUL */
138 int cmdindent; /* number of spaces before cmdline */
139 char_u *cmdprompt; /* message in front of cmdline */
140 int cmdattr; /* attributes for prompt */
144 #ifdef FEAT_CMDL_COMPL
145 static int expand_shellcmd __ARGS((char_u *filepat, int *num_file, char_u ***file, int flagsarg));
146 static int ExpandRTDir __ARGS((char_u *pat, int *num_file, char_u ***file, char *dirname[]));
147 + # ifdef FEAT_CMDHIST
148 + static char_u *get_history_arg __ARGS((expand_T *xp, int idx));
150 # if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL)
151 static int ExpandUserDefined __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file));
152 static int ExpandUserList __ARGS((expand_T *xp, int *num_file, char_u ***file));
157 {EXPAND_COMMANDS, get_command_name, FALSE, TRUE},
158 {EXPAND_BEHAVE, get_behave_arg, TRUE, TRUE},
159 + #ifdef FEAT_CMDHIST
160 + {EXPAND_HISTORY, get_history_arg, TRUE, TRUE},
163 {EXPAND_USER_COMMANDS, get_user_commands, FALSE, TRUE},
164 {EXPAND_USER_CMD_FLAGS, get_user_cmd_flags, FALSE, TRUE},
171 + #if defined(FEAT_CMDL_COMPL) || defined(PROTO)
173 + * Function given to ExpandGeneric() to obtain the possible first
174 + * arguments of the ":history command.
177 + get_history_arg(xp, idx)
178 + expand_T *xp UNUSED;
181 + static char_u compl[2] = { NUL, NUL };
182 + char *short_names = ":=@>?/";
183 + int short_names_count = STRLEN(short_names);
184 + int history_name_count = sizeof(history_names) / sizeof(char *) - 1;
186 + if (idx < short_names_count)
188 + compl[0] = (char_u)short_names[idx];
191 + if (idx < short_names_count + history_name_count)
192 + return (char_u *)history_names[idx - short_names_count];
193 + if (idx == short_names_count + history_name_count)
194 + return (char_u *)"all";
200 * init_history() - Initialize the command line history.
201 * Also used to re-allocate the history when the size changes.
202 *** ../vim-7.3.513/src/vim.h 2012-03-23 16:25:13.000000000 +0100
203 --- src/vim.h 2012-04-30 18:30:00.000000000 +0200
207 #define EXPAND_FILES_IN_PATH 38
208 #define EXPAND_OWNSYNTAX 39
209 #define EXPAND_LOCALES 40
210 + #define EXPAND_HISTORY 41
212 /* Values for exmode_active (0 is no exmode) */
213 #define EXMODE_NORMAL 1
214 *** ../vim-7.3.513/src/version.c 2012-04-30 18:18:43.000000000 +0200
215 --- src/version.c 2012-04-30 18:36:19.000000000 +0200
219 { /* Add new patch number below this line */
225 You can be stopped by the police for biking over 65 miles per hour.
226 You are not allowed to walk across a street on your hands.
227 [real standing laws in Connecticut, United States of America]
229 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
230 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
231 \\\ an exciting new programming language -- http://www.Zimbu.org ///
232 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///