I mapped zz to 1z=, which is great most of the time, but every now and then the first suggestion isn't the right one.
So I'd like to keep repeating zz (or .) to cycle through the other suggestions.
A second zz on the same word, then, would work like u2z=, a third zz would work like u3z= and so on.
Any ideas on how to do that?
Edit:
Based on @nobe4's awesome answer I managed to do what I want, but I'll leave it here for a while in case anyone has any improvements or suggestions:
let s:spell_position = []
let s:spell_count = 0
let s:spell_word = ""
function! LoopSpell()
if s:spell_position != getpos('.') ||
\ (s:spell_count > 0 && s:spell_word !~ expand("<cword>"))
let s:spell_count = 0
let s:spell_position = getpos('.')
endif
if s:spell_count > 0
silent execute "normal! u"
endif
let s:current_word = expand("<cword>")
if len(s:current_word) <= 0
return
endif
let s:spell_suggestions = spellsuggest(expand(s:current_word))
if len(s:spell_suggestions) <= 0
return
endif
if s:spell_count >= len(s:spell_suggestions)
let s:spell_word = s:current_word
let s:spell_count = 0
else
let s:spell_word = s:spell_suggestions[s:spell_count]
let s:spell_count += 1
endif
silent execute "normal! ciw" . s:spell_word
let s:spell_position = getpos('.')
endfunction
nnoremap <c-m> :call LoopSpell()<CR>
(I changed the mapping to <c-m> because of @Vitor's comment. Also this allows me to hold those keys down and sort of scroll through the suggestions really fast. I'm thinking of it as <c-mistake>.)


:Correctcommand: you'll be able to navigate trough the words to correct withnandN, a split window opens with all the correction suggestions you can simply navigate through them withjandkand<CR>will apply the correction. – statox Jul 09 '16 at 11:16zzcommand to fix specific things quickly. – dbmrq Jul 09 '16 at 17:47zzcenters the window around the current line. It's probably one of the shortcuts I use more often. You should also checkoutzbandzt. – Vitor Jul 09 '16 at 23:57scrolloffpretty high, but that still seems useful, I'll consider another mapping. Thanks! – dbmrq Jul 10 '16 at 05:34