Post Made Community Wiki by don_crissti
source | link

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


with the following content:

<?xml version="1.0"?>
 <mime-info xmlns=''>
  <mime-type type="text/html">
    <comment>twig template files</comment>
    <glob pattern="*.twig"/>

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