LinuxCommandLibrary

mg

Edit text files

TLDR

Open a file for editing

$ mg [path/to/file]
copy

Open a file at a specified line number
$ mg +[line_number] [path/to/file]
copy

Open files in a read-only mode
$ mg -R [path/to/file1 path/to/file2 ...]
copy

Disable ~ backup files while editing
$ mg -n [path/to/file]
copy

SYNOPSIS

mg [options] [file...]

PARAMETERS

-d
    Dump the terminal capabilities used.

-f
    Run in a single frame (no window support).

-l loadfile
    Load the specified lisp file.

-n
    No .mg initialization file execution.

-q
    Quiet startup (no startup message).

-s
    Run in single-screen mode.

-t term
    Specify terminal type explicitly.

+[line_number] filename
    Open the file at a specified line number.

file...
    Files to open for editing.

DESCRIPTION

mg, formerly known as MicroGnuEmacs, is a small, self-contained, and easy-to-use text editor that closely mimics the behavior of GNU Emacs. It's designed for systems with limited resources or where a full-fledged Emacs installation is impractical. It is suitable for basic text editing, programming, and system administration tasks. mg strives to be compatible with Emacs, allowing users familiar with Emacs keybindings and concepts to quickly adapt. However, it intentionally omits many of the more advanced or less frequently used features of GNU Emacs to maintain a smaller footprint and faster startup time. While it lacks the extensive customization options and Lisp extensibility of Emacs, it provides a practical and efficient editing experience for many users.
It should not be confused with the modern modal editor known as Helix.

CAVEATS

mg lacks the full extensibility of GNU Emacs and has limited support for complex features such as X Window System integration in some versions. The feature set can vary slightly depending on the specific distribution and version of mg.

KEYBINDINGS

mg strives for compatibility with standard Emacs keybindings. Common commands like Ctrl-x Ctrl-s (save), Ctrl-x Ctrl-c (exit), and Ctrl-g (cancel) generally work as expected. Consult the mg documentation or press Ctrl-h for help within the editor to see a list of available commands.

HISTORY

mg originated as MicroGnuEmacs, designed to be a compact Emacs clone. It was intended for use on smaller systems and embedded devices where resources were limited. Over time, it has been maintained and improved by various contributors, evolving into a lightweight and efficient text editor.

SEE ALSO

emacs(1), vi(1), nano(1)

Copied to clipboard