Deprecate :Gread with no range or bang

In the future, :Gread will become equivalent to :Gread!, and :.Gread
will be required in order to read into a buffer without replacing it.
This commit is contained in:
Tim Pope 2010-01-09 19:12:45 -05:00
parent 6eaa4604ff
commit ecb2157d7e
2 changed files with 11 additions and 1 deletions

View File

@ -78,7 +78,7 @@ that are part of Git repositories).
:Gpedit [revision] |:pedit| a |fugitive-revision|
*fugitive-:Gread*
:[range]Gread [revision]
:{range}Gread [revision]
|:read| a |fugitive-revision|
*fugitive-:Gread!*

View File

@ -45,6 +45,13 @@ function! s:throw(string) abort
throw v:errmsg
endfunction
function! s:warn(str)
echohl WarningMsg
echomsg a:str
echohl None
let v:warningmsg = a:str
endfunction
function! s:add_methods(namespace, method_names) abort
for name in a:method_names
let s:{a:namespace}_prototype[name] = s:function('s:'.a:namespace.'_'.name)
@ -643,6 +650,9 @@ function! s:Edit(cmd,...) abort
if &previewwindow && getbufvar('','fugitive_type') ==# 'index'
wincmd p
endif
if a:cmd == 'read'
call s:warn('Use :.Gread for future compatibility')
endif
return a:cmd.' '.s:fnameescape(file)
endif
endfunction