Skip to content

Improve the syntax documentation #3734

@mc-butler

Description

@mc-butler

Important

This issue was migrated from Trac:

Origin https://midnight-commander.org/ticket/3734
Reporter mooffie (@mooffie)

There are several features not documented well, or not documented at all:

[I'll edit this text from time to time to improve and extend it. Everybody: feel free to add comments and I'll incorporate them here. When we're finished we'll convert this to nroff format.]

Star

Matches any length of characters (except newline). To be exact, it matches any character which is not the next one in the pattern. This effectively makes it "non-greedy" and lets you do ${*} to match a shell variable.

Plus

Surprisingly, it does not mean "match 1 or more characters". TODO.

Braces

\{chars\} matches one character.

Brackets

\[chars\] matches 0 or more characters. It's greedy, which means that if chars contains any of the characters appearing later in the pattern then the match will fail. (TODO: what's the purpose of "if (p[1] == d) i--;" introduced in commit df20f28 ?)

Misc

  • Pressing C-s twice effectively reloads the syntax file (so you don't have to exit the editor, or MC itself, to test your syntax modifications).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: docsImprovements or additions to documentationprio: mediumHas the potential to affect progress

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions