Wrong default syntax highlighting in sublime text 3 - sublimetext3

I can't remember touching any related configuration, and for no reason, Sublime chooses "LaTeX Log" highlighting syntax as default for *.html files. I opened the Syntax Specific settings file and it's empty (?)
What can I do in order to get the proper highlighting for html files automatically?

Changing the syntax highlighting for any file type is easy in Sublime. Simply open a file with the extension you want to change, then click on View -> Syntax -> Open all with current extension as... and choose whichever language you wish. This will add the current extension to the "extensions" list in Packages/User/LanguageName.sublime-settings, where LanguageName is the syntax you chose, such as HTML in this case.

Related

Sublime Text syntax highlighting html files as babel/javascript

Now that I have Babel installed for my React development I noticed that when I open .html files the syntax highlighting is set to javascript (babel) instead of HTML. How can I fix this? Here are also a couple of images that might help. Also a little extra thing, I am using the Afterglow theme for sublime text, and how can I remove the annoying padding on the last image underneath the tabs? You can see a few pixels of space which really annoys me.
You have probably overridden the default language settings for HTML files. You can verify this in the Syntax settings.
Open the View menu
Open the Syntax sub-menu
Open the settings for HTML
If my assumption is true, edit (or delete?) the settings for HTML.
Otherwise, you can assign a syntax to an extension through the same menu.
Open a HTML file
Open the View menu
Open the Syntax sub-menu
Select HTML in the Open all files with current extension as… sub-menu

Is there any shortcut-key in sublime text 3 to change language?

Actually there is an easy way to change language in Sublime Text 3, that's on the bottom right corner. But I need the fast way to change while my hands are on the keyboard. Is there any shortcut-key to change language in Sublime Text 3?
Thank you.
All of the non-hidden syntaxes in Sublime are automatically added to the View > Syntax main menu, which is the same menu that appears when you click on the file type in the bottom of the window. Additionally all syntaxes are added to the Command Palette as commands that start with Set Syntax:.
So the easiest and fastest non-mouse way to swap the syntax on a file is to open the command palette an enter just enough filter text to find and select the command that will swap to your desired syntax, such as in the image below to switch to HTML.
Sublime remembers what command you select for any given command palette input, so for extra speed you can use filter text like sh and manually select the Set Syntax: HTML command that appears to tell Sublime that's the command you want. Now whenever you enter sh it will automatically select that command for you by default.
The set_setting command can be used to set any setting, including the syntax setting, so you could also bind a key to that command to switch easily to an often used syntax. However that requires that you know the full package resource name of the syntax in question and it will not properly set up the syntax specific settings (that requires a plugin that uses view.assign_syntax()).
There may be a package available on package control that provides such a command already, but I'm not aware of any offhand.

Change color of tab characters in Sublime Text 3 theme

I am using the Fortran text highlighting package for ST3, and I am making a theme using this fantastic homepage.
But see the image below. Where there are tab characters within the code (not indentation), those are colored in pink. How can I change that color, or remove it?
In the preferences, default file settings you get this instruction for changing the width and color of indent guides.
// Set to false to turn off the indentation guides.
// The color and width of the indent guides may be customized by editing
// the corresponding .tmTheme file, and specifying the colors "guide",
// "activeGuide" and "stackGuide"
"draw_indent_guides": true,
With some trial and error I found that the property is indeed a variable on this page and it's called Invalid. That is also the name in the .tmTheme file. But on the site there are no such characters in the sample code (that I saw) and the name isn't obviously related to the tab characters in my code.
The pink was in fact the default Invalid color on the theme editor site.
You are supposed to remove those, since they are not supposed to be there. They are referenced as Invalid token which can show signs for deprecation, unreadable code etc. It is supposed to look like:
diff = first - second
and not
diff = first - second
If you really want to overwrite that, you can edit the syntax definition file or overwrite it in your User folder.
Go to Preferences -> Browse Packages -> Fortran -> grammars
Open FortranModern.sublime-syntax or FortranFixedForm.sublime-syntax
Remove the following lines
# tabs are illegal
- match: \t
scope: invalid.illegal.tab.fortran
Done?
PS: A pull request to fix this has already been merged so next builds should be fine

Sublime Text 3 no longer holds SCSS syntax highlighting

My SCSS files keep defaulting to an unfamiliar syntax highlighting for Sublime Text (build 3103). The SCSS package was working up until now.
Recently, Sublime Text displayed a message about one of my packages updating & how my display preferences would be corrupted until I reset Sublime. My sidebar looked weird, so I reset it. This fixed the sidebar, but every time I open an SCSS file its highlighting is wrong.
Things I've tried, in various combinations...
Remove the SCSS package
Quit Sublime Text completely
Delete the Packages/User/SCSS.sublime-settings file
Delete the Cache/SCSS/ directory
Reinstall the SCSS package
Set the syntax automatically with View > Syntax > Open all with current extension as... > SCSS
Set the syntax manually with Sublime Text > Preferences > Settings – More > Syntax Specific – User
How my SCSS.sublime-settings file appears...
/// SCSS.sublime-settings
{
"extensions":
[
"scss"
]
}
EDIT
"... unfamiliar syntax highlighting..."
It is still recognized as an SCSS file (as stated in the bottom right of the editor window). But the highlighting is unfamiliar, as it does not match the highlighting style I have seen for any syntax.
More details...
No color schemes or themes were changed, I quadruple-checked in the settings
How it happened
I was working with SCSS
The update to build 3103 occurred
I reset Sublime Text
The highlighting broke for SCSS (all of the other syntax highlights seem fine)
The closest thing I have found to an answer (which is also what style-nes referenced) is that the 3103 build added a new syntax definition format called .sublime-syntax, which the SCSS probably doesn't account for (looks un-maintained).

Geany - change filetype for individual files

I have a file with extension js.php which is mostly javascript. There's only small php at the top. I'd like to have this file viewed as javascript, not php and unfortunately geany doesn't seem to allow to manually change filetype just by selecting from the list, like most editors do. I tried adding *.js.php to filetype_extensions.conf but it doesn't work, it's still viewed as php. I like Geany and I'm using Linux, so using another text editor is probably not an option.
There is manual solution : After Opening Geany and your file Choose following through the Menu bar
Document
-> Set FileType
-> Scripting Languages
-> Javascript source file

Resources