@@ -176,7 +176,7 @@ function this.cmdline_handler(keys, key_str)
176176 if util .zizzing () then return end
177177 local cmdline = vim .fn .getcmdline ()
178178 cmdline_start_cmdpos = 0
179- -- console(string.byte(key_str))
179+ -- console(string.byte(key_str), vim.g.easycomplete_cmdline_pattern )
180180 if string.byte (key_str ) == 9 then
181181 -- console("Tab 键")
182182 elseif string.byte (key_str ) == 32 then
@@ -235,8 +235,14 @@ this.REG_CMP_HANDLER = {
235235 -- 正在输入第一个命令
236236 pattern = " ^[a-zA-Z0-9_]+$" ,
237237 get_cmp_items = function ()
238- -- command 共有 670 多个,因为太重要了,这里不做过滤了,返回全部
239- return this .get_all_commands ()
238+ if vim .g .easycomplete_cmdline_pattern == " /" then
239+ local typing_word = this .get_typing_word ()
240+ local ret = vim .fn [' easycomplete#sources#buf#GetKeywords' ](typing_word )
241+ return ret
242+ elseif vim .g .easycomplete_cmdline_pattern == " :" then
243+ -- command 共有 670 多个,因为太重要了,这里不做过滤了,返回全部
244+ return this .get_all_commands ()
245+ end
240246 end
241247 },
242248 {
@@ -246,6 +252,9 @@ this.REG_CMP_HANDLER = {
246252 " ^[a-zA-Z0-9_]+%s+[glbwtvas]:%w-$" , -- 命令输入完毕,输入 x:y 变量
247253 },
248254 get_cmp_items = function ()
255+ if vim .g .easycomplete_cmdline_pattern == " /" then
256+ return {}
257+ end
249258 local cmd_name = this .get_guide_cmd ()
250259 local cmp_type = this .get_complition_type (cmd_name )
251260 local typing_word = this .get_typing_word ()
@@ -293,7 +302,11 @@ this.REG_CMP_HANDLER = {
293302 " ^[a-zA-Z0-9_]+%s+/$"
294303 },
295304 get_cmp_items = function ()
296- return this .get_path_cmp_items ()
305+ if vim .g .easycomplete_cmdline_pattern == " /" then
306+ return {}
307+ else
308+ return this .get_path_cmp_items ()
309+ end
297310 end
298311 },
299312 {
@@ -303,6 +316,9 @@ this.REG_CMP_HANDLER = {
303316 " ^[a-zA-Z0-9_]+%s+.*%\' [^\' ]-$" ,
304317 },
305318 get_cmp_items = function ()
319+ if vim .g .easycomplete_cmdline_pattern == " /" then
320+ return {}
321+ end
306322 local typing_word = this .get_typing_word ()
307323 if typing_word == " " then
308324 return {}
0 commit comments