From 07a75d523eadaf1027aa8bf287256602ad05f97f Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Mon, 14 Sep 2015 05:01:12 -0400 Subject: plugin/grappele.vim: Fix performance issue with `G` Looked into the performance issues I was having with the `G` command. After a little profiling and then messing around with let start = reltime() | | echom reltimestr(reltime(start)) Using the `reltime` method I discovered that `grappele#Grappele()` was running pretty quick (~60 time units). I then ran it around the :call grappele#Grappele(v:count) part of the mapping and found that it took about 130 time units. Then doing nnoremap G :let start = reltime() \| execute 'normal! G' | echom reltimestr(reltime(start)) was pretty quick. With that information, I decided to try a direct mapping bypassing the `` mapping just to see what that would do. Turns out the custom `G` command works much faster with this method for some reason. In terms of feel it's as fast as the normal `G` command. Replacing the `` mapping with the direct one for speed. Not really sure what the reason for this is but I'm glad the performance is up to snuff and actually usable now. I'm testing this on OS X 10.8.5 with the stock Vim (7.3 (2010 Aug 15, compiled Jun 20 2012 13:16:02)). Also noticed this issue on my Debian server which I just found out uses the same version of Vim (7.3 (2010 Aug 15, compiled May 4 2012 04:25:35)). --- plugin/grappele.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/grappele.vim b/plugin/grappele.vim index a86c02a..b21f4b7 100644 --- a/plugin/grappele.vim +++ b/plugin/grappele.vim @@ -8,7 +8,7 @@ nnoremap Grappele :call grappele#Grappele(v:count) nnoremap GrappeleRecall :call grappele#Recall() if !hasmapto('Grappele') || !maparg('G', 'n') - nmap G Grappele + nnoremap G :call grappele#Grappele(v:count) endif if !hasmapto('GrappeleRecall') || !maparg('gG', 'n') -- cgit v1.2.3