markain
markain

Reputation: 381

Cygwin, opening a file doesn't allow more commands

When I open a file in cygwin it opens the file in my text editor, but I cant type in any new commands. to type in new commands i have to hit control-c, which closes my text editor. I hate it.

How do I type in new commands in the same cygwin tab without closing the text editor?

Bonus Points: How do i open a cygwin tab?

Edit: My bad I should have been more specific, I'm opening up sublime using the command "subl example.txt"

after I type that in cygwin doesnt take any commands since its busy keeping sublime open. I mentioned control c because thats my go to for stopping commands on bash.

Upvotes: 0

Views: 205

Answers (2)

GriffinG
GriffinG

Reputation: 662

Just append an & at the end of the command and it'll run in the background, allowing for you to use the terminal and the program you just opened.

Example

gedit Makefile &

Upvotes: 1

Warren Young
Warren Young

Reputation: 42373

If you use a traditional text-mode editor such as vi or emacs, it is of course going to take over the entire terminal which previously was used for the command prompt.

However, a decent Unix text editor will have a way to run shell commands from within the editor.

In vi, you can temporarily shell out with :sh. On saying exit from that command prompt, you come back to the editor you shelled out of.

vi can also run a single command without shelling out via its :!some command here facility. As with so many things in vi, the ex-mode ! command can be combined with other commands. One I use when building a ChangeLog file for a new software release is :r !svn log -r12345:HEAD, which gets the list of changes since revision r12345 and inserts them into the text editor at the cursor point. Here, :r reads output from a command rather than from a file.

Emacs has similar facilities.

As for tabs, sorry, but the default Cygwin terminal program (mintty) does not have that feature. Some people use tmux or screen to get around that limitation. Others, such as myself, tend to rely on shell-out facilities, backed up by starting additional mintty windows at need.

Upvotes: 0

Related Questions