mirror of
https://github.com/gryf/snipmate.vim.git
synced 2026-01-30 12:16:06 +01:00
fixed a bug with file-based snippets
This commit is contained in:
@@ -61,9 +61,9 @@ endf
|
|||||||
|
|
||||||
fun! ExtractSnips(dir, ft)
|
fun! ExtractSnips(dir, ft)
|
||||||
let s:slash = has('win16') || has('win32') || has('win64') ? '\\' : '/'
|
let s:slash = 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)
|
||||||
for snipFile in split(globpath(path, '*.snippet'), '\n')
|
for snipFile in split(globpath(path, '*.snippet'), "\n")
|
||||||
call s:ProcessFile(snipFile, a:ft,
|
call s:ProcessFile(snipFile, a:ft,
|
||||||
\ strpart(path, strridx(path, s:slash)+1))
|
\ strpart(path, strridx(path, s:slash)+1))
|
||||||
endfor
|
endfor
|
||||||
@@ -81,7 +81,7 @@ fun s:ProcessFile(file, ft, ...)
|
|||||||
let keyword = matchstr(a:file, '.*'.s:slash.'\zs.*\ze\.snippet')
|
let keyword = matchstr(a:file, '.*'.s:slash.'\zs.*\ze\.snippet')
|
||||||
if keyword == '' | return | endif
|
if keyword == '' | return | endif
|
||||||
try
|
try
|
||||||
let text = join(readfile(a:file), '\n')
|
let text = join(readfile(a:file), "\n")
|
||||||
catch /E484/
|
catch /E484/
|
||||||
echom "Error in snipMate.vim: couldn't read file: ".a:file
|
echom "Error in snipMate.vim: couldn't read file: ".a:file
|
||||||
endtry
|
endtry
|
||||||
|
|||||||
Reference in New Issue
Block a user