Commit Graph

546 Commits

Author SHA1 Message Date
Andrew Borodin
d60e3d5311 filehighlight.ini: add Markdown mkd files to documents. 2022-10-10 21:07:40 +03:00
Andrew Borodin
d9eeec9a5a Port mc.ext to INI format.
Ticket #2773: 'include' keyword (for command class def) have no effect
if it was defined before 'Include' keyword (for command def).

Ticket #3742: update comment in mc.ext.ini.

doc: remove mc.ext.ini format description from manual page.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-09-25 14:55:00 +03:00
Pavel Shumskii
971de9651c Ticket #4059: improve YAML multiline blocks syntax highliting.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-07-09 20:10:31 +03:00
Bogdan Pylypenko
08ab71d49b Ticket #4384: mceditor: add syntax file for Privoxy.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-07-03 15:46:22 +03:00
Andrew Borodin
0bb9c04720 Ticket #4377: file type check does not work with special character in filename.
Initial commit: clarify usage of "file" utility.

  * (get_popen_information): compile conditionally depending on USE_FILE_CMD
macro.
  * (get_file_type_local): likewise.
  * (get_file_encoding_local): likewise.
  * (regex_check_type): likewise.
  * (regex_command_for): ignore type method if file utiliti isn't used.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-06-26 19:57:37 +03:00
Dima Gerasimov
ebbdc8847e Ticket #4369: sqlite 3 view: use 'immutable=1' URI parameter
...to prevent leaving wal/shm files after viewing sqlite database.

The problem I often had with viewing .sqlite files with mc is that
exiting the view mode mid-way may leave .wal/.shm files in the database
directory.

This never caused any actual issues, but a bit annoying, since leftover
.wal files are often a sign that the program working with the database
exited ungracefully.

This effectively reproduces mc's behaviour:

    /tmp/testsqlite $ rm -f *-wal *-shm && sqlite3 "/tmp/testsqlite/db file.sqlite" .dump | head >/dev/null && ls -1 /tmp/testsqlite/
    'db file.sqlite'
    'db file.sqlite-shm'
    'db file.sqlite-wal'

After the change -- no shm/wal files

    /tmp/testsqlite $ rm -f *-wal *-shm && sqlite3 "file:/tmp/testsqlite/db file.sqlite?immutable=1" .dump | head >/dev/null && ls -1 /tmp/testsqlite/
    'db file.sqlite'

You can find the docs on immutable mode here:
https://www.sqlite.org/uri.html#uriimmutable

Immutable mode has been supported in sqlite since 2014:
https://www.sqlite.org/changes.html#version_3_8_5

In case user's sqlite installation is older, the mode is just quietly
ignored, so the change is backwards compatible.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-05-01 09:46:39 +03:00
Andrew Borodin
63e870867e Handle CK_Filter command in the file panel level.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-04-10 17:43:44 +03:00
Zoltan Puskas
9bb705aaba Ticket #4351: file highlighting: add Markdown.
Add markdown into the document highlighting extensions list, since
it's quite popular in many places.

While there are many suggested extensions for the file type[1], this
commit only adds `.md` and `.markdown` as they are the recommended ones
in RFC7763[2] and by the creator themselves[3]. The rest is a hit and
miss anyway, with support highly dependant on the underlying system or
application, and are used infrequently.

[1]https://superuser.com/questions/249436/file-extension-for-markdown-files
[2]https://datatracker.ietf.org/doc/html/rfc7763
[3]https://daringfireball.net/linked/2014/01/08/markdown-extension

Signed-off-by: Zoltan Puskas <zoltan@sinustrom.info>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-03-19 21:04:58 +03:00
Andrew Borodin
cbcda8a284 file highlighting: add PSD graphical format.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-01-16 21:23:31 +03:00
Andrew Borodin
e672a0e72d Ticket #4328: file highlighting: add more graphical formats.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-01-16 16:49:48 +03:00
Alexandros Diamantidis
9bf247805a Ticket #4325: support Shift+Fn keys for KiTTY.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2022-01-05 16:01:01 +03:00
Grzegorz Szymaszek
d0cc71e48a Ticket #4322: add basic DOT/Graphviz syntax highlighting.
DOT is a graph description language, described at
<https://graphviz.org/doc/info/lang.html>. The new syntax file
recognizes the basic language keywords and syntax; known node,
edge, graph, etc. properties; comments; character strings.

