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

Re: save a command in history from within the widget



I have taken your suggestion and written the following function

if  [[ $@ =~ ^"d untrack-all" ]]
then
    g d rm --cached -r ~
elif [[ $@ =~ ^"d add-and-commit" ]]
then
    g d add ~ && g d commit -am \"$_\"
elif [[ $@ =~ ^"d sb" ]]
then
    g d branch | rofi -dmenu | xargs git checkout
elif [[ $@ =~ ^"d stash-and-reset" ]]
then
    g d stash && git d reset --hard HEAD
elif [[ $@ =~ ^"d last" ]]
then
    g d --no-pager log -1 --oneline
else
    zsh -c "git $@"
fi

Thanks and Best Regards,

Ahmad Ismail



On Mon, Oct 26, 2020 at 5:15 PM Ahmad Ismail <ismail783@xxxxxxxxx> wrote:
Thank you very much all. Now I understand your point.

Best Regards,

Ahmad Ismail



On Mon, Oct 26, 2020 at 1:11 PM Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx> wrote:
On Sun, Oct 25, 2020 at 9:24 PM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
>
> I don't understand why you can't drop a script literally called «g»
> into a directory in $path and implement in it whatever logic you want.
> (Or possibly a function, depending on your use-case.)

I highly recommend following this advice. Write a script or a function
called "g" and remove the custom accept-line widget.

> But, this script is only for my personal use, so I will continue
> tweaking it as per my requirement.

The value of the advice is not diminished by "g" being for your personal use.

Roman.


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