diff options
| author | Teddy Wing | 2015-07-19 11:19:06 -0400 | 
|---|---|---|
| committer | Teddy Wing | 2015-07-19 11:24:54 -0400 | 
| commit | a5e9b6c85c15ad9b8ce011171412fa5766d39e02 (patch) | |
| tree | d3a1b29538eb60acabfaa6bb4647e45d186e2709 | |
| parent | 0adb3c1b578fb0118de6387bddeea633bb1e1a94 (diff) | |
| download | auditory.vim-a5e9b6c85c15ad9b8ce011171412fa5766d39e02.tar.bz2 | |
autoload/auditory.vim: Reenable visual mode 'x' mapping
Needed to come up with a way to add it to the `mappings` dictionary
without overriding the existing normal mode 'x' mapping. Prefixed it
with `v_` for the dictionary key so that it doesn't conflict, but that
could easily be the start of a mapping (for whatever reason), so added a
`map_from` field to make it explicit what we're mapping from in cases
where the dict key is unclear.
Also added another field to the dict to specify a custom mapping
command. It will default to `nnoremap` as that's the one we use for most
of our commands, but you can change it if you need another mode as we do
for this visual 'x' mapping.
| -rw-r--r-- | autoload/auditory.vim | 18 | 
1 files changed, 13 insertions, 5 deletions
| diff --git a/autoload/auditory.vim b/autoload/auditory.vim index 4980ba5..79ac524 100644 --- a/autoload/auditory.vim +++ b/autoload/auditory.vim @@ -412,10 +412,12 @@ let s:mappings['x'] = {  	\ 'audio': '/Resources/Normal_Mode/Delete.wav',  	\ 'map_to': "exec 'normal!' v:count1 . 'x'<cr>",  \ } -" 	let s:mappings['x'] = { -" 	\ 'audio': '/Resources/Normal_Mode/Delete.wav', -" 	\ 'map_to': "exec 'normal!' v:count1 . 'x'<cr>", -" \ } +let s:mappings['v_x'] = { +	\ 'audio': '/Resources/Normal_Mode/Delete.wav', +	\ 'map_command': 'vnoremap', +	\ 'map_from': 'x', +	\ 'map_to': "exec 'normal!' v:count1 . 'x'<cr>", +\ }  " nnoremap <silent> d :<c-u>call auditory#Play('/Resources/Normal_Mode/Delete.wav') \| exec 'normal!' v:count1 . 'd'<cr>  " nnoremap <silent> d :<c-u>set opfunc=d \| call auditory#Play('/Resources/Normal_Mode/Delete.wav') \| exec 'normal!' v:count1 . @g<cr> @@ -439,7 +441,13 @@ function! auditory#AssignNormalModeMappings()  		" Otherwise <cr> to exit command mode.  		let l:pipe = match(value.map_to, 'exec') !=# -1 ? ' \| ' : '<cr>' -		execute 'nnoremap <silent>' . key . +		" Default to nnoremap +		let l:cmd = has_key(value, 'map_command') ? value.map_command : 'nnoremap' +		 +		" If `map_from` is specified, we can't rely on `key` to provide it +		let l:map_from = has_key(value, 'map_from') ? value.map_from : key +		 +		execute l:cmd . ' <silent>' . l:map_from .  			\ ' :<c-u>call auditory#Play("' . value.audio . '")' .  			\ l:pipe . value.map_to  	endfor | 
