Edit current theme in SublimeText3? - themes

I remember being able to edit ST2 tabs colors and what not. How is it done in ST3 though?

I'd recommend copying the theme file to your user folder, then making the modifications there. Then, you can manually choose your custom version. Alternatively, you can override files in the packages folder. To assist with this, you can use PackageResourceViewier. I wrote it to help with viewing/overriding packages in ST3. With that being said, I haven't tried to edit theme files, so it may handle things in an odd way. So, I'd again recommend the first option of copying out the theme file, then manually choosing it.
For a reference on how to change the theme in your settings, see here.

For ST3
Backup Packages/Color Scheme - Default.sublime-package
Open Packages/Color Scheme - Default.sublime-package in some kind of archive manager program. (make sure you have write permissions)
Copy out the theme file you want to edit.
Edit the theme file.
Overwrite the theme file inside the Archive.
Restart Sublime
Smile

Related

Using Xcode preferences vs .gitignore file

I'm new to git repositories and have found lots of great support for creating a .gitignore file that I would put in each project directory.
However, I've noticed that in Xcode 10 preferences under Source Control under the git tab there is a spot to specify files to ignore. Is there an advantage to defining the exclusions in Xcode versus the .gitignore file? I can't seem to find anyone that actually does it this way and Apple docs are light.
Are there some items (maybe globals) that I would put be better putting in prefs?
Thanks!
Are there some items (maybe globals) that I would put be better putting in prefs?
They should all be globals. There is probably no reason for you to have individual .gitignore files on a project by project basis. The Xcode 10 preferences to which you refer is merely another window onto your global .gitignore file. It is, after all, git that is to do the ignoring — not Xcode.
Your question seems to imply that you are not using a global .gitignore file. Use one. What I do is maintain this file in my home directory, and call it .gitglobalignores. The file is pointed to through the .gitconfig file (there's a good explanation of how to arrange that here). Whether you type out the file by hand in a text editor or manage it through the Xcode 10 preferences window doesn't matter.

How do I edit snippets in Sublime Text 3?

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.

How can I export/import settings of Sublime Text 3 from one PC to another using Windows?

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.

How do I save and load all files in a sublime text session as a 'project'?

I've read that you can save a ' project ' but apparently I'm doing it wrong.
What I've done is...
Create a js, html and css file and use view/layout with 3 columns so
each file has its own section of the layout.
I then went to Project / save project as / and saved the respective file in
a directory
I assumed that all files should be saved in this directory along with a file that I can click that loads them all up to reflect the workflow.
Apparently sublime has a different idea of how this should work and I do not understand it.
Essentially, there are two parts to a Sublime project - a .sublime-project file, and a .sublime-workspace file. Please see both the "unofficial" docs and the official website for information regarding projects, and the setup of .sublime-project files. These files are JSON-formatted and contain paths to any folders contained in your project, project-specific settings, and project-specific build systems. This file can (and should) be edited to customize the project to your needs. Double-clicking this file (after associating its file type with Sublime, following the procedure of your operating system) will open the project, any open files within it, and any folders you've added to it (by selecting Project -> Add Folder to Project).
The .sublime-workspace file is also JSON-formatted, but is saved automatically by Sublime and shouldn't be edited unless you really know what you're doing, and even then you probably shouldn't edit it. It contains all sorts of meta information about the project's history in Sublime, which files were open and in what order/pane, previous contents of searches, find/replace, etc., your file history, settings for various plugins like SublimeCodeIntel, and lots more. By default it is hidden when viewing the contents of folders in the Side Bar, and when double-clicked it will try to open the project instead of opening for viewing/editing, so there are several measures in place to prevent your playing with it and potentially screwing up Sublime.
.sublime-project files can be saved wherever you want, but the folders and files contained within it are not necessarily saved in the same place - they stay wherever they were saved. It usually makes sense to save them in the project's root directory, so if you have a filesystem like myhomedir/projects/web/SweetWebsite/ containing html/, js/, and css/ subdirectories, you might want to save your project as .../SweetWebsite/SweetWebsite.sublime-project, just so you know at a glance what files/folders are probably in it. However, you could save SweetWebsite.sublime-project in myhomedir/Desktop for all Sublime cares, and it would work exactly the same way. While it is possible to have unsaved files in a project, of course it's always best to save your work early and often, so you don't lose anything.
Hopefully this helps, please let me know if you have further questions.

Coda syntax highlighting for Silverstripe

I've just moved onto a new machine. On my old work horse, I had Silverstripe template (.ss) files following HTML syntax highlighting in Coda. I can't for the life of me remember how I turned this on (I remember it was something I did myself though). Google has turned up no results.
Any suggestions?
UPDATE: The real way
In Coda, open Preferences, go to Editor, at the bottom, add a Custom Syntax Mode.
As per this guide:
Right click on Coda.app in /Applications and select Show Package Contents
Navigate to Contents/Resources/Modes/HTML.mode/Contents/Resources
Open ModeSettings.xml
Add <extension>ss</extension> to the list of extensions.
Or, make your mode (eg, SilverStripe.mode) and put it in ~/Library/Application Support/Coda/Modes
Or, copy HTML.mode to ~/Library/Application Support/Coda/Modes and then modify it, to preserve the original.
(For system-wide changes without modifying the application bundle, create the directory /Library/Application Support/Coda/Modes and put .mode directories there.)

Resources