From fa7f29a1205d8dcbce1e10a171eb64a11774f7d8 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 28 Mar 2017 08:32:21 +0100 Subject: [PATCH] spell.kak: preserve spelling language from :spell in :spell-replace --- rc/base/spell.kak | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rc/base/spell.kak b/rc/base/spell.kak index 8be4f12e..87e82dc0 100644 --- a/rc/base/spell.kak +++ b/rc/base/spell.kak @@ -1,4 +1,5 @@ decl -hidden range-faces spell_regions +decl -hidden str spell_lang decl -hidden str spell_tmp_file def -params ..1 \ @@ -22,6 +23,7 @@ Formats of language supported: exit 1 else options="-l '$1'" + printf 'set buffer spell_lang %s\n' "$1" fi fi @@ -100,7 +102,10 @@ def spell-next %{ %sh{ } } def spell-replace %{ %sh{ - suggestions=$(printf %s "$kak_selection" | aspell -a | grep '^&' | cut -d: -f2) + if [ -n "$kak_opt_spell_lang" ]; then + options="-l '$kak_opt_spell_lang'" + fi + suggestions=$(printf %s "$kak_selection" | eval "aspell -a $options" | grep '^&' | cut -d: -f2) menu=$(printf %s "${suggestions#?}" | awk -F', ' ' { for (i=1; i<=NF; i++)