Looking at the spell_suggest()
function in spell.c
this doesn't seem possible with z=. After getting & displaying all the possible suggestions, it does:
/* Ask for choice. */
selected = prompt_for_number(&mouse_used);
prompt_for_number()
lives in misc1.c
, and does exactly what you would expect it to do: it prompts for a number (also see get_number()
in the same file). Mappings or other input isn't allowed.
A second option is to use Vim's spell "completion" through Ctrl x + s or Ctrl x + Ctrl s1 in insert mode. This does roughly what you want. You can choose from the completions with Ctrl n and Ctrl p or the arrow keys, or type your own improvement.
You can use the supertab plugin to do this with your Tab key. :help ins-completion
also has a CleverTab()
function which you could adapt for this.
For more information, see:
:help ins-completion
,
:help i_CTRL-X_s
Finally, Vim has the spellsuggest()
function, which returns a list of spelling suggestions:
:echo spellsuggest('hellz')
['hells', 'hello', 'hell', 'help', 'halls', 'heals', 'heels', 'hills', 'hulls', 'hell''s',
'hellos', 'hell’s', 'held', 'helm', 'tell', 'well', 'bells', 'cells', 'dells', 'fells',
'helot', 'helve', 'hertz', 'hilly', 'holly']
You could use this function to construct your own spell suggestion screen.
Footnote
1: Note that using Ctrl s may not work, as the docs mention:
NOTE: CTRL-S suspends display in many Unix terminals. Use 's' instead. Type
CTRL-Q to resume displaying.
If you're using gVim, using Ctrl s should work. Or you could disable this in your terminal with stty -ixon
.