1
0
mirror of https://github.com/gryf/snipmate.vim.git synced 2025-12-29 09:52:36 +01:00

replaced regexes in ExtractSnips() and s:ProcessFile() with a simple fnamemodify()

This commit is contained in:
Michael Sanders
2009-03-22 20:41:12 -04:00
parent bf7cfb1d1f
commit 7e543f8f34

View File

@@ -58,12 +58,12 @@ fun! ExtractSnips(dir, ft)
let slash = !&ssl && (has('win16') || has('win32') || has('win64')) ? '\\' : '/' let slash = !&ssl && (has('win16') || has('win32') || has('win64')) ? '\\' : '/'
for path in split(globpath(a:dir, '*'), "\n") for path in split(globpath(a:dir, '*'), "\n")
if isdirectory(path) if isdirectory(path)
let pathname = fnamemodify(path, ':t')
for snipFile in split(globpath(path, '*.snippet'), "\n") for snipFile in split(globpath(path, '*.snippet'), "\n")
call s:ProcessFile(snipFile, a:ft, slash, call s:ProcessFile(snipFile, a:ft, pathname)
\ strpart(path, strridx(path, slash) + 1))
endfor endfor
else elseif fnamemodify(path, ':e') == 'snippet'
call s:ProcessFile(path, a:ft, slash) call s:ProcessFile(path, a:ft)
endif endif
endfor endfor
let g:did_ft_{a:ft} = 1 let g:did_ft_{a:ft} = 1
@@ -71,8 +71,8 @@ endf
" Processes a snippet file; optionally add the name of the parent directory " Processes a snippet file; optionally add the name of the parent directory
" for a snippet with multiple matches. " for a snippet with multiple matches.
fun s:ProcessFile(file, ft, slash, ...) fun s:ProcessFile(file, ft, ...)
let keyword = matchstr(a:file, '.*'.a:slash.'\zs.*\ze\.snippet') let keyword = fnamemodify(a:file, ':t:r')
if keyword == '' | return | endif if keyword == '' | return | endif
try try
let text = join(readfile(a:file), "\n") let text = join(readfile(a:file), "\n")