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

Bind to show a whole file at a revision for added context #91

Closed
kaihendry opened this issue Oct 2, 2012 · 2 comments
Closed

Bind to show a whole file at a revision for added context #91

kaihendry opened this issue Oct 2, 2012 · 2 comments

Comments

@kaihendry
Copy link

http://youtu.be/sSJ3Et2Uv-A

@vivien
Copy link
Contributor

vivien commented Oct 2, 2012

Hi @kaihendry,

An option might be to make tig set the file variable in the diff view like this:

diff --git a/tig.c b/tig.c
index d735391..5ce2437 100644
--- a/tig.c
+++ b/tig.c
@@ -4548,6 +4548,7 @@ diff_select(struct view *view, struct line *line)
        } else {
                s = diff_get_pathname(view, line);
                if (s) {
+                       string_ncopy(opt_file, s, strlen(s));
                        string_format(view->ref, "Changes to '%s'", s);
                } else {
                        string_ncopy(view->ref, view->id, strlen(view->id));

which allows you to add a binding such as:

bind diff v !git show %(commit):%(file)

This works, but I'm not sure if it doesn't break something, or if it's the best solution here.

@jonas
Copy link
Owner

jonas commented Oct 12, 2012

@kaihendry I've added code for opening a blob view based on the file path and the currently viewed file. Great idea with the video! :-)

@jonas jonas closed this as completed Oct 12, 2012
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

3 participants