hgrev/plugin/hgrev.vim
branchvim-stuff
changeset 25 efe9199dbd41
parent 15 285603587539
child 27 595320486f69
equal deleted inserted replaced
24:38db5185d698 25:efe9199dbd41
    68 	endif
    68 	endif
    69 
    69 
    70 	" Find the closest HG root for the buffer. 'hg root' won't do it, since
    70 	" Find the closest HG root for the buffer. 'hg root' won't do it, since
    71 	" it works off the cwd, and we need the nearest root from the filename.
    71 	" it works off the cwd, and we need the nearest root from the filename.
    72 	"
    72 	"
       
    73 
       
    74 	if matchstr(bufname('%'), "^[^:/]\\+://") != ''
       
    75 		" not on this buffer...
       
    76 		" (we're unlikely to get lucky finding '.hg' in http:// or similar)
       
    77 		return
       
    78 	endif
       
    79 
    73 	let l:searchpaths = split( expand('%:p:h'), '/' )
    80 	let l:searchpaths = split( expand('%:p:h'), '/' )
    74 	let l:dircount = len(l:searchpaths)
    81 	let l:dircount = len(l:searchpaths)
    75 	let l:root = ''
    82 	let l:root = ''
    76 	while l:dircount > 0
    83 	while l:dircount > 0
    77 		let l:root = '/' . join( l:searchpaths[0 : l:dircount], '/' )
    84 		let l:root = '/' . join( l:searchpaths[0 : l:dircount], '/' )