문제

which one of these files do I have to edit so that I can launch Notepad++ from my cygwin Terminal?

$ find -name ".*"
.
./.bashrc
./.bash_history
./.bash_profile
./.inputrc
./.profile

This is the command I give in the terminal to add the Notepad++ to the directory

$ export PATH=$PATH:/cygdrive/c/Program\ Files\ \(x86\)/Notepad++/

So if i do a echo $PATH I can see that the directory was added to my PATH

This then allows me to open files in Notepad++ for editing

$ notepad++.exe filename

But i want my cygwin to be like this everytime I launch it. How can this be done?

NOTE: Using cygwing on windows7

도움이 되었습니까?

해결책

There are also another ways to do what you want. You don't have to add Notepad's directory to the PATH, when you need only one executable from that directory. The main advantage of a directory in the PATH is that every executable in that directory is available anywhere.

You can use for example alias, symbolic link or function. Each method creates the "npp" command, which you can then use as you suggested: npp filename. Advantage over the PATH method is that you can name it whatever you want.

alias

alias npp='/cygdrive/c/Program\ Files\ \(x86\)/Notepad++/notepad++.exe'

You can put it for example to your .bashrc. You can also add a parameters to an alias command. The name of an alias can be whatever you want.

symbolic link

ln -s /cygdrive/c/Program\ Files\ \(x86\)/Notepad++/notepad++.exe /usr/local/bin/npp

This will create a file in the directory /usr/local/bin which is already in your PATH. This file is symbolic link (something like Windows' shortcut) to the Notepad++ executable. The name of a symbolic link (the last part of the command) can be whatever you want, but you can't use a parameters there.

General format of the ln command for symbolic link:

ln -s target link_name

function

npp () {
    /cygdrive/c/Program\ Files/Notepad++/notepad++.exe $(cygpath -w -- "$@")
}

Again, you can put it for example to your .bashrc and name it whatever you want. cygpath converts path to the file from Linux to the Windows format, but it should not be necessary.

다른 팁

By editing ./bashrc file, you can achieve your goal. Here is the link for Cygwin Tutorial: Use External Editor Notepad.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top