zsh-users
 help / color / mirror / code / Atom feed
* tcsh's autocorrect functionality wanted
@ 1996-11-12  2:24 Matthew Braun
  1996-11-14  8:23 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Braun @ 1996-11-12  2:24 UTC (permalink / raw)
  To: zsh-users

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.

Example of tcsh with this option:

sassy:~> cat /ect/pass<tab key pressed>

produces:

sassy:~> cat /etc/passwd


It corrected the spelling of "/etc" and then did the filename completion
of "passwd".

If this isn't something that can be done (please add it someone!), then
I'd like to at least get the functionality of "spell-word" combined with
the my current definition of the tab key.

What I was thinking:

function spell-expand-or-complete-prefix {
  spell-word
  expand-or-complete-prefix
}
bindkey ^i spell-expand-or-complete-prefix

But this doesn't work:

sassy:~> bindkey ^i spell-expand-or-complete-prefix
zsh: undefined function: spell-expand-or-complete-prefix

Any ideas on either the autocorrect or bindkey to a custom function?

sassy:~> uname -sr      
SunOS 5.5.1
sassy:~> echo $ZSH_VERSION
3.0.1

Thanks,

Matthew.


^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: tcsh's autocorrect functionality wanted
@ 1996-11-14 23:18 Matthew Braun
  1996-11-15  8:50 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Braun @ 1996-11-14 23:18 UTC (permalink / raw)
  To: schaefer, zsh-users

"Bart Schaefer" <schaefer@candle.brasslantern.com> on Thu, 14 Nov 1996  0:23 writes:
> On Nov 11,  9:24pm, Matthew Braun wrote:
> }      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.

Trivial for someone who already knows the code.  Any maintainers out
there listening?  Please add this.  Thanks!

> 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'

That's cool, thanks!

> 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.

Zsh masters, can these things related to spell-word be put on the TODO
list?  If there is such a list that is, as I don't see one in the
distribution tree.

It would be nice if the autocorrect that uses the spell-word stuff would
cover spell checking each part of the path for filenames, so it would
cover this example (assumes there are no other files that start with
pas* in the /etc directory):

zsh$ cat /ect/pas<tab>
expands to:
zsh$ cat /etc/passwd

> 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().

This seems like it would be slow, and given the number of times I hit
"tab" any slowness would likely be very annoying!  ;-)

Bart, mind giving me some examples of how completeinword and awaystoend
work?  I tried setting these and hitting tab in a few instances, but it
didn't seem to change the behavior.  I can see where it would be nice if
COMPLETE_IN_WORD worked for spell-word, but I don't see it actually
affecting anything right now.

Thanks,

Matthew.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1996-11-15  9:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-11-12  2:24 tcsh's autocorrect functionality wanted Matthew Braun
1996-11-14  8:23 ` Bart Schaefer
1996-11-14 23:18 Matthew Braun
1996-11-15  8:50 ` Bart Schaefer

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).