MacOS – How to fix missing spaces when using Dictation with MacVim or Terminal

macosmacvimterminalvoice-dictation

I'm trying to use Dictation on OS X 10.10.5 to enter text into MacVim (or into Terminal). It works for the most part but, for whatever reason, those programs won't let Dictation add a space after each phrase. If I say the phrase "type a sentence" and then pause and say "for me", Dictation will enter "type a sentenceFor me", instead of "type a sentence for me". Any way to fix this?

Best Answer

TL; DR

This issue appears to be MacVim-specific. Try using Vim 7.4.889 or later instead.

Analysis and Work-Arounds

I have experienced this same issue on both Yosemite and El Capitan with MacVim-snapshot-77. For example, in MacVim:

I pause hereAnd dictation doesn't add a space.

However, I only experience this problem in MacVim and the versions of gvim and mvim that the MacVim package provides. Vim 7.4.889 (as installed via Homebrew) and Terminal.app with various versions of Bash seem to work fine for me on OS X 10.11 (El Capitan).

In case your settings are different, I have enabled:

  • Dictation & Speech -> Dictation -> Use Enhanced Dictation
  • Accessibility -> Dictation -> Dictation Commands -> Enable advanced commands

This appears to be something hard-wired in MacVim. Even if you define a custom dictation command for MacVim such as "literal space" and assign it the space character, MacVim with Enhanced Dictation always seems to treat pauses as the start of a new sentence. I would recommend filing a bug against MacVim.

While it won't fix the underlying problem with MacVim, you can work around the issue by doing your dictation in a Terminal-based Vim session using a different build. Since the problem appears to be MacVim rather than Vim, this seems like the most pragmatic short-term solution until MacVim is fixed.