File plugin/inccomplete.vim changed (mode: 100644) (index d83edf0..d55ec91) |
... |
... |
function! s:ICInit() |
41 |
41 |
endif |
endif |
42 |
42 |
|
|
43 |
43 |
" save current 'omnifunc' |
" save current 'omnifunc' |
44 |
|
let l:curbuf = fnamemodify(bufname('%'), ':p') |
|
|
44 |
|
let l:curbuf = expand('%:p') |
45 |
45 |
if !exists('s:oldomnifuncs') |
if !exists('s:oldomnifuncs') |
46 |
46 |
let s:oldomnifuncs = {} |
let s:oldomnifuncs = {} |
47 |
47 |
endif |
endif |
|
... |
... |
endfunction |
79 |
79 |
|
|
80 |
80 |
" this is the 'omnifunc' |
" this is the 'omnifunc' |
81 |
81 |
function! ICComplete(findstart, base) |
function! ICComplete(findstart, base) |
82 |
|
let l:curbuf = fnamemodify(bufname('%'), ':p') |
|
|
82 |
|
let l:curbuf = expand('%:p') |
83 |
83 |
if a:findstart |
if a:findstart |
84 |
84 |
" did user request #include completion? |
" did user request #include completion? |
85 |
85 |
let s:passnext = getline('.') !~ '^\s*#\s*include\s*\%(<\|"\)' |
let s:passnext = getline('.') !~ '^\s*#\s*include\s*\%(<\|"\)' |
|
... |
... |
function! s:ICFilterIncLst(user, inclst, base) |
216 |
216 |
return l:inclst |
return l:inclst |
217 |
217 |
endfunction |
endfunction |
218 |
218 |
|
|
219 |
|
" returns list of three elements: [name_pos, slash_for_regexps, ordinary_slash] |
|
220 |
|
function! s:ICParsePath(path) |
|
221 |
|
let l:iswindows = has('win16') || has('win32') || has('win64') || |
|
222 |
|
\ has('win95') || has('win32unix') |
|
223 |
|
|
|
224 |
|
" determine type of slash |
|
225 |
|
let l:path = a:path |
|
226 |
|
let l:pos = strridx(a:path, '/') |
|
227 |
|
let l:sl1 = '/' |
|
228 |
|
let l:sl2 = '/' |
|
229 |
|
if l:iswindows && (empty(a:path) || l:pos < 0) |
|
230 |
|
let l:pos = strridx(a:path, '\') |
|
231 |
|
let l:sl1 = '\\\\' |
|
232 |
|
let l:sl2 = '\' |
|
233 |
|
endif |
|
234 |
|
return [l:pos, l:sl1, l:sl2] |
|
235 |
|
endfunction |
|
236 |
|
|
|
237 |
219 |
" searches for files that can be included in path |
" searches for files that can be included in path |
238 |
220 |
" a:user determines search area, when it's not zero look only in '.', otherwise |
" a:user determines search area, when it's not zero look only in '.', otherwise |
239 |
221 |
" everywhere in path except '.' |
" everywhere in path except '.' |
|
... |
... |
function! s:ICFindIncludes(user, pathlst) |
273 |
255 |
if empty(a:pathlst) |
if empty(a:pathlst) |
274 |
256 |
return [] |
return [] |
275 |
257 |
endif |
endif |
276 |
|
if a:user == 0 |
|
|
258 |
|
if !a:user |
277 |
259 |
if empty(g:inccomplete_findcmd) |
if empty(g:inccomplete_findcmd) |
278 |
260 |
let l:regex = '.*[/\\][-_a-z0-9]\+\(\.hpp\|\.h\)\?$' |
let l:regex = '.*[/\\][-_a-z0-9]\+\(\.hpp\|\.h\)\?$' |
279 |
261 |
else |
else |
|
... |
... |
endfunction |
354 |
336 |
|
|
355 |
337 |
" searches for existing subdirectories |
" searches for existing subdirectories |
356 |
338 |
function! s:ICGetSubDirs(pathlst, base) |
function! s:ICGetSubDirs(pathlst, base) |
357 |
|
" determine type of slash |
|
358 |
|
let l:pos = strridx(a:base, '/') |
|
359 |
|
let l:sl = '/' |
|
360 |
|
if l:pos < 0 |
|
361 |
|
let l:pos = strridx(a:base, '\') |
|
362 |
|
let l:sl = '\\\\' |
|
363 |
|
endif |
|
|
339 |
|
let [l:pos, l:sl, l:sl2] = s:ICParsePath(a:base) |
364 |
340 |
if l:pos < 0 |
if l:pos < 0 |
365 |
341 |
return [] |
return [] |
366 |
342 |
endif |
endif |
|
... |
... |
function! s:ICGetSubDirs(pathlst, base) |
380 |
356 |
return l:subdirs |
return l:subdirs |
381 |
357 |
endfunction |
endfunction |
382 |
358 |
|
|
|
359 |
|
" returns list of three elements: [name_pos, slash_for_regexps, ordinary_slash] |
|
360 |
|
function! s:ICParsePath(path) |
|
361 |
|
let l:iswindows = has('win16') || has('win32') || has('win64') || |
|
362 |
|
\ has('win95') || has('win32unix') |
|
363 |
|
|
|
364 |
|
" determine type of slash |
|
365 |
|
let l:path = a:path |
|
366 |
|
let l:pos = strridx(a:path, '/') |
|
367 |
|
let l:sl1 = '/' |
|
368 |
|
let l:sl2 = '/' |
|
369 |
|
if l:iswindows && (empty(a:path) || l:pos < 0) |
|
370 |
|
let l:pos = strridx(a:path, '\') |
|
371 |
|
let l:sl1 = '\\\\' |
|
372 |
|
let l:sl2 = '\' |
|
373 |
|
endif |
|
374 |
|
return [l:pos, l:sl1, l:sl2] |
|
375 |
|
endfunction |
|
376 |
|
|
383 |
377 |
" adds one list to another without duplicating items |
" adds one list to another without duplicating items |
384 |
378 |
function! s:ICAddNoDups(lista, listb) |
function! s:ICAddNoDups(lista, listb) |
385 |
379 |
let l:result = [] |
let l:result = [] |