Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: `copy-earlier-word' and `smart-insert-last-word

On Jan 25,  9:59pm, Le Wang wrote:
} `copy-earlier-word' works well (cycles through words on the
} same history line) with `insert-last-word', but it fails with
} `smart-insert-last-word'.

The problem is that smart-insert-last-word counts shell parser "word"
tokens, whereas insert-last-word counts ZLE words (i.e., the substrings
that forward-word and backward-word move across); copy-earlier-word
always runs `zle .insert-last-word ...', so it won't always pick the
same word as smart-insert-last-word.

(Most of the Functions/Zle widgets were designed independently of one
another, and no concerted effort has been made to make sure that they
all cooperate.  The `*insert-last-word' test is just meant to cover
insert-last-word both with and without the leading dot -- it's an
accident that it also matches smart-insert-last-word.)

In order to fix this, smart-insert-last-word has to be modified to
accept the two arguments that insert-last-word accepts, and then
copy-earlier-word has to store the value of $LASTWIDGET for re-use
the same way it stores __copyword.  I have no patch at this point.

Messages sorted by: Reverse Date, Date, Thread, Author