Switching syntax?


#1

Is there currently a way to switch syntax modes?

For example, if I’m in a YAML file that doesn’t end in .yml, can I manually switch the syntax?


Select language shortcut
Change default JavaScript build behavior
#2

In the lower left corner of your editor window (not including the folder pane) There are a few pieces of info.
Filename, Line, Position, and Syntax.

Click Syntax to choose one/change the current one.


#3

Here’s a screenshot for clarity!


#4

You can also use ctrl-shift-L to bring up the chooser.


#5

I would really like to see this get added in the command palette, like is done in Sublime Text. In Sublime, I don’t need to know the shortcuts I don’t use regularly because I can just search for the command. I’ve become accustomed to ⌘⌃P “syntax python”.


#6

It is in the command pallete. It’s called “Grammar Selector: Show”.


#7

I think a clearer name would be beneficial – actually, I don’t see anything wrong with Sublime’s way of having one command per syntax (named Set Syntax: …).


#8

I think it’s a lot nicer to be able to just type something and hit enter than have to go through a second selector window.


#9

I may just be missing it, but is there a way to set the default syntax?


#10

I think the real issue here might be that Atom seems fairly unique in that what most people call ‘syntax highlighting’, Atom calls ‘grammar’. I have to search for this every time because I’m constantly forgetting what it’s called in Atom. I get it that Grammar is a more semantically rich term that better describes what’s going on, but some pointers in the UI for people coming across from other editors might be helpful.


#11

I created the set-syntax package months ago to solve this problem for people.


#12

When this gets over 10,000 installs they should seriously consider making this default.


#13

You are a hero. I was looking for this shortcut forever! Thank you!


#14

Is there a reason not to make this even appear in the command palette by default? According to Atom’s documentation:

You can use the Command Palette to look up the correct keybindings if it doesn’t work for some reason.

This search-driven menu can do just about any major task that is possible in Atom. Instead of clicking around all the application menus to look for something, you can just hit cmd-shift-P and search for the command.

Doesn’t seem to live up to that promise so far. I hope you guys can put it in the roadmap.


#15

The grammar selector command is in the Command Palette by default:

This pops up a menu that allows you to select the grammar you want.


#16

Thanks! I didn’t thought of ‘grammar’ :stuck_out_tongue:


#17

Any way we could alias that command to show up for users typing “syntax” or “language”? I never would have thought of using the term “grammar” to refer to that command.


#18

I just had to spend several minutes searching for this capability. I hit CMD + SHIFT + P, then typed “syn” to search for “syntax,” just like in Visual Studio Code. Unfortunately, Atom has decided to call it “grammar” instead, which is just confusing.

Please add the keyword “syntax” to the Grammar Selector. It’s obvious that quite a few people want this.

Cheers,
Trevor Sullivan
Microsoft MVP: PowerShell


#19

Just like yourself, I have to search for this every time, because Atom chooses to call it “Grammar” instead of what everyone else calls it: “syntax highlighting.”

This is one of those issues that seems like it should be “nipped in the bud.” Small change, but has a big impact on user experience.

Cheers,
Trevor Sullivan
Microsoft MVP: PowerShell


#20

Even this window I am typing in to make this comment uses “Switching syntax?” to switch syntax!

+1 vote to change this daily annoyance with atom.