Merge remote-tracking branch 'Screwtapello/spell-replace-prompt' into master
This commit is contained in:
commit
c6bfce0350
|
@ -142,20 +142,27 @@ define-command spell-next %{ evaluate-commands %sh{
|
||||||
|
|
||||||
define-command \
|
define-command \
|
||||||
-docstring "Suggest replacement words for the current selection, against the last language used by the spell-check command" \
|
-docstring "Suggest replacement words for the current selection, against the last language used by the spell-check command" \
|
||||||
spell-replace %{ evaluate-commands %sh{
|
spell-replace %{
|
||||||
options=""
|
prompt \
|
||||||
if [ -n "$kak_opt_spell_last_lang" ]; then
|
-init %val{selection} \
|
||||||
options="-l '$kak_opt_spell_last_lang'"
|
-shell-script-candidates %{
|
||||||
fi
|
options=""
|
||||||
suggestions=$(printf %s "$kak_selection" | eval "aspell -a $options" | grep '^&' | cut -d: -f2)
|
if [ -n "$kak_opt_spell_last_lang" ]; then
|
||||||
menu=$(printf %s "${suggestions#?}" | awk -F', ' '
|
options="-l '$kak_opt_spell_last_lang'"
|
||||||
{
|
fi
|
||||||
for (i=1; i<=NF; i++)
|
printf %s "$kak_selection" |
|
||||||
printf "%s", "%{"$i"}" "%{execute-keys -itersel %{c"$i"<esc>be}}"
|
eval "aspell -a $options" |
|
||||||
|
sed -n -e '/^&/ { s/^[^:]*: //; s/, /\n/g; p }'
|
||||||
|
} \
|
||||||
|
"Replace with: " \
|
||||||
|
%{
|
||||||
|
evaluate-commands -save-regs a %{
|
||||||
|
set-register a %val{text}
|
||||||
|
execute-keys c <c-r>a <esc>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
')
|
}
|
||||||
printf 'try %%{ menu -auto-single %s }' "${menu}"
|
|
||||||
} }
|
|
||||||
|
|
||||||
define-command -params 0.. \
|
define-command -params 0.. \
|
||||||
-docstring "Add the current selection to the dictionary" \
|
-docstring "Add the current selection to the dictionary" \
|
||||||
|
|
Loading…
Reference in New Issue
Block a user