After posting this question on StackOverflow about a year ago (and being told the question belonged on Superuser), I have come up with a setup which works really well:
This opens a new window, and waits for you to close that window only, not any other Sublime window which you may have had open. This makes it work just right for editing patches or commit messages in git, etc:
#!/bin/bash
/home/alex/.bin/start_sublime
"/home/alex/Downloads/programs/Sublime Text 2/sublime_text" -nw $FILE
- ~/.bin/sub_existing_noblock:
This uses an existing window if there is one, and the shell does not wait for you to close the window:
#!/bin/bash
"/home/alex/Downloads/programs/Sublime Text 2/sublime_text" $FILE &
This always opens a new window, and again the shell does not wait for you to close the window:
#!/bin/bash
"/home/alex/Downloads/programs/Sublime Text 2/sublime_text" -n $FILE &
For general editing, sub_new_noblock
seems to be the most useful variant, so I alias it as sub
. For git, I use the following config: git config --global core.editor sub_new_block
. For other programs which launch an editor, I configure them to use whichever script is most appropriate.