Skip to content

Add option to Interact with selection #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

AhmedAbdulrahman
Copy link

I would like to thank you for this awesome plugin :).

I have extended stash functionality to add options to interact with selections using pop, apply or evencheckout to selection.

bindings:

  • CTRL + b checks out the stash as a branch and removes the stash `
  • CTRL + y will apply the stash`
  • CTRL + x will drop the stash`

I would appreciate if you reivew it

Kapture 2019-11-18 at 21 45 19

@wfxr
Copy link
Owner

wfxr commented Nov 19, 2019

Hi @AhmedAbdulrahman Thanks for your contribution!

This feature looks great. But it doesn't seem to work properly under bash:

bash: ${(f)out}: bad substitution

Since the forgit.plugin.sh is a soft link to forgit.plugin.zsh we should ensure the compatibility.

Another problem is the keybinding conflict. ctrl - b is a universal keybind to move backward one character. ctrl - y is used for copy selection already. It's hard to find some keybinds which are meaningful and not occupied.

I think we should separate these actions into three different functions named gsc/forgit::stash::checkout, gsa/forgit::stash::apply and gsd/forgit::stash::drop so that we can use fewer keybinds and keep the code simple enough for compatibility & maintainability.

@wfxr
Copy link
Owner

wfxr commented Nov 25, 2019

The latest fzf add support for reloading input without exiting: junegunn/fzf#1750

Now to implement this feature you only need to add a bind to FORGIT_STASH_FZF_OPTS like this:

FORGIT_STASH_FZF_OPTS='
--bind="ctrl-x:reload(git stash drop $(cut -d: -f1 <<<{}) 1>/dev/null && git stash list)"
'

Considering the existing interfaces already support adding keybind I decided to put it as an example in the readme instead of adding a lot of new commands.

https://github.com/wfxr/forgit/blob/master/README.md#152

@wfxr wfxr closed this Nov 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants