zyedidia / micro

A modern and intuitive terminal-based text editor
https://micro-editor.github.io
MIT License
25.26k stars 1.18k forks source link

[Solved] Setting filetype does not change syntax highlighting. HINT: fileTYPE not fileEXT #3537

Closed GenuineSounds closed 1 week ago

GenuineSounds commented 1 week ago

Problem

Manually setting the filetype from the default unknown to sh on a script that does not use a file extension nor use the standard #! /bin/sh header doesn't change the colors and other syntax highlighting.

Solution

Please set filetype shell not the file extension set filetype sh.

Comments

set filetype X does not mean treat this file as if it were file.X as I had thought at first glance of the setting.

There wasn't really a straightforward way to search for extension -> filetype that micro would have used (although it's quite obvious) but to open another script and double check the values it was producing for micro to use.

I'm posting this here for hopefully easier troubleshooting for others. I didn't find any results while troubleshooting (probably nobody else is quite as bad at their Google-fu than I). So perhaps this will show up in the results for others.