[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:
parent
00b15048df
commit
9e1bc94025
1 changed files with 13 additions and 0 deletions
13
nvim/.config/nvim/plugin/personal/spellsuggest.vim
Normal file
13
nvim/.config/nvim/plugin/personal/spellsuggest.vim
Normal 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>
|
Loading…
Reference in a new issue