LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-10-2014, 03:34 PM   #1
thealmightyos
Member
 
Registered: Mar 2009
Distribution: CentOS 6.5 / 7
Posts: 119

Rep: Reputation: 1
Create new mimetype to be opened by nano (CentOS 6.5)


(before anyone asks, no I do not want to use emacs or any other editor you personally like. Thank you.)

Now that we have that out of the way:

I am running CentOS 6.5. I have used my strongest google-foo however despite my efforts I have not been able to find a usable answer.

I have some text files that I have edited the extension to .work to designate files that I want to be opened in nano by default. I have tried the "open as" option in gnome (command: gnome-terminal -e nano) but that only opens nano with a new buffer. Sites I have found say to make a new mimetype or edit exsting mimetypes with mimeopen, but it seems that command is not available and attempts to install it (yum install mimeopen) reward me with "no package available" message.

Can someone point me in the right direction?
 
Old 03-11-2014, 10:17 AM   #2
heinblöd
Member
 
Registered: May 2004
Location: France
Distribution: Slackware Gentoo
Posts: 186

Rep: Reputation: 31
on gentoo mimeopen is coming from File-MimeInfo (perl stuff) but maybe you shoudn't invent a new mime-type but use nano as default editor in your console. Search for the EDITOR or VISUAL enviroment variable and set it to nano. (With it's full path like /bin/nano)

If you want a mime type it should be enough to add it to /etc/mime.types or whatever you have on CentOs

Also have a look at the xdg commands as xdg-open, xdg-mime or xdg-settings

Last edited by heinblöd; 03-11-2014 at 10:19 AM.
 
Old 03-11-2014, 11:56 AM   #3
thealmightyos
Member
 
Registered: Mar 2009
Distribution: CentOS 6.5 / 7
Posts: 119

Original Poster
Rep: Reputation: 1
Thanks for the reply. I have tried every way I can think of to get text files to open with nano and all I get is ether a new buffer (nano doesn't open the file in question) or nothing happens at all (nano was not started).

I did some heavy digging and found these resources last night:
http://www.linuxtopia.org/online_boo...ktopentry.html
http://www.linuxtopia.org/online_boo...ource-xml.html
http://www.linuxtopia.org/online_boo...gistering.html
http://www.linuxtopia.org/online_boo...modifying.html

With the information I found within these pages I created a nano.desktop file, created another mimetype "text/work" and associated the new mimetype with nano through the defaults.list file. Now when I click on a .work file nano will open it. And while I was routing around in the defaults.list file I changed nano to the default viewer of html, php, sh, and xml. Now I can use nano for all my programming needs.

If there is more information you would like me to share let me know. Otherwise this thread can be closed
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] sudo: nano: command not found on CentOS DextrousDave Linux - Server 4 07-07-2013 06:26 AM
[SOLVED] Create Default Path When Terminal Is opened hitmen Linux - Newbie 10 08-31-2011 02:06 AM
mkisofs: create iso with menus that can be opened with gxine 1veedo Linux - Software 4 06-28-2009 06:00 PM
FAM monitoring file opened/create/copy laikos Programming 0 03-07-2004 02:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration