Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I installed ReText 3.1.3* and all suggested dependencies on Lubuntu 12.10 using apt-get.

If I run touch ~/Desktop/abcd.md, and subsequently double-click on abcd.md in PCManFM or on its icon on the desktop, the file opens with Leafpad.
The same thing happens if I use .mkd or .markdown as the extension. These extensions are among a few listed in /usr/share/mime/packages/x-retext-markdown.xml.
In these three cases, when I right-click on them and look at their properties, they're all "plain text documents".

If I try touch ~/Desktop/abcd.rst or touch ~/Desktop/abcd.rest, these files do open in ReText when double-clicked. These extensions are present in /usr/share/mime/packages/x-retext-rst.xml. These files are of type "reStructuredText document".

The image below illustrates what I see when I right-click on files with .md, .mkd or .markdown extensions (top left), or on files with .rest or .rst extensions (top right). The lower image is the view PCManFM takes of files with .mkd and .rst files.

composite of image showing open with and file manager panel

Even when right-clicking and going into Open With ... followed by the second Open With ... shows basically the same thing. The file with a .mkd extension is seen as a "plain text" file whereas the one with a .rst extension is seen as a reStructured Text file:

Open with images

While it's quite possible that I've unintentionally tweaked something somewhere, can someone set things right for me?

Just to be clear, these files are empty so their content isn't an issue:

[11:10 AM] ~/Desktop $ file abcd*
abcd.markdown: empty
abcd.md:       empty
abcd.mkd:      empty
abcd.rest:     empty
abcd.rst:      empty

The contents of /usr/share/applications/retext.desktop are:

[Desktop Entry]
Version=1.0
Name=ReText
Comment=Simple text editor for Markdown and reStructuredText
Categories=Office;TextEditor;
Exec=/usr/bin/retext %F
Type=Application
Icon=retext
MimeType=text/x-retext-markdown;text/x-retext-rst;

* ReText was updated to 3.1.4 but the issue remains.

share|improve this question
    
When you right click on the file and choose "Properties", do you get a "Open With" tab? –  Seth Feb 16 '13 at 2:55
    
No, under "Properties" in the context menu, there should be a tab labeled "Open With". –  Seth Feb 16 '13 at 3:39
    
Well, at least in Unity.. that's what I want to find out. –  Seth Feb 16 '13 at 3:47
add comment

2 Answers

up vote 6 down vote accepted

You can probably try with mimeopen, which is a tool used to pair a specific mimetype with a particular application.

Use a file with .mkd extension as a parameter of mimeopen.

As an example:

$ mimeopen file.mkd 
Please choose a default application for files of type text/x-retext-markdown

    1) ReText  (retext)
    2) GNU Emacs 23  (emacs23)
    3) gedit  (gedit)
    4) LibreOffice Writer  (libreoffice-writer)
    5) Other...

use application #

Now, enter the number of the application (in this case, 1) and all .mkd files should now open in Retext.

share|improve this answer
    
This worked perfectly. Thanks, I appreciate your guidance :) –  user25656 Feb 18 '13 at 14:31
add comment

You should be able too (I can after a quick LXDE install) right click on a file and choose "Properties".

enter image description here

There should (according to what I find) be a tab called "Open With".

enter image description here

Select "ReText" and then "Set as Default". That worked for me.

share|improve this answer
    
Not if you set this on a .md, .mkd, .mkdwn, etc. –  Seth Feb 16 '13 at 4:18
    
@vasa1 I have tried. It opens some, but not all... kinda weird. –  Seth Feb 16 '13 at 4:25
    
I wonder if Ubuntu treats files differently than Windows does with extensions... –  Seth Feb 16 '13 at 4:29
    
File association in a Desktop Environment is specified by Open Desktop (XDG), which Ubuntu participates in and adheres to. It uses mime-types, and since most mime-types have at a glob parameter which is usually a file extension, the end result is that Ubuntu does treats files just like Windows. If not better, since Ubuntu, also as part of XDG mine spec, also "sniff" files for their digital signature ("magic numbers") to determine mime type when an unknown file extension is found, something, IIRC, Windows does not. –  MestreLion Mar 17 '13 at 20:51
    
Wow. Thanks for the info @MestreLion. –  Seth Mar 17 '13 at 20:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.