Open without tree view when used as git editor?


#1

I’ve setup atom as my default git editor (using the command in the docs). I had sublime previously. I’ve noticed that when git opens the atom editor, it’s not nearly as fast as sublime is - primarily because atom appears to open with a tree view of a ton of git files. Sublime would only open an editor, no directory view.


#2

I don’t know if there is an easier way but here’s what I use on my Linux setup:
~/.atom/no-tree:

#!/bin/bash
if grep -q "disabledPackages:" ~/.atom/config.cson; then
  sed -i'' '0,/disabledPackages: \[/{s//disabledPackages: \[\n      "tree-view"/}' ~/.atom/config.cson
else
  sed -i'' '0,/core:/{s//core:\n    disabledPackages: \[\n      "tree-view"\n    \]/}' ~/.atom/config.cson
fi
NO_TREEVIEW="y" atom --wait "$@"

~/.atom/init.coffee:

atom.config.set('core.disabledPackages', atom.config.get('core.disabledPackages').filter (item, index, array) ->
  array.indexOf(item) is index and (item isnt 'tree-view' or process.env['NO_TREEVIEW']?)
)
chmod u+x ~/.atom/no-tree
git config --global core.editor "~/.atom/no-tree"

Github gist


#3

Giving this a try. I have the files setup as you’ve pasted, but see this error when atom opens via git:

sed: 1: "/Users/helion3/.atom/ ...": undefined label 'elion3/.atom/config.cson'

I’m not sure what that indicates - the disabledPackages array exists in the cson for me, with two packages I’ve disabled previously - so the if condition is true.


#4

It works fine on Linux but a quick google search showed this.
Adding '' after the -i option should do the trick.


#5

I’ve always disliked the differences of sed between linux/mac. Now I’m getting:

sed: 1: "0,/disabledPackages: \[ ...": bad flag in substitute command: '}'

I think I’ll probably just keep sublime as my git editor, and use atom for the actual work. I don’t mind atom’s startup time for actual development because the editor is great, but for git message editing I just need something fast and feature-less.