Post Made Community Wiki by don_crissti
1
source | link

Use freedesktop's unified system to define a new association.
Write a new source xml file e.g.

~/.local/share/mime/packages/text-twig.xml

with the following content:

<?xml version="1.0"?>
 <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
  <mime-type type="text/html">
    <comment>twig template files</comment>
    <glob pattern="*.twig"/>
  </mime-type>
 </mime-info>

then update your mime database

update-mime-database ~/.local/share/mime

and you're all set.


The above will alter *.twig files mime type for your current user. For a global change follow the same procedure replacing all occurrences of ~/.local with /usr