[nvim] Add fzf spellsuggest

Added fzf as selector interface for spell correction
selecting. Can be invoked through command
`FzfSpellSuggest` for now. Can be bound to keymapping if needed more
often; or if intending to overwrite default spell correction.
This commit is contained in:
Marty Oehme 2020-05-09 14:48:34 +02:00
parent 00b15048df
commit 9e1bc94025
No known key found for this signature in database
GPG Key ID: 0CCB0526EFB9611A
1 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,13 @@
function! s:fzfSpellSink(word)
exe 'normal! "_ciw'.a:word
endfunction
function! FzfSpell()
let l:spellstatus = &spell
setlocal spell
let suggestions = spellsuggest(expand("<cword>"))
if l:spellstatus
return fzf#run({'source': suggestions, 'sink': function("s:fzfSpellSink"), 'right': "20%" })
endfunction
command FzfSpellSuggest :call FzfSpell()<CR>