Invoking notepad++ from Git Bash

后端 未结 14 2321
隐瞒了意图╮
隐瞒了意图╮ 2021-01-31 16:01

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.t

相关标签:
14条回答
  • 2021-01-31 16:29

    @SageMage's answer is right on spot.

    Just a reminder. You need to close and reopen GitBash after after you make a change in .bashrc in order for it to be activated.

    PS: After two years, I hope this helped!

    0 讨论(0)
  • 2021-01-31 16:32

    these are the faster ways to achieve the goal

    start notepad++ 
    start notepad++ <filename>
    alias np='start notepad++'
    np <filename>
    

    tried and tested, just do it!

    0 讨论(0)
  • 2021-01-31 16:37

    In your .bash profile add

    alias myeditor="'C:\\Program Files (x86)\\Notepad++\\notepad++.exe'"

    Give "\\" instead of "\".

    0 讨论(0)
  • 2021-01-31 16:40

    In your git bash just add:

    alias npp='notepad++ -multiInst -nosession'
    

    I hope this works.

    0 讨论(0)
  • 2021-01-31 16:41

    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!

    0 讨论(0)
  • 2021-01-31 16:41

    I added the Notepad++ folder to my path, so I can just type notepad++

    $ which notepad++
    /c/Program Files (x86)/Notepad++/notepad++
    
    0 讨论(0)
提交回复
热议问题