zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Matthew Braun <matthew@ans.net>, zsh-users@math.gatech.edu
Subject: Re: tcsh's autocorrect functionality wanted
Date: Thu, 14 Nov 1996 00:23:14 -0800	[thread overview]
Message-ID: <961114002314.ZM602@candle.brasslantern.com> (raw)
In-Reply-To: Matthew Braun <matthew@ans.net> "tcsh's autocorrect functionality wanted" (Nov 11,  9:24pm)

On Nov 11,  9:24pm, Matthew Braun wrote:
} Subject: tcsh's autocorrect functionality wanted
}
} I would like to get this tcsh functionality in zsh:
} 
}      autocorrect (+)
}              If set, the spell-word  editor  command  is  invoked
}              automatically before each completion attempt.

That would be pretty trivial to add, I think, except for the bugs in
spell-word described below.

} What I was thinking:
} 
} function spell-expand-or-complete-prefix {
}   spell-word
}   expand-or-complete-prefix
} }
} bindkey ^i spell-expand-or-complete-prefix

The way you do that sort of thing is like this:

	# bindkey '\es' spell-word	# already the default
	bindkey '\C-x\C-i' expand-or-complete-prefix
	bindkey -s '\t' '\es\C-x\C-i'

However, spell-word isn't clever.  It doesn't deal properly with a path
beginning with a tilde (~) -- I consider this to be a bug, because this
IS handled by `setopt correctall` -- and it does not know how to fix up
the path prefix when the suffix is "too far" from the correct spelling.

Finally, spell-word ignores `setopt completeinword` and always behaves
as if `setopt awaystoend`, so the cursor ends up in what may be a very
wrong place after spelling is completed.

So for now you can try the binding above; or you can look at "multicomp"
in the Functions/ directory of the zsh distribution, write yourself a
little program that does spell checking, and replace `reply=(${~reply})'
in that function with `reply=( $(spellcheck ${~reply}) )'.  For a basis
of the spell-checking program, you can cannibalize Src/utils.c for the
functions spname(), mindist(), and spdist().

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern


  reply	other threads:[~1996-11-14  9:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-11-12  2:24 Matthew Braun
1996-11-14  8:23 ` Bart Schaefer [this message]
1996-11-14 23:18 Matthew Braun
1996-11-15  8:50 ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=961114002314.ZM602@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=matthew@ans.net \
    --cc=schaefer@nbn.com \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).