1

I'm trying to find a good alternative to the VI editor that comes with my git version 1.8.0.msysgit.0 installed on my windows XP box. I've looked through the forums here and tried some of their suggestions. I must be missing something because they aren't working for me. I've tried this from the git command line:

git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst"

I also tried another way that used a shell. There I created a folder named shell on the root of C: I then created a sh file named npp.sh with this content:

#!/bin/sh
"c:/Program Files/Notepad++/notepad++.exe" -multiInst "$*"

after that I entered this command:

git config --global core.editor C:/shell/npp.sh

In both cases if I enter notepad++ on the git command line I get the message sh.exe": notepad++: command not found.

Chris
  • 112,704
  • 77
  • 249
  • 231
jimeast
  • 257
  • 1
  • 2
  • 13

1 Answers1

2

This turns out to be surprisingly difficult. /c/Program\ Files/Notepad++/notepad++.exe executes fine from Git bash, but doesn't seem to work with git config core.editor.

However, you can create a Bash alias for Notepad++ and use that as your core.editor. See this answer for details.

Community
  • 1
  • 1
Chris
  • 112,704
  • 77
  • 249
  • 231
  • when I hover the mouse over the quick launch icon it displays Git Bash twice so I guess I have Git Bash. Do I leave the quotes the same? I didn't know there were different flavors of Git, is there a better one for Windows? – jimeast Feb 02 '14 at 02:35
  • You should be able to leave the quotes the same. Git bash is fine, but it uses different pathing from `cmd.exe` (Unix-style instead of Windows-style). – Chris Feb 02 '14 at 03:44
  • I changed C:/ to /c/ but no luck. – jimeast Feb 02 '14 at 07:13
  • @jimeast, strangely `/c/Program\ Files/Notepad++/notepad++.exe` executes fine from Git bash, but doesn't seem to work with `git config core.editor`. [This answer](http://stackoverflow.com/a/16532226/354577) might be useful to you. – Chris Feb 02 '14 at 21:08
  • now I have created .bashrc in the home directory with the line alias npp="/c/Program\ Files/Notepad++/notepad++.exe" and in .gitconfig core I have editor = "'/c/Program\ Files/Notepad++.exe' -multiInst" weather I try npp or notepad++ it fails with the message sh.exe": notepad++/npp command not found. The good thing is I'm getting to like vim. – jimeast Feb 03 '14 at 04:52
  • 1
    I spoke too soon I didn't realize I had to restart the terminal window for my changes to take effect now the alias works as intended. – jimeast Feb 03 '14 at 06:08