Skip to content

Commit fb87877

Browse files
committed
Merge pull request #229 from ctrlpvim/abspath
Fix abspath
2 parents f327ea5 + 4b89f1c commit fb87877

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

autoload/ctrlp.vim

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1915,8 +1915,20 @@ fu! s:bufwins(bufnr)
19151915
retu winns
19161916
endf
19171917

1918+
fu! s:isabs(path)
1919+
if (has('win32') || has('win64'))
1920+
return a:path =~ '^\([a-zA-Z]:\)\{-}[/\\]'
1921+
el
1922+
return a:path =~ '^[/\\]'
1923+
en
1924+
endf
1925+
19181926
fu! s:bufnrfilpath(line)
1919-
let filpath = fnamemodify(a:line, ':p')
1927+
if s:isabs(a:line)
1928+
let filpath = fnamemodify(a:line, ':p')
1929+
el
1930+
let filpath = fnamemodify(s:dyncwd.(&shellslash ? '/' : '\').a:line, ':p')
1931+
en
19201932
let bufnr = bufnr('^'.filpath.'$')
19211933
if (a:line =~ '[\/]\?\[\d\+\*No Name\]$' && !filereadable(filpath) && bufnr < 1)
19221934
let bufnr = str2nr(matchstr(a:line, '[\/]\?\[\zs\d\+\ze\*No Name\]$'))

0 commit comments

Comments
 (0)