From 3687632da7e961a1219710cde77845e6333ed0a6 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Thu, 6 Jul 2023 10:00:36 +0200 Subject: [PATCH] fancy fzf spell correction vim --- home/.config/nvim/common.vim | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/home/.config/nvim/common.vim b/home/.config/nvim/common.vim index 9e10e1b..158f6e5 100644 --- a/home/.config/nvim/common.vim +++ b/home/.config/nvim/common.vim @@ -117,8 +117,15 @@ nnoremap ZN [S " mark correct with zg, mark bad with zw, undo with zug/zuw -" correct with zc, default is z= but that sucks for qwertz keyboards -nnoremap z z= +" fancy fzf correct with zc, default is z= but that sucks for qwertz keyboards +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() " don't make things written as `something` a typo syntax region cBackTickNoSpell start=+`+ end=+`+