16

I want the git show command to send the contents of the file to a different editor (e.g. Notepad++) instead of the default view.

I'm presuming this is possible by changing the git config but I'm not sure where.

bytedev
  • 8,252
  • 4
  • 48
  • 56

1 Answers1

22

Git is not invoking an editor when you git show something, it is invoking your pager, and the two serve completely different purposes.

The setting you're after is core.pager, and you can configure it with git config --global core.pager <your editor here>, but it won't help if your editor can't be configured to read from stdin.

user229044
  • 232,980
  • 40
  • 330
  • 338
  • Thanks! I guess the next question is are there any text editors that can read from stdin? (I originally was thinking Notepad++) – bytedev Dec 05 '11 at 10:59
  • 2
    Vim can, via `vim -`, but why would you want to do this? The output of a `diff` is fundamentally not editable. All you need to do is page through it. Are you sure you're not after a GUI-based pager? Because those do exist. There is really no reason to want to use an editor as a pager. – user229044 Dec 05 '11 at 15:11
  • 11
    @meagar `git show VERSION:FILE` can be used to open a previous version of the given file, which, while not editable in the strict sense, is neither a diff. Vim can be used to open the output with: `git show | vim -` (along with a `:set filetype=` to get the syntax coloring). – nojhan Nov 28 '13 at 14:31