我需要在Git Bash中打开文件(txt、html、php等)的命令,就像当我输入notepad test.txt
时,test.txt会在记事本中打开一样,我想要类似的命令,比如npp test.txt
,它将在Notepad++中打开test.txt。我使用的是Win7(64位)。
我需要在Git Bash中打开文件(txt、html、php等)的命令,就像当我输入notepad test.txt
时,test.txt会在记事本中打开一样,我想要类似的命令,比如npp test.txt
,它将在Notepad++中打开test.txt。我使用的是Win7(64位)。
我在Notepad++安装目录下创建了一个名为npp
的文件。文件内容如下:
#!/bin/sh
"c:/Program Files (x86)/Notepad++/notepad++.exe" -multiInst -notabbar -nosession -noPlugin "$*"
然后将Notepad++安装添加到您的PATH中。
现在,在git bash中,您可以使用类似以下命令:npp foo.txt
来启动Notepad++编辑foo.txt。
$ start notepad++ [file path]
或者你可以添加
alias npp='winpty "C:/Program Files (x86)/Notepad++/notepad++.exe"'
添加到你的主目录下的 .bashrc 文件中。
在 Git Bash 中效果更佳。