Invoking notepad++ from Git Bash

user1526519 picture user1526519 · Mar 8, 2013 · Viewed 54.6k times · Source

I am using msysgit in Windows 7. How do I invoke notepad++ from Git Bash, like we do it with our default notepad?

Like for example

name@usename notepad textfile.txt

Instead I want the file to open with notepad++.

Note : I've added notepad++ to my PATH, but still unable to invoke it from commandline.

Edit

I tried this in .gitconfig -->

[alias] notepad='C:/Program Files/Notepad++/notepad++.exe'

but isn't working.

Answer

SageMage picture SageMage · May 14, 2013

So, by default you won't have a .bashrc file so just navigate your to your home directory by typing:

cd ~

create or edit the .bashrc with vim (or whatever editor you are comfortable with):

vim .bashrc

Here is the line I had to add to mine (I am running a 64 bit OS so if you aren't don't copy this exactly)

alias notepad="/c/Program\ Files\ \(x86\)/Notepad++/notepad++.exe"

If your copy of windows is 32 bit then it should look like this

alias notepad="/c/Program\ Files/Notepad++/notepad++.exe"

Finally, close and reopen your terminal/bash (or, as noted, run source ~/.bashrc), and voila!