Configure Midnight Commander to open files with custom application

颜均
2023-12-01

https://ubuntuincident.wordpress.com/2010/12/08/configure-mc-open-files/

http://www.cyberciti.biz/tips/midnightcommander-set-vi-as-default-editor-viewer.html


Problem

You use Midnight Commander (mc) for all your file operations. So far it’s not a problem :) However, when you hit Enter on a file, you would like to set what application mc should use for opening the given file.

For instance, you want to open an .avi file with VLC instead of X player, etc.

Solution

Steps to follow:

1
2
3
cd ~/.mc
cp /etc/mc/mc .ext .
ln -s mc.ext bindings

That is, copy the global mc.ext to your local .mc directory and put a symbolic link on it calledbindings. Now you can start customizing your local mc.ext file.(other method to edit the config:Press F9 (or Esc followed by 9) to active the top menu. From command menu → select “Edit extension file” men-item )

Don’t forget to restart mc after editing mc.ext!

Examples:

(1) You want to open all your video files with VLC. You also want to add support for .wmv files.

1
2
3
4
5
6
7
8
# add these lines
regex/\.([wW][mM][vV])$
     Include=video
 
# modify the include/video section
include /video
     #Open=(mplayer %f >/dev/null 2>&1 &)   # for mplayer
     Open=(vlc %f > /dev/null 2>&1 &)   # for VLC

(2) Open .docx files with OpenOffice.org.

1
2
3
# add these lines
regex/\.([Dd][oO][cC][xX])$
     Open=(ooffice %f &)




 类似资料:

相关阅读

相关文章

相关问答