handle "fugitive:.*" files in s:repl.includes_file

When sending code to the repl from a fugitive :Gd
or :Ge, remove the "fugitive://" prefix, and
"/.git/<rev number>/" path from the buffer name.

This allows for evaluation of code from previous
revisions of a file when inside of a fugitive :Gdiff
or :Gedit window.
This commit is contained in:
Torben Rasmussen 2013-04-22 09:06:10 -07:00
parent 4f6b8e5237
commit 34e0d0c964

View File

@ -155,6 +155,7 @@ endfunction
function! s:repl.includes_file(file) dict abort function! s:repl.includes_file(file) dict abort
let file = substitute(a:file, '\C^zipfile:\(.*\)::', '\1/', '') let file = substitute(a:file, '\C^zipfile:\(.*\)::', '\1/', '')
let file = substitute(file, '\C^fugitive:[\/][\/]\(.*\)\.git[\/][\/][^\/]\+[\/]', '\1', '')
for path in self.path() for path in self.path()
if file[0 : len(path)-1] ==? path if file[0 : len(path)-1] ==? path
return 1 return 1