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

add a %(text) variable #457

Merged
merged 1 commit into from
Nov 23, 2015
Merged

add a %(text) variable #457

merged 1 commit into from
Nov 23, 2015

Conversation

vivien
Copy link
Contributor

@vivien vivien commented Nov 22, 2015

This exposes the text of the currently selected line as the %(text)
variable. Only the pager view is supported at the moment.

This is particularly handy for using Tig as a scriptable pager. For
instance, here's a dumb remote manager:

$ echo 'bind pager <Enter> git remote show -n %(text)' >> ~/.tigrc
$ echo 'bind pager U git remote update -p %(text)' >> ~/.tigrc
$ git remote | tig

Pressing Enter shows remote information, pressing U fetches the remote.

This exposes the text of the currently selected line as the %(text)
variable. Only the pager view is supported at the moment.

This is particularly handy for using Tig as a scriptable pager. For
instance, here's a dumb remote manager:

    $ echo 'bind pager <Enter> git remote show -n %(text)' >> ~/.tigrc
    $ echo 'bind pager U git remote update -p %(text)' >> ~/.tigrc
    $ git remote | tig

Pressing Enter shows remote information, pressing U fetches the remote.
jonas added a commit that referenced this pull request Nov 23, 2015
@jonas jonas merged commit 8dc8d1a into jonas:master Nov 23, 2015
@jonas
Copy link
Owner

jonas commented Nov 23, 2015

Cool.

zevv added a commit to zevv/tig that referenced this pull request Jun 19, 2017
branch, but the graph gives the impression the commit is not merged.

The old case rendered this result. Not that the bottom branch looks
like it terminates without being merged:

 ● Update NEWS with post 2.1.1 changes
 ●─╮ Merge pull request jonas#457 from vivien/text-variable
 │ ● add a %(text) variable
 ●─╯ Merge pull request jonas#439 from peff/fix-blame-args
 │ ● blame: allow user to specify rev arguments to blame
 ●─╯ Update OSX make config to find brew installed ncurses
 ● Remove unneeded calls to {def,reset}_prog_mode

With fix I get this:

 ● Update NEWS with post 2.1.1 changes
 ●─╮ Merge pull request jonas#457 from vivien/text-variable
 │ ● add a %(text) variable
 ●─┤ Merge pull request jonas#439 from peff/fix-blame-args
 │ ● blame: allow user to specify rev arguments to blame
 ●─╯ Update OSX make config to find brew installed ncurses
 ● Remove unneeded calls to {def,reset}_prog_mode

Related to jonas#419

My current solution is not nice: it depends on the order of evaluation in the
graph_symbol_to_XXX() functions so that the new case of graph_symbol_merge_branch()
is hit before graph_symbol_turn_left() or graph_symbol_merge() do.

The graph-generating code is complex, and I have not spent enough time in it to
know for sure my fix does not mess up other situations.
koutcher added a commit that referenced this pull request Oct 30, 2023
PR #457 implemented %(text) for the pager view only. Extend %(text) support
to the blame, blob, grep and log views.

Fixes #1275
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

Successfully merging this pull request may close these issues.

2 participants