From 02e0756be6ba433017b7a19bdf8b595aa5ddb684 Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Wed, 22 Jul 2020 17:06:10 -0700 Subject: [PATCH] [vim] use fzf for spelling suggestions --- .vimrc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.vimrc b/.vimrc index 30e8938..ef01dcf 100644 --- a/.vimrc +++ b/.vimrc @@ -188,6 +188,16 @@ if executable('fzf') nmap b :Buffers nmap f :Files nmap t :Tags + + " https://coreyja.com/vim-spelling-suggestions-fzf/ + function! FzfSpellSink(word) + exe 'normal! "_ciw'.a:word + endfunction + function! FzfSpell() + let suggestions = spellsuggest(expand("")) + return fzf#run({'source': suggestions, 'sink': function("FzfSpellSink"), 'down': 10 }) + endfunction + nnoremap z= :call FzfSpell() endif " gundo