From 9e1bc9402501774a6d01e9403fd2116666f9936e Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Sat, 9 May 2020 14:48:34 +0200 Subject: [PATCH] [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. --- nvim/.config/nvim/plugin/personal/spellsuggest.vim | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 nvim/.config/nvim/plugin/personal/spellsuggest.vim diff --git a/nvim/.config/nvim/plugin/personal/spellsuggest.vim b/nvim/.config/nvim/plugin/personal/spellsuggest.vim new file mode 100644 index 0000000..da90be0 --- /dev/null +++ b/nvim/.config/nvim/plugin/personal/spellsuggest.vim @@ -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("")) + if l:spellstatus + return fzf#run({'source': suggestions, 'sink': function("s:fzfSpellSink"), 'right': "20%" }) + +endfunction + +command FzfSpellSuggest :call FzfSpell()