aboutsummaryrefslogtreecommitdiffstats
path: root/autoload
diff options
context:
space:
mode:
authorTeddy Wing2015-07-18 22:34:44 -0400
committerTeddy Wing2015-07-18 22:38:08 -0400
commit0adb3c1b578fb0118de6387bddeea633bb1e1a94 (patch)
treedfa2c7b18b1dd898305ea72a0b473de36532795b /autoload
parentb262ac5ba505c6ee27ad3dcf0db8b868f52a100b (diff)
downloadauditory.vim-0adb3c1b578fb0118de6387bddeea633bb1e1a94.tar.bz2
autoload/auditory.vim: Ensure we `<cr>` if we're not piping
If we're not piping to an `execute` command in the mapping, we need to `<cr>` to execute the sound player and type the normal mode command. Otherwise the normal mode command gets typed in command mode which is not what we want and messes things up greatly. Figured I would just tack the `<cr>` on to the pipe variable rather than create a new one since it's the inverse of what we need in that situation. Hopefully the intention is clear enough but I'll grant that this doesn't expose the most clarity. Edit: Added a comment for better explanation of the <cr>.
Diffstat (limited to 'autoload')
-rw-r--r--autoload/auditory.vim5
1 files changed, 3 insertions, 2 deletions
diff --git a/autoload/auditory.vim b/autoload/auditory.vim
index a981e0a..4980ba5 100644
--- a/autoload/auditory.vim
+++ b/autoload/auditory.vim
@@ -435,8 +435,9 @@ 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 ? ' \| ' : ''
+ " If this an `execute` mapping, add a pipe.
+ " Otherwise <cr> to exit command mode.
+ let l:pipe = match(value.map_to, 'exec') !=# -1 ? ' \| ' : '<cr>'
execute 'nnoremap <silent>' . key .
\ ' :<c-u>call auditory#Play("' . value.audio . '")' .