mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-06 10:44:24 +08:00
Add new option g:emmet_docroot to specify map of document root.
let emmet_docroot = {
\ 'c:/dev/vim-jp.github.com/': 'http://vim-jp.org/',
\ 'c:/dev/mattn/': 'http://mattn.kaoriya.net/',
\}
When getting image size of '/path/to/file.jpg' and current html file is
'c:/dev/mattn/foo/bar/index.html', the image file will be treated as:
http://mattn.kaoriya.net/path/to/file.jpg
This commit is contained in:
@@ -206,6 +206,23 @@ function! emmet#util#getImageSize(fn)
|
|||||||
if filereadable(fn)
|
if filereadable(fn)
|
||||||
let hex = substitute(system('xxd -p "'.fn.'"'), '\n', '', 'g')
|
let hex = substitute(system('xxd -p "'.fn.'"'), '\n', '', 'g')
|
||||||
else
|
else
|
||||||
|
if fn !~ '^\w\+://'
|
||||||
|
let path = fnamemodify(expand('%'), ':p:gs?\\?/?')
|
||||||
|
if has('win32') || has('win64') |
|
||||||
|
let path = tolower(path)
|
||||||
|
endif
|
||||||
|
for k in keys(g:emmet_docroot)
|
||||||
|
let root = fnamemodify(k, ':p:gs?\\?/?')
|
||||||
|
if has('win32') || has('win64') |
|
||||||
|
let root = tolower(root)
|
||||||
|
endif
|
||||||
|
if stridx(path, root) == 0
|
||||||
|
let v = g:emmet_docroot[k]
|
||||||
|
let fn = (len(v) == 0 ? k : v) . fn
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
let hex = substitute(system(g:emmet_curl_command.' "'.fn.'" | xxd -p'), '\n', '', 'g')
|
let hex = substitute(system(g:emmet_curl_command.' "'.fn.'" | xxd -p'), '\n', '', 'g')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -78,6 +78,10 @@ if !exists('g:emmet_html5')
|
|||||||
let g:emmet_html5 = 1
|
let g:emmet_html5 = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if !exists('g:emmet_docroot')
|
||||||
|
let g:emmet_docroot = {}
|
||||||
|
endif
|
||||||
|
|
||||||
if !exists('g:emmet_debug')
|
if !exists('g:emmet_debug')
|
||||||
let g:emmet_debug = 0
|
let g:emmet_debug = 0
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user