Neovim plugin offer speech to text capability using the Python speech_recognition library.
You can select your favorite engine for speech-to-text: OpenAI whisper, Google, Vosk API etc.. (or any supported speech_recognition engine).
This is basically a tin wrapper around speech_recognition. So, you really want to check out its documentation. Should work OOB with whisper function.
Uses keyboard, which requires admin on Linux. Luckily, only used for detection of <ESC> so without root access you may only lose the escape key functionality.
Using vim-plug:
Plug 'eyalk11/speech-to-text.nvim'
or with Vundle:
Plugin 'eyalk11/speech-to-text.nvim'
PluginInstall
Before running UpdateRemotePlugins
, check the Python provider of your VIM
installation:
:CheckHealth
To install Python dependencies:
!pip install -r ~/.vim/plugged/speech-to-text.nvim/requirements.txt
:UpdateRemotePlugins
Those are minimal requirements. The speech_recognition library may have more dependencies depending on the platform and/or desired functionality.
It may be possible to install in one line (untested):
Plug 'eyalk11/speech-to-text.nvim', {'do': ':!python -m pip install -r ./requirements.txt \| :UpdateRemotePlugins'}
Installing the plugin adds the following functionality to VIM:
GetVoice()
: returns text by speech
:Voice
: replaces the selected range with text (by speech). Gets the same parameters as the ConfigureVoice commmand.
You can cancel both voice commands by pressing esc.
:ConfigureVoice [enginename] [paramsdic]
- which configures engine parameters (can also be done by yaml config).
The enginename and params would be used for the next Voice/GetVoice call.
Mappings are not added by default. Suggested mappings:
nmap <c-L> :Voice<CR>
imap <C-L> <C-R>=GetVoice()<CR>
https://vi.stackexchange.com/users/23502/vivian-de-smedt for helping out with replacing text.