From a0815c701050a90f9936b81f94e7b385d1f2939d Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Tue, 25 Jun 2019 04:32:59 -0400 Subject: [PATCH] Retire :Gedit -..., :Gedit @{...}, and :Gedit :n I'm introducing :Gedit >... as a new shorthand because a leading > is handled by fnameescape(), but it's very ugly, I don't think I want to make it official. --- autoload/fugitive.vim | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 21d0b13..bb6a9c0 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -858,13 +858,15 @@ endfunction function! s:Expand(rev) abort if a:rev =~# '^:[0-3]$' - let file = a:rev . s:Relative(':') - elseif a:rev =~# '^-' - let file = 'HEAD^{}' . a:rev[1:-1] . s:Relative(':') - elseif a:rev =~# '^@{' - let file = 'HEAD' . a:rev. s:Relative(':') - elseif a:rev =~# '^\^[0-9~^{]\|^\~[0-9~^]\|^\^$' + call s:throw('Use ' . string(a:rev . ':%') . ' instead of ' . string(a:rev)) + elseif a:rev =~# '^@{' || a:rev =~# '^\^[0-9~^{]\|^\~[0-9~^]\|^\^$' call s:throw('Use ' . string('!' . a:rev . ':%') . ' instead of ' . string(a:rev)) + elseif a:rev =~# '^-' + call s:throw('Use ' . string('!' . a:rev[1:-1] . ':%') . ' instead of ' . string(a:rev)) + elseif a:rev =~# '^>[~^]\|^>@{\|^>:\d$' + let file = 'HEAD' . a:rev[1:-1] . s:Relative(':') + elseif a:rev =~# '^>[^> ]' + let file = a:rev[1:-1] . s:Relative(':') else let file = a:rev endif