From 52d1929d81edde06898b3fe2d3f4b0484b1587e7 Mon Sep 17 00:00:00 2001 From: Dimitar Dimitrov <mitkofr@yahoo.fr> Date: Thu, 20 Oct 2016 12:31:06 +0100 Subject: [PATCH 1/2] Add a spell replace function --- rc/base/spell.kak | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/rc/base/spell.kak b/rc/base/spell.kak index b54d111a..1083fd69 100644 --- a/rc/base/spell.kak +++ b/rc/base/spell.kak @@ -54,3 +54,14 @@ Formats of language supported: } </dev/null >/dev/null 2>&1 & } } + +def spell_replace %{%sh{ + suggestions=$(echo "$kak_selection" | aspell -a | grep '^&' | cut -d: -f2) + menu=$(echo "${suggestions#?}" | awk -F', ' ' + { + for (i=1; i<=NF; i++) + printf "%s", "%{"$i"}" "%{exec -itersel c"$i"<esc>be}" + } + ') + printf '%s\n' "try %{ menu -auto-single $menu }" +}} From 9529aa702079fb4774fc3ae41e8f6a2224c050db Mon Sep 17 00:00:00 2001 From: Dimitar Dimitrov <mitkofr@yahoo.fr> Date: Thu, 20 Oct 2016 13:12:05 +0100 Subject: [PATCH 2/2] Use -s for functions --- rc/base/spell.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/base/spell.kak b/rc/base/spell.kak index 1083fd69..15bc6078 100644 --- a/rc/base/spell.kak +++ b/rc/base/spell.kak @@ -55,7 +55,7 @@ Formats of language supported: } } -def spell_replace %{%sh{ +def spell-replace %{%sh{ suggestions=$(echo "$kak_selection" | aspell -a | grep '^&' | cut -d: -f2) menu=$(echo "${suggestions#?}" | awk -F', ' ' {