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

vim.tigrc: G move-last-line does not work in main view #594

Closed
kiryph opened this issue May 15, 2017 · 6 comments
Closed

vim.tigrc: G move-last-line does not work in main view #594

kiryph opened this issue May 15, 2017 · 6 comments

Comments

@kiryph
Copy link
Contributor

kiryph commented May 15, 2017

I have configured tig to use to the vim bindings defined in contrib/vim.tigrc in ~/tigrc:

source ~/.config/tig/vim.tigrc
$ tig --version
tig version 2.2.2

Why does it not work in the main view but in the diff view?

@loonies
Copy link

loonies commented May 24, 2017

Add bind main G move-last-line

@kiryph
Copy link
Contributor Author

kiryph commented May 24, 2017

Thanks. @jonas Do you mind adding this by default to contrib/vim.tigrc?

@jonas
Copy link
Owner

jonas commented May 25, 2017

@kiryph The current behaviour is a bug. Do you want to make a PR?

@kiryph
Copy link
Contributor Author

kiryph commented May 26, 2017

@jonas Thanks for you response. I am not sure if you refer to tig itself or the vim.tigrc configuration file. I would assume if I bind main G none and in the next line I set a generic one, I do not need to bind main G explicitly.

If you mean that this is unintentional and should be fixed in something like https://github.com/jonas/tig/blob/master/src/keys.c#L155-L183, I am afraid I would have to understand your source code to create a PR without screwing something up. Naively, I would expect something like this

❯ git diff
diff --git a/src/keys.c b/src/keys.c
index e405320..594227d 100644
--- a/src/keys.c
+++ b/src/keys.c
@@ -177,6 +177,8 @@ get_keybinding(const struct keymap *keymap, const struct key key[], size_t keys,
                        (*matches) += generic_matches;
                if (request == REQ_UNKNOWN)
                        request = generic_request;
+               if (request == REQ_NONE && generic_matches == 1)
+                       request = generic_request;
        }

        return request == REQ_NONE ? REQ_UNKNOWN : request;

@jonas
Copy link
Owner

jonas commented May 29, 2017

I think it should be fixed in the vim.tigrc file. Your proposed fix will break the ability to unassigned a generic keybinding in a specific keymap. This was one of the motivations for introducing none as a key action. For true unassignment it would be better to introduce an unbind command.

@jonas
Copy link
Owner

jonas commented Jun 11, 2017

Fixed by #599 in 416072f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants