Skip to content

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

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

3 participants

@vivien
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
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 Oct 12, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.