aliteralmind
aliteralmind

Reputation: 20163

How to force folder refresh in Sublime, when "Project > refresh" doesn't work?

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.

Upvotes: 76

Views: 64427

Answers (4)

Kamlesh
Kamlesh

Reputation: 6145

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.

Upvotes: 14

W. Dan
W. Dan

Reputation: 1027

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

Upvotes: 15

Sandun Chathuranga
Sandun Chathuranga

Reputation: 2362

  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.

Upvotes: 147

bp.
bp.

Reputation: 240

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.

Upvotes: 1

Related Questions