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

WIP user-programmable registers #708

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

rolandwalker
Copy link
Contributor

@rolandwalker rolandwalker commented Aug 1, 2017

RFC.

Summary

  • each register is named by a single ASCII letter
  • :set-register r %(commit)
  • :echo %(register:r)
  • !=(r)echo capture first line of arbitrary shell command

Example: arbitrary diffs

  • :bind main P :set-register c %(commit)
  • :bind main W :exec !git diff --color-words %(register:c) %(commit)
  • P to pick commit
  • move to new commit
  • W to view arbitrary word diff

Example: search diff content

cat > ~/.tigrc.deepsearch.script
:set-register q Apple_Terminal
:exec =(c)git log -i --format='%H' -G '%(register:q)'
:goto %(register:c)
:enter
^D
  • :bind main <Esc>/ :script ~/.tigrc.deepsearch.script

Example 2 would work better if

  • %(prompt) was available within scripts: script would begin with :set-register q %(prompt/)
  • ordinary / search could accept expansions: script would end with :eval /%(register:q)

Incidentally my real usecase is like Example 2 but with a full-text sqlite index of diff content.

@rolandwalker rolandwalker force-pushed the registers branch 3 times, most recently from 2a620b6 to 570ed44 Compare August 1, 2017 12:46
@jonas
Copy link
Owner

jonas commented Aug 1, 2017

Very interesting. I will probably wait with merging such a big change until I manage to release all the other good stuff from you.

@rolandwalker rolandwalker force-pushed the registers branch 5 times, most recently from 787178c to 60850e1 Compare August 6, 2017 00:15
@rolandwalker rolandwalker force-pushed the registers branch 3 times, most recently from a07220c to fc7d3a2 Compare August 17, 2017 15:19
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