From 61b3046661f8bb14f12b2a45650bb23b1d68f09a Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 20 Dec 2017 01:05:21 +0100 Subject: autoload/grappele.vim: Only try to recall if a location was saved Previously, if `gG` (the recall mapping) was pressed before previously having pressed a `G` command, the following error would appear: Error detected while processing function grappele#Recall: line 1: E121: Undefined variable: s:line E116: Invalid arguments for function grappele#Grappele This happened because no previous `G` location had been saved. Displaying an error here makes for a bad user experience. Instead if this happens, we should just do nothing. To prevent the error, check for the existence of the `s:line` variable before trying to use it. --- autoload/grappele.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'autoload') diff --git a/autoload/grappele.vim b/autoload/grappele.vim index c699f0d..9139116 100644 --- a/autoload/grappele.vim +++ b/autoload/grappele.vim @@ -21,5 +21,7 @@ function! grappele#Grappele(line) endfunction function! grappele#Recall() - call grappele#Grappele(s:line) + if exists('s:line') + call grappele#Grappele(s:line) + endif endfunction -- cgit v1.2.3