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

Re: _history-complete-older problems with $(



I have one idea. It's generally about detecting a syntax error that
makes shell word unbound. By appending " x" to shell word and running
(Z+n+) one can obtain either 1 or 2 elements and first signals a
syntax error. For such case, SUFFIX would consist only from a space
delimited part of the regular right part.

Best regards,
Sebastian Gniazdowski


On 14 January 2016 at 11:14, Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
> On 14 January 2016 at 10:52, Sebastian Gniazdowski
> <sgniazdowski@xxxxxxxxx> wrote:
>> PS. I used the "find LBUFFER myself" approach to handle following case
>> better ("|" is cursor):
>>
>> % $(( 0 |+ 1 ))
>>
>> Doing ${(z)LBUFFER} and then (z) on right part of BUFFER would produce
>> SUFFIX="+" instead of "+ 1 ))".  If I find the word in ${(z)BUFFER}
>
> That turned out to be not true, (z) isn't done on right part, instead
> words[CURRENT] is utilized and chopped to obtain right part of shell
> word.
>
>     local -a left=( "${(z)LBUFFER}" )
>     local right="${words[CURRENT]#${left[-1]}}"
>
> So still clarifying things, maybe it's good idea to do (z) on right
> part to obtain ${|a case behavior.
>
> Best regards,
> Sebastian Gniazdowski



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