Use Notepad++ from Cygwin without having the shell wait for an exit code
You could try a bash
function to pass the arguments before the ampersand:
np ()
{
/cygdrive/c/Program\ Files/Notepad++/notepad++.exe $* &
}
BUT the bigger issue may be the whole idea of not waiting until Notepad++ exits. Shell commands which use $EDITOR
typically are designed to wait until the editor sends back an indication that the editing has completed. This usually means that the editor has exited (e.g. with vi
or nano
).
Emacs has a way to set your EDITOR
to emacsclient
and then when you're done editing, you hit a magical keystroke (C-x #
) to indicate that editing is complete. If Notepad++ had something similar for cygwin users, I can see how this would work.
Another alternative is to use plain, boring, simple Notepad as your EDITOR and reserve Notepad++ for heavy use (I got the idea from this blog post)
I solved it with a simple symlink.
ln -s /cygdrive/c/Program\ Files\ \(x86\)/Notepad++/notepad++.exe ~/bin/npp
Of course ~/bin is in my $PATH.
Now to open a file I just type "npp filename.txt" from the cygwin prompt. I've haven't had to use the & at the end of the command.
This will also throw a tab into the currently running Notepad++ window rather than opening another one -- AND if the file is already open, it doesn't open it again.
export EDITOR="/cygdrive/c/Program\ Files\ '(x86)'/Notepad++/notepad++.exe"
alias np="/cygdrive/c/Program\ Files\ '(x86)'/Notepad++/notepad++.exe"
also works for x86