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

Re: .zsh_history

On 2023-04-14 21:49, Felipe Contreras wrote:
*But* that doesn't mean everyone understands all the configurations.

That's for sure.  Like anything that grew by accretion, not design, as new features were tacked on, the documentation became more and more incoherent.  I don't even attempt to understand completion now, I threw myself at it a couple of times and failed miserably.  complete completer completion completed completable ... only Satan really understands it.

So I think a more accurate statement would be that the configuration
is unidirectional: everyone understands their own configuration,
because they had an idea of what made sense, looked for a way to
achieve it, and found it. But other people have other ideas, and their
configuration isn't necessarily understood by others.

Yup.  Write-only configuration.

I'm 100% certain you can do that, but not with history expansion, you'll
need to use zle for that.
I'd sure like to know how!  Back in the day nobody seemed to know how to do it, not even Bart.  I came pretty close using 'noglob' and my functions work OK, but it would be vastly simpler if I could recover unexpanded command tails in some direct way.   As it is I run the function as an alias preceded by 'noglob' then save the literal text of the command tail as needed then 'eval' it.  Quite dumb, but it's the only way that I've found.
So you can write zle widgets to do anything you want to do with the
current line, but that's significantly different from history
substitution (e.g. !!0).

Never played with that.  Don't know anything about it.  All I want is to be able to recover a command tail *exactly* as it was typed.

my_function ()


grab_tail # writes tail to 'my_tail'.

echo "my tail, exactly as typed, is: $my_tail"


$ my_function $path $(eval 'ls *') one two three ! < > ``.."" &>^!

my tail, exactly as typed, is: $path $(eval 'ls *') one two three ! < > ``.."" &>^!

... no simple thing, since it is the nature of shells to expand and process command lines, not save them as typed.  But history does almost do it.


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