After a lot of writing in Q10 on Windows, I got used to the typewriter sound it makes every time you press a key. At least for me it feels great to have this sort of sound feedback.
On Linux on the other hand, I love writing it VIM, because of it's editing features. How could I add this functionality to VIM?
Simply said, I want to play a sound every time I press a key in the insert mode.
Alright, this kinda crazy, but it appears to work. First, grab yourself a typewriter sound in aiff format. Then put that typewriter sound in ~/.vim/support/my_typewriter_sound.aiff
. Then add the following to your ~/.vimrc
.
function! PlaySound() silent! exec '!afplay ~/.vim/support/my_typewriter_sound.aiff &' endfunction autocmd CursorMovedI * call PlaySound()
Note that the above function calls out to afplay
, which I know works on a Mac and needs to be replaced with play
on Linux. On Windows, I have no idea.
So you know what's happening above, we're first creating a function called PlaySound
that shells out to afplay
. We then setup an autocommand that gets fired anytime the cursor moves in insert mode. When it fires, it calls PlaySound
.
The plugin does exist. You can find it here: https://github.com/osyo-manga/vim-sound
However, you need to add sound effects files yourself, which you can find here: http://www.soundjay.com/typewriter-sounds.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With