mirror of
https://github.com/amix/vimrc
synced 2025-06-16 17:45:00 +08:00
plugins update
This commit is contained in:
@ -209,13 +209,18 @@ endfunction
|
||||
" Relative paths cannot be properly converted to a URI; when path is a
|
||||
" relative path, the file scheme will not be prepended.
|
||||
function! go#path#ToURI(path)
|
||||
let l:absolute = !go#util#IsWin() && a:path[0] is# '/'
|
||||
let l:prefix = ''
|
||||
let l:path = a:path
|
||||
if l:path[1:2] is# ':\'
|
||||
let l:path = '/' . l:path[0:1] . l:path[3:]
|
||||
|
||||
if go#util#IsWin() && l:path[1:2] is# ':\'
|
||||
let l:absolute = 1
|
||||
let l:prefix = '/' . l:path[0:1]
|
||||
let l:path = l:path[2:]
|
||||
endif
|
||||
|
||||
return substitute(
|
||||
\ (l:path[0] is# '/' ? 'file://' : '') . go#uri#EncodePath(l:path),
|
||||
\ (l:absolute ? 'file://' : '') . l:prefix . go#uri#EncodePath(l:path),
|
||||
\ '\\',
|
||||
\ '/',
|
||||
\ 'g',
|
||||
@ -229,7 +234,7 @@ function! go#path#FromURI(uri) abort
|
||||
let l:path = go#uri#Decode(l:encoded_path)
|
||||
|
||||
" If the path is like /C:/foo/bar, it should be C:\foo\bar instead.
|
||||
if l:path =~# '^/[a-zA-Z]:'
|
||||
if go#util#IsWin() && l:path =~# '^/[a-zA-Z]:'
|
||||
let l:path = substitute(l:path[1:], '/', '\\', 'g')
|
||||
endif
|
||||
|
||||
|
Reference in New Issue
Block a user