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

Re: command completion notification



On Aug 4,  8:43pm, William Scott wrote:
}
} > (2) It depends on what you want the binding to do.  For example, to
} > simply insert "tnot" in front of the current command and then run it:
} > 
} > tnot-widget() { BUFFER="tnot $BUFFER"; zle accept-line }
} > zle -N tnot-widget
} 
} (2) worked like a charm, and am embarrassed since I read that chapter
} in your book last night.

You must mean Peter, Jerry and Oliver's book (credit where due).

} Maybe I am taking a stupid approach. What would be ideal is if a user
} could specify a time in seconds beyond which the notification would be
} issued.

I don't think there's anything particular wrong with the approach.  You
can check the shell variable $SECONDS before and after the command is
run to see how much time has expired and only issue the notice if the
difference is large enough.  The example from last October does this by
saving $SECONDS in preexec and the comparing it in precmd, but it can
also be done entirely inside a wrapper like your tnot function.



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