ChatGPT解决这个技术问题 Extra ChatGPT

Sublime Text 2 - Show file navigation in sidebar

I just switched to Sublime Text as my new editor. If I open the sidebar it shows the opening file, but what I want is a file navigation sidebar, is it possible to change that without downloading plugins?

Is there a way to open all of your sublime text two files on the right hand scroll bar?
Recommand you to use that package github.com/facelessuser/FuzzyFileNav

F
Fahad

You have to add a folder to the Sublime Text window in order to navigate via the sidebar. Go to File -> Open Folder... and select the highest directory you want to be able to navigate.

Also, 'View -> Sidebar -> Show Sidebar' if it still doesn't show. In the new version, there is only an 'open' menu and no separate option for opening a folder.


On OS X just normally use File -> Open and then click Open in any folder in the new file dialog.
Ive been trying to find a plugin for that for like 6 months lol +1
Is there a keyboard shortcut to navigate the folder panel without using the mouse?
just figured out Ctrl + 0
can't you just somehow see list of files in current folder, where the currently opened file sits? I can't believe no one yet written such a plugin. Yes you can see them in "Open File" dialog, but wouldn't it be great to be able to see current folder structure, and navigate out and into inner folders right in the side bar, and maybe preview files without really opening them like in Visual Studio 2012
b
bulatzamilov

You may drag'n'drop your folder to Side bar. To enable Side bar you should do View -> Side bar -> show opened files. You'll got opened files (tabs) tree and folder structure at Side bar.


ctrl+k ctrl+b or cmd+k cmd+b (MAC) to enable side bar
My sidebar was just gone for no apparent reason! This fixed it. Thanks! :)
v
vahid abdi

Use Ctrl+0 to change focus to the sidebar.


THANK YOU. Once sidebar is focused, up/down go prev/next file, left/right collapse/expand!
It's not the answer to the asked question, but it helped me.
@mmohaveri That's debatable. It was a poorly-worded question to begin with.
In Windows '''Ctrl-K Ctrl-B" opens and closes the sidebar. Of course you first need to View->ShowOpenFiles, or have a project set in order to have access to the sidebar.
THANK YOU, that's the answer I was looking for :) Ctrl-0 (zero) and the file is highlighted in the sidebar.
s
sternAndy

Instead of opening a folder, try adding a folder by going to "Project" -> "Add Folder to Project..." which opens a Folder choosing dialog. This way the folder won't open in a new window and will be added to your current workspace.

If you then go to "Project" -> "Save Project As..." you can even save your current setup (cells setup, opened files, unsaved changes, etc...), this makes it easy to hotswitch between multiple projects without loosing control and unsaved changes which could be unsafe to be saved right now, but would be a loss if you just ditched them. (Just be sure to have the "hot_exit" setting set to true.)

And Ctrl + Alt + P (Linux and Windows) / Super + Ctrl + P (Mac) lets you switch between the saved projects.

This way you don't have to setup your editor every time you want to work on one of your projects.

Hint: Try http://sublime-text-unofficial-documentation.readthedocs.org/en/sublime-text-2/ which is a wonderful resource for beginners, it teaches you the ropes and shows you the power of your "new" editor, just start with the "Editing" chapter.


Agreed, File > Open... opens the folder in a new project.
This is what I was looking for without knowing it -- new to Sublime and didn't grok projects...
C
Community

open ST ( Sublime Text ) add your project root folder into ST : link : https://stackoverflow.com/a/18798528/1241980 show sidebar : Menu bar View > Side Bar > Show Side Bar Try Ctrl + P to open a file someFileName.py

Does a navigation panel for openned files and project folders appear in the left of ST ?

Extra : Want view the other files that are in the same directory with someFileName.py ?
While I found ST side bar seems doesn't support this, but you can try Ctrl + O (Open) keyshort in ST to open your system file browser, in which the ST will help you to locate into the folder that contains someFileName.py and it's sibling files.


a
adelarsq

Both of the previous answers from Matt York and Cyberbolt are right.

Basic idea is here that you want to get some kind of File explorer in Sublime.

Approach:

1) With File -> New Folder -> Click on Desired folder and Hit Open you will get new popup window in sublime which for me is very annoying

2) I use second option which is drag'n'drop from nautilus (a.k.a. Files) window. Simply drag'n'drop your file you want to explore from nautilus to sublime sidebar. That way you stay in the same window and everything is cool.

Don't forget to enable View -> Sidebar -> Show Sidebar and drag'n'drop there from nautilus and of course run it with root privleges. It works like charm


B
Breno Medeiros de Oliveira

Just do: Ctrl+K+B

Have a nice day! :D


this shortcut is supported in any particular version or all ?
@AkberIqbal This work in SublimeText2 since 2012(I don't know which version), but this shortcut only work in some cases, if it don't worked to you this one should do the trick: Ctrl+k AND THEN Ctrl+b. You can see it working in 2012 Sublime2 here: forum.sublimetext.com/t/ctrl-b-ctrl-k-doesnt-toggle-sidebar/…
I'm not sure if it works for all versions, but justo go to the latest and you should be Fine. Also, Ctrl+k and then Ctrl+b works as well
S
Steven Koch

See this plugin

https://github.com/stvkoch/sublime-text-go-to-file

This version, while not merge with fork branch, has more power to find files basead on class name. Try: select namespace and click alt+d click on word of class name and click alt+d click on path of template file and click alt+d


J
Jordan

This is not exactly a solution, but for opening new files this works great:

AdvancedNewFile

https://github.com/skuroda/Sublime-AdvancedNewFile

Command + Option + n to save a file in a new or existing directory.

https://i.stack.imgur.com/nlE1c.png

So this would place your_file.html.erb in the existing views directory in a Rails app. If you needed a new directory -you would just type that as the path and then hit enter.

You can also Tab like in terminal to autocomplete for existing directories.

This does not give the sidebar navigation I am looking for, but at least helps with one significant need that is repeated often.


and if you prefix the name with : you can create the file in a location relative to the currently open file, eg: :../myfile.js
B
Brent

I added the Context Menu item for Folders to open in Sublime Text. In windows, you can right click on any Folder and open the structure in Sublime. You could also create a service (?) for Mac OS - I'm just not familiar with the process.

The following could be saved to a File (OpenFolderWithSublime.reg) to merge to the registry. Be Sure to modify the directory structure to appropriately point to your Sublime installation. Alternatively, you can use REGEDIT and browse to HKCR\Folder\shell and create the values manually.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text]

[HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text\command]
@="C:\\Program Files\\Sublime Text 2\\sublime_text \"%1\""