From ecb2157d7ed9526157b05b9fe19019f6c1b00b30 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sat, 9 Jan 2010 19:12:45 -0500 Subject: [PATCH] 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. --- doc/fugitive.txt | 2 +- plugin/fugitive.vim | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/doc/fugitive.txt b/doc/fugitive.txt index 8015877..e6b5e2f 100644 --- a/doc/fugitive.txt +++ b/doc/fugitive.txt @@ -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!* diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 2f703cb..05402e0 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -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