1+ let s: util_toolkit = has (' nvim' ) ? v: lua .require (" easycomplete.util" ) : v: null
12
23function ! easycomplete#sources#path#completor (opt , ctx)
34 let l: typing_path = s: TypingAPath (a: ctx )
@@ -141,6 +142,21 @@ function! easycomplete#sources#path#TypingAPath(...)
141142 return call (function (' s:TypingAPath' ), a: 000 )
142143endfunction
143144
145+ function ! s: GetFullPath (prefx)
146+ if g: env_is_nvim
147+ let fpath = s: util_toolkit .get_fullpath (a: prefx )
148+ else
149+ try
150+ let fpath = matchstr (a: prefx ," \\ ([\\ (\\ ) \" '\\ t\\ [\\ ]\\ {\\ }]\\ )\\ @<=" .
151+ \ " \\ ([\\ /\\ .\\ ~]\\ +[\\ .\\ /a-zA-Z0-9\u2e80 -\uef4f \\ _\\ - ]\\ +\\ |[\\ .\\ /]\\ )" )
152+ catch /^Vim\%((\a\+)\)\=:E945/
153+ let fpath = matchstr (a: prefx ," \\ ([\\ (\\ ) \" '\\ t\\ [\\ ]\\ {\\ }]\\ )\\ @<=" .
154+ \ " \\ ([\\ /\\ .\\ ~]\\ +[\\ .\\ /a-zA-Z0-9\\ _\\ - ]\\ +\\ |[\\ .\\ /]\\ )" )
155+ endtry
156+ endif
157+ return fpath
158+ endfunction
159+
144160" 判断当前是否正在输入一个地址path
145161" base 原本想传入当前文件名字,实际上传不进来,这里也没用到
146162" s:TypingAPath(ctx) 参数是ctx时,在当前脚本中调用
@@ -166,14 +182,7 @@ function! s:TypingAPath(...)
166182 " \<Tab> => done
167183 " xxxss \ xxxss<Tab> => done
168184 " MoreInfo: #140
169- try
170- let fpath = matchstr (prefx," \\ ([\\ (\\ ) \" '\\ t\\ [\\ ]\\ {\\ }]\\ )\\ @<=" .
171- \ " \\ ([\\ /\\ .\\ ~]\\ +[\\ .\\ /a-zA-Z0-9\u2e80 -\uef4f \\ _\\ - ]\\ +\\ |[\\ .\\ /]\\ )" )
172- catch /^Vim\%((\a\+)\)\=:E945/
173- let fpath = matchstr (prefx," \\ ([\\ (\\ ) \" '\\ t\\ [\\ ]\\ {\\ }]\\ )\\ @<=" .
174- \ " \\ ([\\ /\\ .\\ ~]\\ +[\\ .\\ /a-zA-Z0-9\\ _\\ - ]\\ +\\ |[\\ .\\ /]\\ )" )
175- endtry
176-
185+ let fpath = s: GetFullPath (prefx)
177186 " 兼容单个 '/' 匹配的情况
178187 let spath = s: GetPathName (substitute (fpath," ^[\\ .\\ /].*\\ /" ," ./" ," g" ))
179188 " 清除对 '\' 的路径识别
0 commit comments