Skip to content
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

Keybindings do not work in case one uses zsh-vi-mode plugin #23

Open
Qubitol opened this issue Feb 22, 2023 · 3 comments
Open

Keybindings do not work in case one uses zsh-vi-mode plugin #23

Qubitol opened this issue Feb 22, 2023 · 3 comments

Comments

@Qubitol
Copy link

Qubitol commented Feb 22, 2023

Hi,
thank you for creating this amazing tool: fzf has been an absolute game-changer for me.

I had trouble in making the keybindings of fzf-git work after having installed zsh-vi-mode plugin.
I solved this issue by re-creating the keybindings according to what is advised in the zsh-vi-mode README, namely by doing:

# Set keybindings for zsh-vi-mode insert mode
function zvm_after_init() {
    zvm_bindkey viins "^P" up-line-or-beginning-search
    zvm_bindkey viins "^N" down-line-or-beginning-search
    for o in files branches tags remotes hashes stashes each_ref; do
        eval "zvm_bindkey viins '^g^${o[1]}' fzf-git-$o-widget"
        eval "zvm_bindkey viins '^g${o[1]}' fzf-git-$o-widget"
    done
}
# Set keybindings for zsh-vi-mode normal and visual modes
function zvm_after_lazy_keybindings() {
    for o in files branches tags remotes hashes stashes each_ref; do
        eval "zvm_bindkey vicmd '^g^${o[1]}' fzf-git-$o-widget"
        eval "zvm_bindkey vicmd '^g${o[1]}' fzf-git-$o-widget"
        eval "zvm_bindkey visual '^g^${o[1]}' fzf-git-$o-widget"
        eval "zvm_bindkey visual '^g${o[1]}' fzf-git-$o-widget"
    done
}

I guess there is nothing to do from your side, maybe you could consider adding a little statement on the README.

Thanks.

@bergtholdt
Copy link

Works for me, only thing that lreflogs is missing in the list of widgets:

# Set keybindings for zsh-vi-mode insert mode
function zvm_after_init() {
    zvm_bindkey viins "^P" up-line-or-beginning-search
    zvm_bindkey viins "^N" down-line-or-beginning-search
    for o in files branches tags remotes hashes stashes lreflogs each_ref; do
        eval "zvm_bindkey viins '^g^${o[1]}' fzf-git-$o-widget"
        eval "zvm_bindkey viins '^g${o[1]}' fzf-git-$o-widget"
    done
}
# Set keybindings for zsh-vi-mode normal and visual modes
function zvm_after_lazy_keybindings() {
    for o in files branches tags remotes hashes stashes lreflogs each_ref; do
        eval "zvm_bindkey vicmd '^g^${o[1]}' fzf-git-$o-widget"
        eval "zvm_bindkey vicmd '^g${o[1]}' fzf-git-$o-widget"
        eval "zvm_bindkey visual '^g^${o[1]}' fzf-git-$o-widget"
        eval "zvm_bindkey visual '^g${o[1]}' fzf-git-$o-widget"
    done
}

@raulchen
Copy link

Thanks for providing this solution.
I found that unbinding ^G before sourcing fzf-git can also fix this issue.

function zvm_after_init() {
    bindkey -r '^G'  
    source fzf-git.sh
 }

@chevcast
Copy link

chevcast commented Jun 7, 2024

Thank you guys! I had no idea what my issue even was as I have had zsh-vi-mode installed for a long time already. Glad this issue was right here 😃

chevcast pushed a commit to chevcast/fzf-git.sh that referenced this issue Jun 7, 2024
chevcast pushed a commit to chevcast/fzf-git.sh that referenced this issue Jun 7, 2024
chevcast pushed a commit to chevcast/fzf-git.sh that referenced this issue Jun 7, 2024
chevcast pushed a commit to chevcast/fzf-git.sh that referenced this issue Jun 7, 2024
chevcast pushed a commit to chevcast/fzf-git.sh that referenced this issue Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants