.config/mc/mc.ext
author Oleksandr Gavenko <gavenkoa@gmail.com>
Wed, 29 Mar 2023 23:42:06 +0300
changeset 1018 831e2c1bf980
parent 959 25d27dfee90e
permissions -rw-r--r--
Completed migration from ~/devel to ~/work.

# -*- mode: conf -*-
#
# All lines starting with # or empty lines are thrown away.
# Lines starting in the first column should have following format:
#
# keyword/descNL, i.e. everything after keyword/ until new line is desc
#
# keyword can be: 
#
#    shell (desc is, when starting with a dot, any extension (no wildcars), 
#          i.e. matches all the files *desc . Example: .tar matches *.tar;
#          if it doesn't start with a dot, it matches only a file of that name)
#
#    regex (desc is an extended regular expression)
#          Please note that we are using the GNU regex library and thus
#          \| matches the literal | and | has special meaning (or) and
#          () have special meaning and \( \) stand for literal ( ).
#
#    type  (file matches this if `file %f` matches regular expression desc
#          (the filename: part from `file %f` is removed))
#
#    directory (matches any directory matching regular expression desc)
#
#    include (matches an include directive)
#
#    default (matches any file no matter what desc is)
#
# Other lines should start with a space or tab and should be in the format:
#
# keyword=commandNL (with no spaces around =), where keyword should be: 
#
#    Open (if the user presses Enter or doubleclicks it), 
#
#    View (F3), Edit (F4)
#
#    Include is the keyword used to add any further entries from an include/
#    section
#
# command is any one-line shell command, with the following substitutions:
#
# %% -> % character
# %p -> name of the current file (without path, but pwd is its path)
# %f -> name of the current file. Unlike %p, if file is located on a
#   non-local virtual filesystem, i.e. either tarfs or ftpfs,
#   then the file will be temporarily copied into a local directory
#   and %f will be the full path to this local temporal file.
#   If you don't want to get a local copy and want to get the
#   virtual fs path (like /#ftp:ftp.cvut.cz/pub/hungry/xword), then
#   use %d/%p instead of %f.
# %d -> name of the current directory (pwd, without trailing slash)
# %s -> "selected files", i.e. space separated list of tagged files if any
#       or name of the current file
# %t -> list of tagged files
# %u -> list of tagged files (they'll be untaged after the command)
#
# (If these 6 letters are in uppercase, they refer to the other panel.
# But you shouldn't have to use it in this file.)
#
#
# %cd -> the rest is a path mc should change into (cd won't work, since it's
#   a child process).  %cd handles even vfs names.
#
# %view -> the command you type will be piped into mc's internal file viewer
#   if you type only the %view and no command, viewer will load %f file
#   instead (i.e. no piping, so it is different to %view cat %f)
#   %view may be directly followed by {} with a list of any of
#   ascii (Ascii mode), hex (Hex mode), nroff (color highlighting for
#   text using backspace for bold and underscore) and unform
#   (no highlighting for nroff sequences) separated by commas.
#
# %var -> You use it like this: %var{VAR:default}.  This macro will expand
#       to the value of the VAR variable in the environment if it's set
#       otherwise the value in default will be used.  This is similar to
#       the Bourne shell ${VAR-default} construct.
#
# Rules are applied from top to bottom, thus the order is important.
# If some actions are missing, search continues as if this target didn't
# match (i.e. if a file matches the first and second entry and View action
# is missing in the first one, then on pressing F3 the View action from
# the second entry will be used. default should catch all the actions.
#
# Any new entries you develop for you are always welcome if they are
# useful on more than one system.  You can post your modifications
# as tickets at www.midnight-commander.org

################################################################
# Image.

shell/.xcf
	Open=(gimp %f &)

type/^GIF
	Include=image
type/^JPEG
	Include=image
type/^PC\ bitmap
	Include=image
type/^PNG
	Include=image
type/^TIFF
	Include=image
type/^PBM
	Include=image
type/^PGM
	Include=image
type/^PPM
	Include=image
type/^Netpbm
	Include=image
shell/.xbm
	Open=bitmap %f
shell/.xpm
	Include=image
	# View=sxpm %f
shell/.ico
	Include=image

include/image
    Open=gpicview %f &
    View=%view{ascii} identify %f
    Edit=gimp %f 2>/dev/null &

################################################################
# Audio.

regex/\.([wW][aA][vV]|[sS][nN][dD]|[vV][oO][cC]|[aA][uU]|[sS][mM][pP]|[aA][iI][fF][fF]|[sS][nN][dD])$
    Include=audio
regex/\.([mM][pP]3)$
    Include=audio

include/audio
    Open=vlc %f&

################################################################
# Video.

regex/\.([wW][mM][vV])$
    Include=video
regex/\.([fF][lL][iIcCvV])$
    Include=video
regex/\.([mM][pP]4|[mM][pP][eE]?[gG])$
    Include=video
regex/\.([aA][vV][iI])$
    Include=video
regex/\.(3[gG][pP])$
    Include=video
regex/\.([aA][sS][fFxX])$
    Include=video
regex/\.([dD][iI][vV][xX])$
    Include=video
regex/\.([mM][kK][vV])$
    Include=video
regex/\.([mM][oO][vV]|[qQ][tT])$
    Include=video
# MPEG-2 TS container + H.264 codec
regex/\.([mM][tT][sS])$
    Include=video
regex/\.([vV][oO][bB])$
    Include=video
regex/\.([wW][mM][vV])$
    Include=video
regex/\.([oO][gG][mM])$
    Include=video
regex/\.([mM]4[vV])$
    Include=video

include/video
    Open=mplayer %f
    # Open=vlc %f

################################################################
# Plain and binary documents.

# GNU Info page
type/^Info\ text
    Open=info -f %f
shell/.info
    Open=info -f %f

type/^PDF
    Include=my-pdf
regex/\.[pP][dD][fF]
    Include=my-pdf
type/^DjVu
    Include=my-pdf
shell/.djvu
    Include=my-pdf

include/my-pdf
	Open=zathura %f 2>/dev/null &

type/^MS\ Windows\ 3.x\ help\ file
    Open=wine winhlp32 %f 2>/dev/null &
regex/\.[cC][hH][mM]
    Include=my-chm
shell/^MS\ Windows\ HtmlHelp
    Include=my-chm
include/my-chm
    Open=wine hh %f || xchm %f &
shell/.fb2
    Open=ebook-viewer %f 2>/dev/null &
shell/.epub
    Open=ebook-viewer %f 2>/dev/null &
shell/.lit
    Open=ebook-viewer %f 2>/dev/null &
shell/.mobi
    Open=ebook-viewer %f 2>/dev/null &
shell/.azw3
    Open=ebook-viewer %f 2>/dev/null &
type/^Mobipocket\ E-book
    Open=ebook-viewer %f 2>/dev/null &
regex/\.([rR][tT][fF])$
    Open=ebook-viewer %f 2>/dev/null &
    View=%view{ascii} catdoc -w %f

regex/\.[sS]?[hH][tT][mM][lL]?$
    Open=see %f 2>/dev/null &

regex/\.[Dd][Oo][Cc][Xx]?$
	Open=see %f >/dev/null 2>&1 &
regex/\.[Xx][Ll][Ss][xX]?$
    Include=my-msword
shell/.docx$
    Include=my-msword
regex/\.([Dd][oO][cCtT]|[Ww][rR][iI])$
    Include=my-msword
type/^Microsoft\ Word
    Include=my-msword
type/^Microsoft\ Office\ Document
    Include=my-msword
include/my-msword
	Open=see %f >/dev/null 2>&1 &
	View=%view{ascii} antiword -t %f || catdoc -w %f || word2x -f text %f - || strings %f

################################################################
# Build rules.

# Makefile
regex/[Mm]akefile$
    Open=make -f %f %{Enter parameters}
# Imakefile
shell/Imakefile
    Open=xmkmf -a
# Makefile.PL (MakeMaker)
regex/^Makefile.(PL|pl)$
    Open=%var{PERL:perl} %f

################################################################
# Open in Emacs.

default/*
    Open=file %f
    Edit=e %f

regex/\.([cC][cC]?|[cC][pP][pP]|[cC][xX][xX])$
    Open=e %f
    # Open=sensible-editor %f
    #Open=%var{EDITOR:vi} %f
regex/\.([hH]|[hH][pP][pP])$
    Open=e %f
regex/\.(s|S|[aA][sS][mM])$
    Open=e %f
shell/.java
    Open=e %f
shell/.f
    Open=e %f
shell/.py
    Open=e %f
shell/.[lL][iI][sS][pP]
    Open=e %f
shell/.el
    Open=e %f
regex/\.(sh|bash|tcsh)$
    Edit=e %f
regex/\.[Tt][Ee][Xx]$
    Open=e %f
regex/\.(te?xi|texinfo)$
    Open=e %f

################################################################
# Object files.

regex/\.(o|obj)$
    View=%view{ascii} file %f && nm %f
regex/\.(so|so\.[0-9\.]*)$
    View=%view{ascii} file %f && nm -C -D %f
type/^ELF
    View=%view{ascii} file %f && nm -C %f
shell/.class
    View=%view{ascii} tmp=%p; javap -v -p -c ${tmp%%.class}

################################################################
# Wine. Windows executable.

regex/\.[eE][xX][eE]$
    Open=wine %f &
    View=%view{ascii} i586-mingw32msvc-objdump -fx %f || i686-w64-mingw32-objdump -fx %f
regex/\.[mM][sS][iI]$
    Open=msiexec /i %f &

regex/\.[dD][lL][lL]$
    View=%view{ascii} i586-mingw32msvc-objdump -tTrR -fx %f || i686-w64-mingw32-objdump -tTrR -fx %f

################################################################
# Game/console ROMs.

shell/.nes
    Include=nesgame
type/^iNES ROM dump
    Include=nesgame
include/nesgame
    Open=nes %f 2>/dev/null 1>/dev/null &
	View=%view{ascii} file %f

shell/.smc
    Include=snesgame
shell/.sfc
    Include=snesgame
shell/.swc
    Include=snesgame
shell/.mgd
    Include=snesgame
shell/.mgh
    Include=snesgame
include/snesgame
    Open=mednafen %f 2>/dev/null 1>/dev/null &
    # Open=zsnes -v 8 %f &
	View=%view{ascii} file %f

type/^Sega MegaDrive/Genesis raw ROM dump
    Include=segagame
include/segagame
    Open=mednafen %f 2>/dev/null 1>/dev/null &
	View=%view{ascii} file %f

shell/.n64
    Include=n64game
include/n64game
    Open=mupen64plus --windowed --resolution 800x600 --emumode 2 %f &
	View=%view{ascii} echo I am thinks that %f is a Nindendo 64 rom...

################################################################
# Misc, tutorial, help rules.

shell/.my
    Open=tmp=%f; echo ${tmp%.my} %f %{Enter opt:} %{Enter file:}