pertrai1 pertrai1 - 4 months ago 8x
HTML Question

Keymap Sublime Text 2 File Type?

I am working on setting up my own keymaps and was wondering if there is the option to set keys to switch the file type that is being worked on. So for example, if I have a regular plain text file and want it to be a css file, I would have a keymap that would change the document type to css. Possible? If so, please explain to me how you have done this.



While the individual shortcut solution is great, it requires editing the config files and most importantly remembering all the shortcuts you create for each sytax.

In the case of switching file formats it might be more useful to quickly access the required format via the command palette:

  • Press CTRL+SHIFT+P to bring up the Command Palette
  • Type CSS to highlight Set Syntax: CSS command
  • Press ENTER

This is great because it provides quick access to all the formats available. Start typing set syntax... and all the available formats will be shown.