72

Especially when using an sftp drive (but this problem is also an issue with local drives, although thankfully not as frequent), the folders in the sidebar just keep spinning and spinning, and the "Open Anything" dialog therefore has no files to choose from.

"Project > Refresh folders" does not work in most cases.

I've resorted to restarting Sublime manually, which works most of the time, but it's getting to be a pain to have to do this every other time I switch projects.

Is there any better way to "force" the folders to refresh?

This problem is the reason I asked this question:

The SublimeRestart plugin doesn't work on Windows until this project-state-saving problem is solved. However, even if it did work perfectly, it would still only be a workaround for this really annoying non-refreshing-folders issue.


My workaround on Windows, FYI: After loading a project, when the folders don't refresh (don't load even the first time), I have ctrl+f10 bound to "File > Exit", and f10 configured into the shortcut that I launch Sublime Text with. So two reasonably-quick (although additional!) button presses.

Community
  • 1
  • 1
aliteralmind
  • 19,847
  • 17
  • 77
  • 108
  • 1
    Something that helps: Do *not* put the `sublime-project` file on the sftp drive. That makes things doubly slow. Once when loading the project file, and again when loading its directories. I've created a `q_drive_sublime_projects` folder on my C drive, which contains of them. – aliteralmind Feb 05 '15 at 17:49
  • 1
    However, since I want these project files to be checked into each git repository, I have a Windows shortcut from `q_drive_sublime_projects` to each sftp directory, so I can drag and drop any changes. The shortcuts are immediately next to the project file: `project_name.sublime-project` `project_name.sublime-project__q_dir.lnk`. – aliteralmind Feb 05 '15 at 17:50

4 Answers4

140
  1. Open Sublime Text.
  2. Select Preferences from the top menu and click Key Bindings – User. Here you will see a JSON file that should contain an array of objects (initially the array is empty). Every object will represent a shortcut.
  3. Add the following (new shortcut object) entry into the array (between the brackets):

    { 
        "keys"    : ["f5"], 
        "command" : "refresh_folder_list" 
    }
    

You should be able to refresh the folders with F5.

totymedli
  • 29,531
  • 22
  • 131
  • 165
Sandun Chathuranga
  • 2,242
  • 2
  • 13
  • 27
  • 5 bucks says you only did:`"keys": ["f5"], "command": "refresh_folder_list" ` – The Dembinski Aug 31 '16 at 04:12
  • 11
    Doesn't solve the original problem. Yeah, it refreshes the folders when the folders are able to be refreshed, but the question asks how to do this when they aren't being refreshed as they normally should. Obviously this is just a shortcut for the normal refresh. – Ryan Weiss Sep 15 '16 at 07:34
  • 7
    this may be a little late, but to clarify for future references and other coders, the correct way is to add { "keys": ["f5"], "command": "refresh_folder_list" } into the array after you followed points 1 and 2 above, like so [{ "keys": ["f5"], "command": "refresh_folder_list" }] – chickensmitten Jan 18 '17 at 04:14
  • 1
    @chickensmitten feel free to edit answer in correct way. – Sandun Chathuranga Feb 03 '17 at 06:05
  • I just added the missing brackets after confirming that they are indeed needed. – gdelfino Jul 07 '17 at 23:04
  • 1
    First press of F5 after new keybinding === FEELS GOOD, MAN – RomoCode Oct 18 '17 at 23:28
13

Try to Install this package: https://packagecontrol.io/packages/SideBarEnhancements

  1. Open the package folder. Main menu -> Preferences -> Package Control: -> Package Control: Install Package
  2. Search the keyword: Side​Bar​Enhancements
  3. Enjoy it

After you install this plugin, you will see the refresh button in your sidebar option: enter image description here

W. Dan
  • 906
  • 8
  • 10
  • 3
    Could you give a reason why or elaborate on how this solves what OP asked? – sm1215 Aug 07 '18 at 18:51
  • 2
    @sm1215 it gives the sidebar option to right click and refresh. By default, there isn't any options to refresh the folder specifically. The SidebarEnhancments is a nice find. Thanks! – cbloss793 Jan 03 '19 at 20:20
  • 3
    Yeah, but it still doesn't solve the fact that the folders are **not** refreshing, even when explicitly triggered. – Kamafeather May 09 '19 at 14:13
13

I have added this myself the other day. I constantly work in an environment where files in the project are changing before I can see them.

Goto 'Preferences' menu -> 'Key Bindings' -> 'User' which will open a JSON file, add below code, save and close that file.

{ "keys": ["ctrl+f5"], "command": "refresh_folder_list" }

It will work like charm 100%. Thanks for asking this question.

Kerem
  • 11,377
  • 5
  • 59
  • 58
Kamlesh
  • 5,233
  • 39
  • 50
1

This isn't going to be a very useful answer but it documents some early behaviour in Sublime Text that would solve your problem, assuming you need no later features from Sublime Text 2/3 (a big assumption indeed).

Sublime Text 1 had the handy feature in the folder context menu to "Refresh folder". This cause an immediate indexing of only the specified directory (and subdirectories) which was a boon when using networked drives over high-latency connections.

This was deprecated in Sublime Text 2.

Version 1 is available here or by direct download here. It's not clear that these will be available indefinitely though, so this isn't necessarily a long-term solution.

bp.
  • 240
  • 2
  • 10