Hide treeview by default?


#1

Is there any preference I can set to make the treeview side bar closed by default? Every time I open a file the treeview is displayed. I’d like it to be closed initially.


How do you make this pane permanently hidden?
Hide/Toggle menubar
Noobie Question: How do I turn the Info Tab OFF?
Atom opens all files
#2

Only for single files or also for directories?


#3

Single files I guess, but a general solution would be good too. My use case is that I use an ftp client (transmit) to edit files on my server. I click the file in the transmit client, and atom opens up, but it shows the treeview every time.


Don't open previously opened files on new start
#4

Right now there’s no way to prevent that, but you can add this line to your init.coffee file to hide it.

atom.workspaceView.trigger 'tree-view:toggle'

#5

a nice solution can be a couple of options like “show treeview by default for singie file” and “show treeview by default for directory”


#6

doesn’t seem to work for me.


#7

APIs have changed since that answer. You can use the following:

var workspaceView = atom.views.getView(atom.workspace);
atom.commands.dispatch(workspaceView, 'tree-view:toggle');

#8

It looks like there is no views.get method (1 line). I’ve changed it to getView, and it works, but only after I hide the treeview for a given folder. I.e., when I open a folder in atom for the first time, I can see the treeview. I hide it, and it remains hidden when open that folder next time.


#9

Oops, you’re totally right! I updated my answer. Thanks! :slight_smile:

PS Oh, if the tree view’s still showing sometimes, maybe this will work:

atom.packages.onDidActivateInitialPackages ->
  workspaceView = atom.views.getView(atom.workspace);
  atom.commands.dispatch(workspaceView, 'tree-view:toggle');

#10

Hey, is it JS or coffescript? Putting it into init.coffee gives failed to load init.coffee: reserved word "var"


#11

Oops (again)… It’s both :stuck_out_tongue: I updated my answer, hope it works now :slight_smile:


#12

I just removed var and it worked. Thanks.


#13

I open a CSS file from the Downloads folder, now I see thousands of video files, PDF, image, ZIP, RAR and dozens of others, in the sidebar.
I am shocked :open_mouth:

Is there a way to fix this thing?
Thanks


Right-Click Open with Atom
#14

See above:


#15

Hi leedohm, I’m sorry but I did not understand what I do… is a script that I enter in Atom, but where?
Or maybe I should use the Terminal?


#16

As stated earlier in the topic, you place the snippet of code in your init.coffee.


#17

I added the script, but it does not work, if I re-open Atom, I see thousands of files.

However, problem solved, I uninstalled Atom.

In my opinion is meaningless the way Atom behaves.
If I open a single file, ONE, displays thousands of files. What sense does it also show the PDF files, or ZIP etc ??
Yesterday I logged in via FTP, I uploaded the entire server. but why? :grimacing:

It makes sense if I decide that a certain folder is a project, in this case I DO I see all of its contents.
Does not make sense.

Sorry :confused:


#18

@fabio I completely agree with you, I have thousand of preloaded files that I don’t need. Please allow this option to be turned off by default or toggle at my own convenience, until then I am going back to notepad++.


#19

This doesn’t appear to work anymore. I don’t know if things have changed, but I pasted that into init.coffee and nothing happens. Tree view still appears as normal. This is my init.coffee. I’m on Windows v1.0.11.


#20

I can’t see what would be wrong in your init.coffee… And it works just fine for me. Maybe add atom.commands.dispatch(workspaceView, 'tree-view:show'); on the line before the dispatch(workspaceView, 'tree-view:toggle')?