diff options
| author | Teddy Wing | 2015-07-18 21:59:50 -0400 | 
|---|---|---|
| committer | Teddy Wing | 2015-07-18 22:25:10 -0400 | 
| commit | 83449bf7e30d45f91eccbcdffd56abb126be56c1 (patch) | |
| tree | 50afba06095a44b2e5fa56a7bac362f04e35edc3 | |
| parent | f87ae56b53f46654df2d0a6decdd5c12b2620f8b (diff) | |
| download | auditory.vim-83449bf7e30d45f91eccbcdffd56abb126be56c1.tar.bz2 | |
autoload/auditory.vim: Only map with `<silent>` if using `execute`
We don't need to use `<silent>` in our mappings if we're going back to a
regular non-command mode command, so listen for commands where we
`execute` in the mapping and don't `<silent>` them.
Reverted the ternary I had added previously to make this workable with
the now 2 variables that need to listen for `execute`.
Also add some line wrapping to the map creation for better readability.
| -rw-r--r-- | autoload/auditory.vim | 14 | 
1 files changed, 11 insertions, 3 deletions
| diff --git a/autoload/auditory.vim b/autoload/auditory.vim index 000498c..22a7cd1 100644 --- a/autoload/auditory.vim +++ b/autoload/auditory.vim @@ -435,9 +435,17 @@ let s:mappings['<c-r>'] = {  function! auditory#AssignNormalModeMappings()  	for [key, value] in items(s:mappings) -		" If this an `execute` mapping, add a pipe -		let l:pipe = match(value.map_to, 'exec') !=# -1 ? ' \| ' : '' +		let l:pipe = '' +		let l:silence = '' -		execute 'nmap <silent> ' . key . ' :<c-u>call auditory#Play("' . value.audio . '")' . l:pipe . value.map_to +		" If this an `execute` mapping +		if match(value.map_to, 'exec') !=# -1 +			let l:pipe = ' \| ' +			let l:silence = '<silent>' +		endif +		 +		execute 'nmap ' . l:silence . ' ' . key . +			\ ' :<c-u>call auditory#Play("' . value.audio . '")' . +			\ l:pipe . value.map_to  	endfor  endfunction | 
