How to associate files with app.? In GNOME.

Howdy! Using GNOME: gnome-terminal 2.18.2 here. QUESTION: How do I associate *txt files to a launcher object I created for Vim on my Desktop? Let's call it "MyVimLauncher". It starts Vim without any files loaded when I click on it. BUT, when I right-click "myfile.txt" to get the menu item "Open with other application", I can't find the object "MyVimLauncher", neither in list "Potential Applications", nor in list "All applications", so as to select it for opening "myfile.txt" and all *txt files. Tried draggin'n dropping the object into the lists, but the object does not get added to lists. Thanks in advance.

I have not tested this but one possible way would be to do something like the following:

touch ~/.local/share/applications/defaults.list

and add the following lines to ~/.local/share/applications/defaults.list

[Default Applications]
text/plain=vim.desktop

The above is a fairly crude association. For finer grained association, you need to use desktop entries. See the Desktop Entry Specification.

1 Like