Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: save a command in history from within the widget
On 24 Oct 2020, at 13:00, Ahmad Ismail <ismail783@xxxxxxxxx> wrote:
> I am currently working on a widget. It is used so that I can use my git alias also for my dotfiles.
This is, to me, very advanced zsh and while reading through it I am still not exactly sure what it does or what the purpose is.
> The widget is given bellow:
>
> function _check-if-dotfile-command {
>
> if [[ $BUFFER =~ ^"g d untrack-all" ]]
> then
> zle .kill-whole-line
> BUFFER="g d rm --cached -r ~"
> zle .accept-line
> elif [[ $BUFFER =~ ^"g d add-and-commit" ]]
> then
> BUFFERz=$(echo $BUFFER | cut -d '"' -f2)
> zle .kill-whole-line
> BUFFER="git d add ~ && g d commit -am \"${BUFFERz}\""
> zle .accept-line
> elif [[ $BUFFER =~ ^"g d sb" ]]
> then
> zle .kill-whole-line
> BUFFER="git d branch | rofi -dmenu | xargs git checkout"
> zle .accept-line
> elif [[ $BUFFER =~ ^"g d stash-and-reset" ]]
> then
> zle .kill-whole-line
> BUFFER="git d stash && git d reset --hard HEAD"
> zle .accept-line
> elif [[ $BUFFER =~ ^"g d last" ]]
> then
> zle .kill-whole-line
> BUFFER="git d --no-pager log -1 --oneline"
> zle .accept-line
> else
> zle .accept-line
> fi
> }
>
> zle -N accept-line _check-if-dotfile-command
I currently have a directory named ~/.shell which is a git repo for all the various . Files in my home folder (via hard links). What is the widget intended to do and how is it triggered?
(I realize you've moved away from this widget, but what were you trying for).
--
ɹןʇnqן
<mailto:lbutler@xxxxxxxxxx>
tel:+1.303.219.0564
Messages sorted by:
Reverse Date,
Date,
Thread,
Author