Ⅰ. 插件描述
:wine_glass: Play typewriter sound in Vim when you are typing a letterⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'skywind3000/vim-keysound'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'skywind3000/vim-keysound'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'skywind3000/vim-keysound'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/skywind3000/vim-keysound
Ⅳ. 文档说明
# What is it ?
It's cool to play typewriter sound in Vim when you are typing a letter. :sunglasses:

:zap: You can use it along with the typewriter color scheme, and feel like you are really working on a typewriter.
Enjoy the rhythm of your code, gain the power from the sound, become productive in vim. :wine_glass:
See this video by Keefle (there is no audio delay in reality).
Installation
vim-plug
Plug 'skywind3000/vim-keysound'vundle
Plugin 'skywind3000/vim-keysound'Configuration
Enable keysound from start:
let g:keysound_enable = 1Command :KeysoundEnable and :KeysoundDisable can be used to manually start/stop the plugin if g:keysound_enable is not assigned.
Choose a sound theme:
let g:keysound_theme = 'default'Then the plugin will work and you can enjoy sound effect when you are typing in insert mode.
Avaliable themes are:
defaulttypewritermarioswordbubble
Additional sound themes can be found in sounds directory in your runtimepath, that is your ~/.vim/sounds or /path-to-dotfiles/sounds.
Change python version:
let g:keysound_py_version = 3Both 2 and 3 are available. It is assigned to zero by default, and will choose python automatically, change it to 2 or 3 if you need specify the python version.
Change volume:
let g:keysound_volume = 500The volume is initialized to 500 by default, and should be in range of [0, 1000].
Function
keysound provide a function to allow you play any wav file in vim.
keysound#playsound(wavfile, volume)wavfile is the path of your .wav file, volume is an integer with range of 0-1000.
Requirements
- Python or Python3 integration in vim
- PySDL2 with SDL2 binaries.
PySDL2 is used to provide low-latency audio playback.
Ubuntu
Just install python-sdl2 or python3-sdl2 with apt-get, depend on your python version in vim:
apt-get install python-sdl2or
apt-get install python3-sdl2openSUSE
Install python-sdl2 or python3-sdl2 and libSDL2_mixer-2_0-0 with zypper, depend on your python version in vim:
zypper install python-sdl2 libSDL2_mixer-2_0-0or
zypper install python3-sdl2 libSDL2_mixer-2_0-0Windows
Install pysdl2 in python or python3:
pip install pysdl2or
pip3 install pysdl2Download SDL2.dll from here, SDL2_mixer.dll from here. Put the two files into your python's installation directory.
You can verify your SDL2 installation by python -c "import sdl2". If there is no exceptions, your installation is fine.
Mac OS X
Install pysdl2 in python or python3:
pip install pysdl2or
pip3 install pysdl2Install sdl2 with brew:
brew install sdl2About
TODO