It would be nice to be able to pipe standard out to `atom` and have it open in an unsaved document


#1

Example: git diff | atom
This works in text mate or sublime:
git blame README.md | mate
git log | subl

This would be a must have if I were to use this as a full time editor.


Does Atom CLI support stdin?
`git diff origin/master | atom` should show the diff
Write to File and Open in Editor
#2

This would be fantastic. I’m on the command line most of the day. This is one of the reasons I haven’t fully switched over.


#3

+1

An awesome feature I really enjoy in Sublime.


#4

Just another +1, use this feature all the time


#5

without this feature, I have to have another editor too. is it hard? poking around to see how to do. any pointers welcome…


#6

This is a bit of a show stopper for my team, we use the same text editor for the shell ($EDITOR) and the .gitconfig editor, either sublime or textmate.

Does Atom plan to fill these roles?

– Owen


#7

Can Atom at least be used as the commit log message?

From the git reference:
The editor used to edit the commit log message will be chosen from the GIT_EDITOR environment variable, the core.editor configuration variable, the VISUAL environment variable, or the EDITOR environment variable (in that order). See git-var(1) for details.

It would make sense for a github product to at least allow Atom to be used for the commit message!

– Owen


#8

Yes, I use it for my all around $EDITOR. Pipe support isn’t required for that to happen.

My setting for the Git editor is: core.editor=atom --wait

There is even support for colorization of Git commit, merge and rebase messages in the default-installed Language Git package … which also mentions how to set Atom as your Git editor.

None of this requires pipe support.


#9

As a temporary workaround until this is implemented in Atom, you can use my tmpin module like:

git diff | tmpin atom

#10

Just bumping this to see if any progress is being made to make this work?

I have been using Atom full time, but I still need to use TextMate for doing things like git diff | $EDITOR (because the editor has diff syntax highlighting, which I don’t have setup in my shell). I’d like to set Atom to $EDITOR, but can’t do that yet because of the lack of piping STDIN.

I know @leedohm claims that pipe support isn’t necessary, but the original use case from @jeremyellison isn’t about using Atom to edit commit messages (which works fine in Atom). It’s about piping STDIN into Atom, which it can’t do.


#11

Piping stdout into an Atom is a must-have. Are any devs working on this?


#12

I don’t think anyone is currently working on this, no.

As another workaround, you could create a bash script containing something like:

#!/usr/bin/env bash

OUT="$(mktemp atom)"

cat > $OUT
atom $OUT

I have this saved as /usr/local/bin/atom-pipe and now I can do: cat some-file | atom-pipe

edit: Oops, I see @sindresorhus already posted about his module that does this :smile:


#13

i would prefere this to be included in atom itself. but meanwhile @postcasio answer seems the lightest/simplest to me. thanks

PS: btw there is a name conflict with an atom extension https://github.com/moshee/atom-pipe


#14

Just type it into the atom.io package search


#15

Here’s a simple snippet to implement @sindresorhus & @postcasio’s method into your .bashrc file:

function ap {
  ATOM_TEMP=$(mktemp atom.XXX)
  cat > $ATOM_TEMP
  atom $ATOM_TEMP
}

#16

Now with improved hygiene! :slight_smile:

function atom-pipe {
  ATOM_TEMP=$(mktemp /tmp/atom.XXXX)
  cat > $ATOM_TEMP
  atom --wait $ATOM_TEMP
  rm $ATOM_TEMP
}