Sublime Forum

Custom folder for storing/saving the Sublime Text 3 Snippets

#1

Hi,

I see there has been no improvement despite several requests for allowing user to change his Sublime Text 3 Snippets folder path.

Right now whenever someone saves a snippet in ST3 it by default saves into directory:
“C:\Users[Username]\AppData\Roaming\Sublime
Text 3\Packages\User”.
This is not at all desirable in this world of security and backup issues.

Please specify how to achieve this in ST3 3126 Build itself.

Waiting for your reply…

0 Likes

#2

Hello!

On the security point: can you clarify your point?

Backing up Sublime Text is really easy: you save your User folder.

So, it’s better to save all your snippet in your User folder. For my part, they’re in User/snippets/[language]/. Note that if you want to organise them per langage, you can use this plugin BetterSnippetManager

Do you know that you can change the default path folder to save your snippets?

  1. Extract the Default package (with PackageResourceViewer)
  2. Open the new_templates.py file inside it
  3. Change the line 50.

Hope this helps in any way…

1 Like

#3

Besides what @math2001 mentioned, you could also use the portable version of Sublime instead of the installer based version.

In this case the entirety of Sublime, including all installed packages (which thus includes your User package and by extension your snippets) are stored inside of the portable folder. Put that folder somewhere that you think is more secure and/or easier to back up, and you’re good to go.

It’s also possible to use a directory junction to do something similar. As a test I created a directory junction between a directory named “mySnippets” in my User package (installed version of Sublime) and a folder on my desktop. Snippets that I put into the folder were seen (eventually) by Sublime and worked per normal.

I say “eventually” because in this case (I presume due to the NTFS mechanics of junctions or some Windows API itself) Sublime can’t detect file changes that occur inside of the junction. So every time I added or modified a snippet I had to restart sublime to get it to rescan the folder.

I didn’t test doing that with the Data directly entirely (which would put the entire package list elsewhere) but based on the experience with snippets, the lack of scanning inside of the junction would be an extremely large bummer.

All in all you’re probably better off with portable version.

0 Likes

#4

Personally I would like to specify an external snippet location as well. So I could easily share the same snippets between an installed and a portable version of ST3.

On my local desktop I prefer to use an installed ST3 with Windows Explorer integration. But if I work on terminal server sessions than I work with the portable version.

And it would be nice to share snippets between them without linking of directories.

Also another problem is that for the portable version the user directory is inside the portable version so you have to be more careful if you update it.

1 Like