Have trouble with Sublime Text 3 and Package Control. Can't find some packages through search (some plugins finds, some not), for example Color Picker plugin (https://sublime.wbond.net/packages/ColorPicker). Tried to reinstall Package Control and re-add repository but without results.
What could be the reason?
The most likely explanation is that you already installed ColorPicker at some point, and this is the reason it's not showing up in the searches you do via the Command Palette, such as using Package Control: Install Package. Go to Preferences -> Package Settings -> Package Control -> Settings-User and check the list of currently-installed packages to ensure it's not already listed there. If for some reason it's there, but not installed, delete it, restart Sublime, then try your search again, and it should show up.
In newer versions of Sublime Text 3, the above mentioned commands not available.
It is now available under Preferences -> Package Control Settings - User.
Related
The normal mac behavior for command+shift+? is to open the help menu search, which is super convenient to do menu commands without a mouse.
Unfortunately a sublime text package I have installed has mapped that key binding to the settings menu. Here's the relevant section of the package Default (OSX).sublime-keymap file
[
{ "keys": ["super+shift+/"], "command": "open_settings" }
]
Based on Related to How to unbind a key binding in Sublime Text 2?
I went ahead and overrode their keybinding in my user keybinding. Here's my user Default (OSX).sublime-keymap file.
[
{ "keys": ["super+shift+/"], "command": "noop" }
]
This stops the package from open settings when I press the key sequence. Same behavior if I use unbound for the command, excluding the command files package keybinding. However, it doesn't bubble up to the Mac layer which opens the help search menu.
I can get things to work the way I want to by modifying the package's key binding file directly, but that's going to get overwritten the next time the package upgrades.
Is there a supported way to remove a keybinding without stopping it from bubble up to the operating system?
The only way to completely remove a key binding in a way that Sublime won't react in any way is to remove it from the sublime-keymap file. This is true whether you want to fully remove a file from the Default/Default (PLATFORM).sublime-keymap (there is one for each platform) that ships with Sublime to remove a default key binding as well as any that might be added by a third party package.
As long as the key remains in a sublime-keymap anywhere, Sublime will see it and try to do something with it, even if the key is bound to a command that doesn't exist such as noop (although that is a good way to block a default key from doing anything if that's your ultimate goal).
Editing the package file
One way to solve the problem is to directly modify the packaged file itself, as you've already mentioned. In most cases that would mean unpacking the related sublime-package file (which is just a zip file), modifying the content of the file, and then repacking it.
As you've already noted, that's not a good way to go because when a package gets updated, the entire sublime-package file gets clobbered away, so your changes will also get discarded.
Overriding the package file
A safer way to do this would be to create a package override file instead. This only works if the package in question is installed as a sublime-package file, which covers all of the packages that ship with Sublime as well as most third party packages.
To do this, you would create a folder in the same name of the package in the Sublime Packages folder, which you can get at via the Preferences menu item Browse Packages.... Once that's done, extract just the file you want to override and place it into that folder, and edit it as desired.
When Sublime loads packages from a sublime-package file, as it loads each file it checks to see if any similarly named "unpacked" files exist in the Packages/PackageName/ folder. If such a file exists, the version inside of the sublime-package file is ignored and the unpacked file is used instead.
This means that even if the package gets updated, since your unpacked version is still there, it will still be used and so your change will remain in place.
The easiest way to create such a file is to use the PackageResourceViewer package. You can use it's PackageResourceViewer: Open Resource command from the command palette to find and open the offending file. If you make changes to the file and save it, PRV will automatically create the override for you.
There are a couple of caveats to this process:
If the package in question is installed already unpacked in the Packages folder, you can't create an override. In this case there's not a lot you can do other than vigilantly re-modify the file when it updates.
Most packages won't fall under this restriction because few actually need to be installed that way (only packages that contain files that need to be exposed outside of Sublime need to be installed this way).
Note also that Sublime Text 2 only installs packages as unpacked, so in that particular case you also can't do this.
When a package override exists, it's always used in place of a packed file of the same name, no matter what. This has the unfortunate side effect that if the package update actually modifies the file that you're updating in any way, those changes are masked from you without warning.
Will the full caveat/disclosure that I'm the one that wrote the package, the OverrideAudit package for Sublime can warn you when this happens by checking every time a package gets updated to see if the version of the packaged file is newer than your overridden version so that you know this is happening and can take appropriate action.
Sublime Text 2 notes
Your question is tagging Sublime Text 2 and Sublime Text 3. In the case of Sublime Text 2, the information above about needing to remove a key binding completely in order to allow the OS to see it still holds.
However as far as I'm aware Sublime Text 2 doesn't support the idea of package overrides because it always installs all packages unpacked. As such the only solution in that particular case is to modify the packaged file and keep an eye out for changes.
At this point with Sublime Text 3 officially released there are not many compelling reasons to keep using ST2. If you purchased your license for ST2 sometime mid/late 2013 or later your license should be valid for ST3.
This is particularly important in that ST2 is no longer supported and as of High Sierra when Apple removed Python 2.6, various Sublime packages will now no longer work.
I installed package control before and am currently using Emmet in Sublime Text 3 fine, but I am trying to install a new package control for syntax highlighting in Laravel, but I am having trouble installing package control when I paste in the installation code.
And when I got press control+shift+P and look for Package Control, nothing is there.
Check your User Preferences and make sure that the ignored_packages array does not include "Package Control". That's happened to me a few times when moving between dev builds, for reasons that are entirely unclear.
In Sublime Text 3, how do I edit my pre-existing snippet files? Is there a way of doing this within ST?
At the time of writing, there doesn't seem to be a straightforward answer to this anywhere on the web.
Custom snippets are saved in a .sublime-snippet file that you create when you first save the snippet.
By default, these are placed in the "User" package. You can either browse to the file like you would any other file, or using PackageResourceViewer: Open Resource -> User -> [name of your snippet file]
For those of you that like a visual instruction here it is:
Then, you can find your snippet like this:
If someone (like me) is looking to edit a custom snippet:
open file *.sublime-snippet which exists in
[home_directory]/.config/sublime-text-3/Packages/User/
If you have another file organization:
Start to make new snippet - Tools->developer->new snippet
Try to save it. Sublime shows you the right directory with snippets
Tools -> Developer -> View package file -> search for the existing snippet.
Change and save.
Here are the steps I had to follow (figure out on my own) for anyone else who wants to edit the built-in snippets of Sublime (in my case Javascript's "fun" "function" snippet). Note: this assumes you've installed the Package "PackageResourceViewer" already:
--> PackageResourceViewer: Extract Package
Then specify which package(s) you want to extract. FWIW this process was a bit confusing for me ... somehow I managed to select everything? but I only wanted/needed "JavaScript".
Wait a second or three for Sublime to extract these (no idea what this does in background, I assume maybe unzipping/extracting loose files to your file system?)
You'll get a confirmation dialog about your successful extraction
NOW you can edit built-in snippets by --> PackageResourceViewer: Open Resource
--> Select "JavaScript" (in my case)
--> Select "/Snippets" (in my case)
--> Select your snippet (in my case it was "function-(fun).sublime-snippet" or something like that.
The file will open and you can modify/save your changes ... FINALLY!
WAY too complicated IMHO but at least it works.
Here is how to edit built-in snippets manually on macOS, in this case the JavaScript snippets. This is a way to do it without installing plugins:
Right click the Sublime Text app, select "Show Package Contents"
In the Finder, navigate to Contents -> MacOS -> Packages
Copy the JavaScript.sublime-package file to ~/Library/Application Support/Sublime Text 3/Installed Packages
Change the file name from JavaScript.sublime-package to JavaScript.zip and unzip the file
In your text editor, edit the contents of the unzipped JavaScript folder as required (e.g. delete the fun snippet from the Snippets folder)
Zip up the JavaScript folder again, rename it from JavaScript.zip to JavaScript.sublime-package and leave it in the Installed Packages folder.
Restart Sublime. Your new JavaScript package will override the built-in package.
I use Sublime Text 3 in my company and I want to export all the settings, including packages and whatever, to use the same configurations in Sublime Text 3 I have at home. How can I do this?
PS.: I use Windows 8
The best way is to sync the User directory, there are multiple available ways to do this - dropbox, git and manual ways.
Installed packages are registered in Package Control.sublime-settings, which is located in the user folder as well, thus, it does not require you to sync anything besides that. A pretty good guide to syncing can be found here.
You also may wish to check out this package.
For me (Windows installation) transferring all the content from old installation - AppData\Roaming\Subime Text 3, to new installation - AppData\Roaming\Subime Text 3, does the job. All the packages and UI settings are transferred and are working correctly.
None of the manual efforts are needed now (I think). Both sublime text (ver 3) and visual studio code (if anyone cares) have extensions that do this for us.
For VS Code -
https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync
For ST3 -
https://packagecontrol.io/packages/Sync%20Settings
With a few clicks like generating token and configuration, one should be able to easily port the settings from any machine (Win, OSX, Linux) to any machine.
You can try this plugin PackageSync. It can package your settings and packages into a zip or 7z file, then, you can import them on another machine.
As an aside an easy way to locate the 'User' or 'Sublime text {2/3/etc}' folder regardless of OS is to:
Open go-to-anything and just type: 'us'
From the available options select 'Preferences: Package Control Settings - User’ to open that file.
Right click on the file and make the selection to open the containing folder (Mac: reveal in finder)
Navigate back up to the parent folder Sublime Text 3 (or whatever version number you are on)
Copying this folder and replacing the Sublime Text 3 folder in a fresh Sublime install with this one should install all packages and replicate any other settings you have.
source
"If you want to sync settings across machines, the best way to do so is to just sync the Packages\User\ folder. This contains all customized settings, and if you are using Package Control, it includes a list of all installed packages. If Package Control sees that an installed package is not present on the machine, it will automatically install it the next time Sublime Text starts."
PS: if I am not mistaken the author of this post is the key developer of sublime.
I've programed a plugin for an installer package I am planning to use.I've used Apple's Package manager 2.4 (Tiger) before where I could right click packages (*pkg), navigate through the contents folder, create a plugins directory and paste my plugin plus the installersections.plist file. However in version 3.0 (Snow Leopard), I can't click on "Show Package Contents" to add my plugin, the option isn't there in finder.
How can I add plugins?Apple must have thought of some way to do this since this is still offered in Xcode 3?
It is possible to install plugins with Package Maker 3. It is easier by using "Raw Editing Mode". All you have to do is to install plugins activating the Raw Editing mode Menu>Project>Raw Editing Mode and than drag the plugins (Plugnins folder containing bundles and the InstallerSections.plist) to the Files.
It is less pain than Flat Package Editor, I think.
Good luck, Bye
It is possible, although tricky, to install plug-ins into a PackageMaker 3 bundle. You need to go to the Edit menu in PackageMaker and open the Flat Package Editor. Open your installer bundle, and insert the plug-in in the appropriate location as you would in the Finder with a 2.0 bundle.
Yes, it's a pain.