From 87452e0058fb8984b678947d33715b155dd3dbf0 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 16 Aug 2015 02:48:18 -0400 Subject: autoload/auditory.vim: Fix `AuditoryToggle` + `Auditory[On|Off]` When using `:AuditoryToggle` in conjunction with `:AuditoryOn` or `:AuditoryOff`, things would get messed up. This is because `:AuditoryToggle` relies on `g:auditory_on` in order to know whether to turn sounds on or off, but the variable was only getting set in `auditory#ToggleMappings`, not in the functions that `:AuditoryOn` or `:AuditoryOff` call. Move the setting of the variable into `auditory#AssignMappings` and `auditory#Unmap` so that the right thing will happen regardless of which on/off/toggle commands you run. --- autoload/auditory.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'autoload') diff --git a/autoload/auditory.vim b/autoload/auditory.vim index e914a03..e214974 100644 --- a/autoload/auditory.vim +++ b/autoload/auditory.vim @@ -502,6 +502,8 @@ function! auditory#AssignMappings() endfor call auditory#AssignInsertMappings() + + let g:auditory_on = 1 endfunction @@ -537,15 +539,15 @@ function! auditory#Unmap() endfor call auditory#UnmapInsert() + + let g:auditory_on = 0 endfunction function! auditory#ToggleMappings() if g:auditory_on call auditory#Unmap() - let g:auditory_on = 0 else call auditory#AssignMappings() - let g:auditory_on = 1 endif endfunction -- cgit v1.2.3