The syntax file seems to work well with various DOT files found
in the Linux kernel sources as well as with the MNT Reform 2.0D-4
System Diagram.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-12-20 20:51:43 +03:00
Andrew Borodin
fa0b6f9f93 Ticket #3146: fix typo in skin files: s/scollbar/scrollbar.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-12-18 15:52:33 +03:00
Grzegorz Szymaszek
d5481d2684 Ticket #4319: fix SPICE syntax file to recognize where control script context ends
Since .endc was defined both as the context end delimiter and a context
keyword, it was not recognized as the former and the control script
context, once started, would never be finished. This issue can be
noticed, for example, in wrong syntax highlighting of the .end command
if it was preceded by a control script.

Fix the issue by making the control script context exclusive and
highlighting the .control and .endc keywords in the default context
instead.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-12-05 16:31:41 +03:00
Grzegorz Szymaszek
52d9d7946f Ticket #4316: add basic Ngspice syntax highlighting.
Add basic support for highlighting Ngspice/SPICE (http://ngspice.sourceforge.net/)
circuit description files syntax. Two main contexts are defined:
- the default context, where the circuit is described,
- the control script context (between .control and .endc).

The default context highlights dot commands, circuit element instance
names and model types. The control script context highlights supported
functions/commands and known variables. Both contexts highlight comments
and line continuation marks.

Other than two FIXMEs, it is a known issue the first line of the file is
part of the default context, while in most cases it would contain the
file title.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-12-04 07:13:23 +03:00
Andrew Borodin
a73886ef90 mc.lib: move xterm alt-shift-arrow definitions to lib/tty/key.c.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Andrew Borodin
b6c8f319e9 mc.lib: [terminal:linux] is same as [terminal:console].
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-11-21 15:00:39 +03:00
Ulya Trofimovich
044cd3d806 Ticket #4298: misc.sh; fix view for files
...on systems that have no /bin/cat (like NixOS).

When opening .diff or .patch files mcview invokes /bin/cat. NixOS has no
/bin/cat (the path to cat looks like /run/current-system/sw/bin/cat).
However cat is still in PATH, so replace /bin/cat with just cat. This
should not affect other systems as /bin should normally be in PATH.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-10-30 19:10:11 +03:00
Andrew Borodin
89d8fa4ac1 Ticket #1: remove SMB suport.
The mc's built-in samba library which is used to access data across
smb links is taken from an old samba version.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-09-26 10:03:49 +03:00
Michael Stilkerich
4973eb00bb Ticket #4286: mcedit: fix errors in syntax definitions.
Fixed:
  - use of "grey" instead of "gray" (same for "lightgray");
  - use of space in keywords;
  - typos.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-09-04 18:36:27 +03:00
Andrew Borodin
53b1bb63ac Ticket #4272: nc.ext: fix recognition of plain and compressed man pages.
Support various versions of file utility which output is changed from
one version to another:

$ file --version
file-4.26
magic file from /etc/magic:/usr/share/file/magic
$ file mc.1
mc.1: ASCII troff or preprocessor input text
$ file -z -L mc.1.gz
mc.1.gz: ASCII troff or preprocessor input text (gzip compressed data, was "mc.1", last modified: Tue Aug 24 08:17:47 2021, from Unix)

$ file --version
file-5.40
magic file from /etc/file/magic
eccomp support included
$ file mc.1
mc.1: troff or preprocessor input, ASCII text
$ file -z -L -S mc.1.gz
mc.1.gz: troff or preprocessor input, ASCII text (gzip compressed data, was "mc.1", last modified: Wed Aug 18 04:41:29 2021, from Unix)

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-08-29 19:42:10 +03:00
Tomas Szepe
78f8f97fed Ticket #4273: mc.ext reorganization.
Fix mc.ext breakage caused by c3848a689c.

While reorganizing /etc/mc/mc.ext, the order of rules was changed in the file,
causing a bug where more general matches (e. g. any gzipped file) are made
before more specific ones (e. g. a gzip-compressed manpage).

Fix this by reverting to the original order of rules.

Signed-off-by: Tomas Szepe <szepe@pinerecords.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-08-29 17:12:10 +03:00
sdk
fdf2140bc4 Fixup previous commit.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-08-07 14:50:39 +03:00
sdk
f533b37bf5 Ticket #4267: support of (alt+)shift+arrow keys in st terminal emulator.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-08-04 21:42:54 +03:00
Andrew Borodin
443a9c897b Ticket #4252: change pattern for OpenRC scripts syntax highlighting.
Use an empty patter (^$) that doesn't match any file name. In this
case, only the shebang is used to detect syntax highlighting rules for
OpenRC scripts.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-05-31 09:07:05 +03:00
TerraTech
3d5fadd2bb Ticket #4246: add syntax highlighting for for openrc-run scripts.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-05-29 14:21:10 +03:00
Sergii Pylypenko
3409033c28 filehighlight.ini: highlight .json files as documents.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-05-29 14:08:29 +03:00
Sergii Pylypenko
4be98a52ba Ticket #4250: mcedit: add syntax highlighting for .json files.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-05-29 14:05:48 +03:00
Andrew Borodin
ce9eb8f7d1 Ticket #3375: make hardlink highlighted by file type or extension.
filehighlight.ini: move [hardlink] section to the bottom of the file.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-05-23 10:54:59 +03:00
Piotrek Żygieło
0e023f0dd9 Ticket #4223: fix recognition of JAR files as ZIP archives
Similar to 7881ed2 that solved ticket #4180.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-28 19:30:11 +03:00
Andrew Borodin
c3848a689c Ticket #4180: reorgzanize mc.ext.
$ file -L image.zip
image.zip: Zip archive data, at least v2.0 to extract
$ file -L -z image.zip
image.zip: JPEG image data, JFIF standard 1.01, resolution (DPI),
density 96x96, segment length 16, baseline, precision 8, 1024x768,
frames 3 (Zip archive data, at least v2.0 to extract)

Since in mc.ext

type/^JPEG

is evaluated before

type/\(Zip archive

mc assume image.zip is a image not an archive.

To solve this, since we use "file -z", match file name at first
(regex/ and shell/), then type/.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-28 15:36:42 +03:00
Purdea Andrei
e50a4d0e25 Ticket# 4215: support syntax highlighting for Verilog/SystemVerilog header files.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-03-13 08:12:43 +03:00
Andrew Borodin
4ae6cdb774 Ticket #4167: use mediainfo to view info about various media files.
Thanks korrado <anyhow2@mail.ru> for the issue.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-02-19 16:57:01 +03:00
Andrew Borodin
887bd8fe86 Ticket #4167: clarify e-books support.
mc.ext: add fb2 support.
ext.f/doc.sh.in: change key name for e-books.

Thanks korrado <anyhow2@mail.ru> for the issue.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-02-19 16:53:11 +03:00
Witold Baryluk
b01fea54a7 Ticket #4140: update python.syntax.
Add nonlocal, async, await keywoards.

nonlocal: added in Python 3.0 in 2006:

https://docs.python.org/3.0/whatsnew/3.0.html
https://www.python.org/dev/peps/pep-3104/
https://docs.python.org/3/reference/simple_stmts.html#the-nonlocal-statement

async, await: added in Python 3.5 in 2015:

https://docs.python.org/3.5/whatsnew/3.5.html#what-s-new-in-python-3-5
https://www.python.org/downloads/release/python-350/
https://www.python.org/dev/peps/pep-0492/
https://docs.python.org/3/reference/compound_stmts.html#async-def
https://docs.python.org/3/reference/compound_stmts.html#the-async-for-statement
https://docs.python.org/3/reference/compound_stmts.html#the-async-with-statement
https://docs.python.org/3/reference/expressions.html#await-expression
https://docs.python.org/3/glossary.html#term-coroutine
https://docs.python.org/3/library/asyncio-task.html
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-02-19 16:26:46 +03:00
Marek Černocký
c8649068d3 Ticket #4194: add .c++ and .h++ extensions for highlight.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-02-18 16:52:21 +03:00
Andrew Borodin
7881ed2fda Ticket #4180: fix handling of zip archives.
After 8857423e4e due to
using "file -z", zip archves w/o ".zip" file name extension
(i.e. "ff_ext.xpi", a Firefox extension) aren't handled
as zip archives.

misc/mc.ext.in: fix regular expression for zip format.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2021-01-23 21:10:04 +03:00
Andrew Borodin
1869dffd14 Ticket #4103: code cleanup before 4.8.26 release.
Initial step: rename keymap sections:
  main -> filemanager
  main:xmap -> filemanager:xmap

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-31 16:26:46 +03:00
Marco Ciampa
18a300e64f Fixed reference to Yabasic sintax file 2020-12-28 11:58:15 +01:00
Milan Voves
e6315c1c75 Swift syntax
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-24 16:34:43 +03:00
Dmitry Solomennikov
f815e3593f Ticket #4158: make modarcon16 skin consistent with whitespaces.
Whitespaces (i.e. tabs and trailing spaces) are not consistent with
other parts of skin, they're bright on blue. Makes them green on black
background.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-20 17:55:09 +03:00
Andrew Borodin
662754c6f8 Filehighlight fodg, fodp, fods, fodt, odg as documents.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-20 17:48:49 +03:00
RALOVICH, Kristof
9db7573de9 Ticket #4157: add support for OpenDocument flax xml formats.
Support fodt, fods, fodp, fodg files.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-20 17:44:54 +03:00
Sergei Trofimovich
bad1523378 Ticket #4149: add 'alacritty', 'tmux', 'tmux-256color' as xterm aliases
'alacritty', 'tmux' and 'tmux-256color' all implement Shift+F<N> keys
in an xterm-compatible way. Without this change Shift+F<N> are handled
as F<N-2> key presses.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-12-13 20:18:48 +03:00
Ilia Maslakov
954e83191c Ticket #4130: add PAK archive support for extfs.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-11-08 17:36:36 +03:00
Vadim Kalinnikov
942c5549c9 Ticket #4100: extfs vfs: support of WIM archive (image).
wimtools (https://wimlib.net/) are required.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-10-29 16:58:36 +03:00
Oswald Buddenhagen
8857423e4e Ticket #4128: improve handling of compressed content in mc.ext.
call 'file' with -z switch to enable getting the type of compressed files,
and use that capability extensively.

the /logs?/ hacks in ext.d/text.sh need to remain for the time being, as
file -z doesn't handle .lz4 files as encapsulated content.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-10-12 08:36:09 +03:00
Oswald Buddenhagen
f2cbaf19e5 Relax mc.ext matching rules for makefiles.
match the special cases first, and match makefiles irrespective of
extension. that is useful, as hand-written make-based build systems
often use qualifying suffixes, like .unix.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-10-10 15:56:05 +03:00
Oswald Buddenhagen
335c4eeec6 Replace xmms with audacious in ext.d/shound.sh.
xmms hasn't been maintained for ages. audacious is a maintained fork of
it.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-10-10 15:55:56 +03:00
Oswald Buddenhagen
31e7a7e963 Ticket #4127: several improvements to mc.ext and syntax highlighting.
add plenty of missing 'which' commands in ext.d.

the construct 'if <command>' to check the presence of a command would
work in some cases (though inefficiently), but it others it was just
bogus. in every case it was inconsistent and confusing.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2020-10-10 15:55:42 +03:00