can't override syntax highlighting in sublime text 3 - syntax-highlighting

I manually installed a package awhile back for ST3 that had additional syntax highlighting languages. I have since removed it, and for the files it affected selected 'Open all with current extension as..' to now be Java. However when I re-open them they still default to the old package language. If I open up the syntax highlighting menu both languages are actually highlighted. If I reselect Java it will be correct until I close and re-open any file with that extension again.
Can anyone explain how I can either force it to always stay in Java or remove the other language all together?

Go to Preferences -> Browse Packages and navigate to the User folder. There should be a file in there named OtherLanguage.sublime-settings. Delete that file, restart Sublime, and you should be all set. If that still doesn't work, look for a Java.sublime-settings file in the same directory. Delete that as well, restart, and you should be back to the default behavior. Open a file with the extension, select View -> Syntax -> Open all with current extension as... and select Java. This will create a new Packages/User/Java.sublime-settings file, so don't delete it!

Related

How do I use Mac OS aliases in Sublime Text 3?

I want to open the tree of folders which contains any code on my Mac in Sublime 3. Something like this:
But I don't have all of it in one folder, and it isn't convenient enough to open many folders in Sublime every time I close the app. So I have created 'aliases' (via Finder) to my folders and put them to one (folder), which i want to open with Sublime.
That didn't work out. Sublime opens these aliases as hex code. While ordinary folders open well.
So the main question: is there a way to make this work as I thought via preferences, or any plugin?
Use symbolic links instead by opening Terminal and using ln -s <SOURCE> <ALIAS>.
You can keep any number of folders you want collected in one place by using projects. Simply drag the folders you want, in the order you want, into the sidebar. Then, select Project -> Save Project As... and save the file anywhere you want with the .sublime-project extension. While you're at it, make sure you have
"hot_exit": true
in your user settings, as this enables you to close windows which have a project assigned to them, and all open files and unsaved changes are automatically preserved. When you next open the project, everything will be the same.

Keeping unused files in Xcode project

In Eclipse you can create a folder and name it, say, "unused", to keep currently unused files (incomplete code, resources for future use, etc)
which are ignored by project builder. Can I have something similar with Xcode?
If I move a file to a project folder without inserting it with Xcode, it may be OK, and I will be able to see it while opening in Finder. However, it will be more convenient to have it listed by Project Navigator.
As far as I am concerned, it's not possible. Though, you can comment all of your code in one click to momentarily disable it.
Press command + A;
Right click and select Comment Selection.

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.

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.)

In TextMate, is it possible to create a new file within a project window, without having to save it first?

I have recently switched from my beloved BBEdit to TextMate because of the amazing set of features TextMate's bundles provide.
However, in BBEdit I was able to create a new file within a project window without having to save it first, while TextMate forces me to save the file before going any further. Is there any way to avoid this behaviour?
you can go from the menu with "File/New from template" this will create an Untitled file to the specified template that is not saved. However it is not in the project/project window that you currently have open. But if you think about it that is correct as if the file has not been saved TM would not know where to place it till you save it.
With Textmate 2, you can use File -> New Tab (option + command + N).
Really saving it is the only way.
To save a file in the specific directory tree:
click on the directory you want the new file to be in
press Option+Command+N
now you can Command+S
It will have that directory path.

Resources