From ffa7c57008a7ff501de0bd61d1c8e4b9ad23e28f Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Mon, 23 Nov 2015 23:39:17 -0500 Subject: Fix normal mode `G` mapping Pressing `G` would bring the cursor to the first line in the buffer instead of the last line in the buffer because the count in the mapping was always `v:count1`. This meant that the `G` mapping behaved like `1G` when no count was specified. This change fixes the `G` mapping to use `v:count` so that it goes to the last line in the buffer as expected. We also add support for arbitrary mappings to choose whether they want to be `v:count` or `v:count1` depending on what value is specified in the mapping dict. --- autoload/auditory.vim | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/autoload/auditory.vim b/autoload/auditory.vim index d618451..bae93e5 100644 --- a/autoload/auditory.vim +++ b/autoload/auditory.vim @@ -374,7 +374,7 @@ let g:auditory_mappings['gg'] = { \ } let g:auditory_mappings['G'] = { \ 'audio': '/Resources/Normal_Mode/Jump.wav', - \ 'count': 1, + \ 'count': 0, \ } let g:auditory_mappings['x'] = { @@ -447,9 +447,12 @@ function! auditory#AssignMappings() endif endif - let l:map_to_with_count = has_key(value, 'count') ? - \ "execute 'normal!' v:count1 . '" . l:map_to . "'" : - \ l:map_to + if has_key(value, 'count') + let vcount = value.count ==# 1 ? 'v:count1' : 'v:count' + let l:map_to_with_count = "execute 'normal!' " . vcount . " . '" . l:map_to . "'" + else + let l:map_to_with_count = l:map_to + endif " If this an `execute` mapping, add a pipe. " Otherwise to exit command mode. -- cgit v1.2.3 From b4ce35770716bcf2c43fd27c53a2165c1741c850 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Mon, 23 Nov 2015 23:43:04 -0500 Subject: TODO Update: fixed `G` mapping --- TODO | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TODO b/TODO index 4a0dbb8..4acf58a 100644 --- a/TODO +++ b/TODO @@ -2,7 +2,7 @@ TODO ==== 2015.08.18: -- Fix G mapping. By itself it doesn't go to the end of the buffer +v Fix G mapping. By itself it doesn't go to the end of the buffer (2015.11.23) 2015.07.26: -- cgit v1.2.3