diff options
| author | Teddy Wing | 2015-08-16 02:43:09 -0400 |
|---|---|---|
| committer | Teddy Wing | 2015-08-16 02:43:09 -0400 |
| commit | 8a0fd42b1df21aa9bd1c9d6f8b169d060ea8db6e (patch) | |
| tree | ae9a1937f4b2a638378a4cd5b15d842390fc7454 /autoload | |
| parent | da0a9cf9fba990b5d39041b43b7257599fd4c5a4 (diff) | |
| download | auditory.vim-8a0fd42b1df21aa9bd1c9d6f8b169d060ea8db6e.tar.bz2 | |
Add function and command to toggle mappings
* Create `auditory#ToggleMappings()` that turns sounds on if they're off
and off if they're on
* Create an `:AuditoryToggle` command that runs the toggle function in a
more user-friendly callable way
With a toggle command, turning Auditory on or off can be as simple as
hitting 1 custom mapping. With our previous `AuditoryOn` and
`AuditoryOff`, you would have to use 2 mappings: 1 for on and another
for off.
Diffstat (limited to 'autoload')
| -rw-r--r-- | autoload/auditory.vim | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/autoload/auditory.vim b/autoload/auditory.vim index ffa2b1e..e914a03 100644 --- a/autoload/auditory.vim +++ b/autoload/auditory.vim @@ -538,3 +538,14 @@ function! auditory#Unmap() call auditory#UnmapInsert() 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 |
