diff options
author | Teddy Wing | 2017-12-20 01:05:21 +0100 |
---|---|---|
committer | Teddy Wing | 2017-12-20 01:05:21 +0100 |
commit | 61b3046661f8bb14f12b2a45650bb23b1d68f09a (patch) | |
tree | f5ff62e4ae36917613592ff28139ba2093be7816 /autoload | |
parent | 2393e6afb8039cbf2db3c3d15fbfb8343778f537 (diff) | |
download | vim-grappele-61b3046661f8bb14f12b2a45650bb23b1d68f09a.tar.bz2 |
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.
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/grappele.vim | 4 |
1 files changed, 3 insertions, 1 deletions
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 |