Note
The UTF-8 release: multibyte text can now be typed, displayed, and edited in UTF-8 locales. Also new: syntax highlighting, a visible region, and side by side windows.
Changes
- Initial UTF-8 support, active in UTF-8 locales:
- Multibyte characters display as single characters, cursor motion and delete operate on whole characters, and files always round trip byte for byte
- Limitations, see mg(1): every character is drawn one column wide, mini-buffer editing is still byte-wise, case folding is ASCII only
- 8-bit character input works out of the box:
meta-key-modeis now disabled by default, use(meta-key-mode 1)in~/.mgto get the old behavior back. Terminals that send Meta as an ESC prefix, which is all of them these days, are unaffected - Character class table updated from DEC multinational to Latin-1: word motion, case conversion, and case-insensitive search now treat Ð, Þ, ð, þ as letters, and no longer the × and ÷ signs
- Visual mark mode: the region between mark and dot is drawn in reverse video, like transient-mark-mode in GNU Emacs. New command
visual-mark-modetoggles it, enabled by default - Shift and the arrow keys mark text, like in GNU Emacs, by word and paragraph with control held too. The first unshifted command drops the selection; a mark set with
C-SPCis left alone - Syntax highlighting of comments, strings, keywords, types, numbers, and preprocessor directives in buffers with a language mode, such as
c-mode. New commandfont-lock-modetoggles it, enabled by default. Terminals without color show plain text. C and C++ files enablec-modeautomatically - New command
shell-script-modewith shell highlighting rules: POSIX reserved words, builtins, and$variables. Also sets tab width 8 with hard tabs, for here documents, and RET keeps the indent. Enabled automatically for *.sh files and files with a #! line naming a Bourne compatible shell - New command
python-modewith python highlighting rules: comments, strings including the triple-quoted kind, keywords, built-ins, and decorators. Also sets four column indent steps with spaces only, RET keeps the indent, and TAB indents like the previous line, one level deeper after a colon; TAB again steps back one level at a time and wraps around. Enabled automatically for *.py files and #! lines naming python - New command
markdown-modewith highlighting rules for the common markdown core: headings, fenced and indented code blocks, block quotes, horizontal rules, list markers, inline code, emphasis, and links. Headings are drawn in bold. Enabled automatically for *.md and *.markdown files - New command
split-window-horizontally, bound toC-x 3like GNU Emacs: side by side windows, freely mixed withC-x 2 - Resizing the terminal grows or shrinks the focused window; the other windows keep their size and move. Pop-ups like the quick
help no longer swallow the new rows, and side by side layouts survive width and height changes - New command
balance-windows, bound toC-x +like GNU Emacs: evens out the window sizes in any layout, heights and widths alike; the quick help pop-up keeps its height - Move between windows with Meta and the arrow keys: new commands
windmove-up,-down,-leftand-rightselect the window in that direction, like windmove in GNU Emacs.M-leftandM-rightno longer do word motion;C-leftandC-rightstill do - Resize windows with Meta, Shift and the arrow keys: the window divider travels with the arrow. Also new: GNU Emacs' commands
enlarge-window-horizontallyandshrink-window-horizontally, onC-x }andC-x { - Pop-up buffers, like the quick help, open below the current window instead of replacing the other one in side by side layouts. The quick help is dismissed with
qand no longer disturbs the window layout when closed - New command
require-final-newline <nil | T | ask> - New command
use-short-answers: a single y or n answers important questions. Enabled by default, unlike GNU Emacs; get the strict behavior back withuse-short-answers 0in~/.mg. From PR #37 by Glubbfreund - The startup help text in the echo line is dismissed on the first key press, or after ten seconds. Keep the old always-on behavior with
display-help-mode 1in~/.mg - Smart TAB in c-mode and shell-script-mode: TAB indents the current line, or every line in the region when the mark is active, like in GNU Emacs. Shell scripts indent like the previous non-blank line
M-qreflows one list item at a time instead of the whole list, with continuation lines aligned under the item text, and refills block quotes keeping the > prefix. Paragraph motion, mark and kill treat list items as paragraphs tooM-g gandM-g M-grun goto-line, like GNU Emacs 22 and later. The oldC-x gbinding remains- Dired: new command
dired-up-directory, bound to^, also used bydired-jump, from OpenBSD C-u M-!andC-u M-|insert the shell command output in the current buffer instead of a separate one, from OpenBSD- C-mode: respect user defined tab width in indentation, by Daniel Hennigar
- Mg tutorial updated and converted to Markdown format
- Support
+LINE:COLUMN FILEstartup postion, by Delyan Angelov - The mini-buffer now displays the initial help text for 10 seconds, or until the user starts typing. Also, the cursor is now shown in the main edit window instead of the mini-buffer
Fixes
- Sync with OpenBSD, as of March 2026:
- Fix
replace-regexplooping forever on(replace-regexp "^.*$" "")and replacing anchored patterns more than once per line - Saving the
*scratch*buffer no longer prompts for a file path when there are no changes to save - Plug memory leaks in the interpreter and word handling routines, from Han Boetes
- Handle
strdup()failure in several places, from Han Boetes - Fix wrongly sized externs, found by Gentoo building with
-flto - Fix
auto-indent-modewith custom tab widths
- Fix
- Fix build with dired disabled
- Fix missing mini-buffer help texts