How do I set kile as the default application for .tex files?

Solution 1:

The answer given by Yusuf is correct but in my case it was incomplete. Since I had no Kile.desktop file in my /usr/share/applications (the .desktop association is hidden, as Cumulus007 points out), I had to create it and simply writing Exec=kile %F isn't enough. This is what I put inside the Kile.desktop file I created using Yusuf's instructions:

[Desktop Entry]
Name=Kile
Comment=LaTeX front end
Exec=kile %f
Terminal=false
Icon=/usr/share/pixmaps/kile.xpm
Type=Application
Categories=Office;Database
MimeType=text/x-bibtex

This finally allowed me to select Kile as the default application to open .tex files.

Solution 2:

Open the application desktop file in /usr/share/applications and check if the "Exec" line end with this value: "%F". If that is not the case, then you'll have to append this value to this line. Here is the command used to edit the desktop file:

gksu gedit /usr/share/applications/<filename>.desktop

change the exec line from

Exec=kile

to

Exec=kile %F

and then Kile appears in the list.