bigH / git-fuzzy

interactive `git` with the help of `fzf`
MIT License
2.3k stars 42 forks source link

Default key bindings having uppercase letter do not work on MacOS #29

Closed samoshkin closed 3 years ago

samoshkin commented 3 years ago

Hi,

PR https://github.com/bigH/git-fuzzy/pull/16 make it possible to override key bindings for various commands like "diff to merge base", "view log" or "diff to working copy" in a fuzzy finder screens.

However, key binding is now defined with an uppercase letter, e.g. Ctrl-P, Alt-P. IMO, it seems like fzf --bind expects those mappings to be defined in lowercase, like alt-p.

GIT_FUZZY_BRANCH_WORKING_COPY_KEY=${GIT_FUZZY_BRANCH_WORKING_COPY_KEY:-Ctrl-P}
GIT_FUZZY_BRANCH_MERGE_BASE_KEY=${GIT_FUZZY_BRANCH_MERGE_BASE_KEY:-Alt-P}

So the issue is, unless I manually override those environment variables like this with all chars in lowercase, mappings do not work.

export GIT_FUZZY_BRANCH_WORKING_COPY_KEY="ctrl-p"
export GIT_FUZZY_BRANCH_MERGE_BASE_KEY="alt-p"

Regarding local environment I have:

# fzf v0.25.0 (8c533e3)
# zsh 5.8 (x86_64-apple-darwin19.6.0)
# tmux 3.1c
# iTerm2 3.3.7
# MacOS Catalina 10.15.7
Mellbourn commented 3 years ago

For me the keybindings doesn't seem to work at all.

I start git fuzzy status and it states that I'm supposed to be able to use Alt-A, Alt-S etc. I'm on a Mac and I've tried substituting Option or Control for Alt but nothing happens.

I can only enter text that filters, use arrows and tab, nothing else works.

# fzf v0.25.1 (brew)
# zsh 5.8 (arm-apple-darwin20.2.0)
# tmux 3.1c
# iTerm2 3.4.3
# MacOS Big Sur 11.2.1

I'm using zinit as package manager, like this

zinit ice wait'2' lucid as"program" pick"bin/git-fuzzy"
zinit light bigH/git-fuzzy

My keyboard is Swedish.

My dotfiles are here https://github.com/Mellbourn/dotfiles

bigH commented 3 years ago

this should fix the issue. please update and reopen if this issue persists.

Mellbourn commented 3 years ago

Didn't fix it for me. Most Alt-keys cannot be triggered by Options key for me. I'm starting to suspect that the issue is related to Swedish keyboard. Maybe this should be a different issue.

pierreguilmin commented 3 years ago

@Mellbourn have you tried https://github.com/bigH/git-fuzzy/issues/7#issuecomment-638458713?

Mellbourn commented 3 years ago

That is not a good option for me. I tried it a long time ago. IIRC it screws up swedish letters

On Wed, 24 Mar 2021 at 11:49 PierreGuilmin @.***> wrote:

@Mellbourn https://github.com/Mellbourn have you tried #7 (comment) https://github.com/bigH/git-fuzzy/issues/7#issuecomment-638458713?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/bigH/git-fuzzy/issues/29#issuecomment-805713654, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANT6733Z3IQCOCZHTG4S2TTFG7SDANCNFSM4WEMPV2A .

leighmcculloch commented 2 years ago

This problem happens for me with the VSCode integrated terminal on macOS. git-fuzzy's keys don't work at all. I don't have this problem with other applications.

bigH commented 2 years ago

@Mellbourn sorry for the late response.

I think the problems here are all related to the applications and/or OS hijacking the keys before they end up in the terminal. Option key on the macOS keyboard is not the same as Alt on other platforms. I don't use kitty for this very reason.

Here's what I suggest: