1

I use git and gitk a lot. Recently, I found some enthousiastic posts about tig and decided to give it a try. It looks great for viewing the repository, however changing the repo with tig seems difficult if not unworkable.

The problem I am facing is that tig fails to start an editor for external commands, thus making it impossible to continue with the action. For example, if I select a commit and issue

!git commit --amend

I get a screen saying

vim: Warning: Output is not to a terminal 

Only ^C gets me out, thus stopping tig as well.

What can I do to configure this properly for either tig or git in order to get this working?

thanks in advance, Ruud

ruud
  • 743
  • 13
  • 22

1 Answers1

2

The main way to start external commands is via keybindings and what in Tig is referred to as user-defined commands. For example, to amend the last commit you can add the following to ~/.tigrc after which pressing + will put you right into Vim:

bind generic + !git commit --amend

There are several variables for the browsing state, which can be passed to external commands, such as %(commit) and %(branch) as well as %(prompt) for asking for input, for example when creating a branch.

For reference, the !<command> allows to open the output in the pager, for example !git show 3e3abcd and as such is more like Vim's :r!<command>.

Jonas Fonseca
  • 1,811
  • 15
  • 15
  • Hi @jonas, fantastic tool! Is binding to a key eg `bind main T !git tag %(prompt) %(commit)` and then pressing `T` supposed to function the same as invoking an external command directly, with a commit selected `:!git tag %(prompt) %(commit`? – CervEd May 16 '22 at 15:14