Rechercher une page de manuel
mg
Langue: en
Version: 315271 (ubuntu - 07/07/09)
Section: 1 (Commandes utilisateur)
BSD mandoc
NAME
mg - emacs-like text editorSYNOPSIS
mg [-n ] [-f mode ] [+ number ] [file ... ]DESCRIPTION
mg is intended to be a small, fast, and portable editor for people who can't (or don't want to) run the real emacs for one reason or another, or are not familiar with the vi(1) editor. It is compatible with emacs because there shouldn't be any reason to learn more editor types than emacs or vi(1).The options are as follows:
- + number
- Go to the line specified by number (do not insert a space between the "+" sign and the number). If a negative number is specified, the line number counts backwards from the end of the file i.e. +-1 will be the last line of the file, +-2 will be second last, and so on.
- -f mode
- Run the mode command for all buffers created from arguments on the command line, including the scratch buffer and all files.
- -n
- Turn off backup file generation.
KEY BINDINGS
Normal editing commands are very similar to Gnu Emacs. In the following examples, ^X means control-X, and M-X means Meta-X, where the Meta key may be either a special key on your keyboard or the ALT key; otherwise ESC followed by the key X works as well.- ^F
- Forward character.
- ^B
- Backwards character.
- ^N
- Next line.
- ^P
- Previous line.
- ^A
- Start of line.
- ^E
- End of line.
- ^D
- Delete current character.
- ^S
- Interactive search forward.
- ^R
- Interactive search backwards.
- M-%
- Interactive search-and-replace.
- ^O
- Open a new line at cursor position.
- ^T
- Transpose characters.
- ^U
- Repeat next command 4 times (can be cascaded i.e. ^U^U^F will move 16 characters forward).
- ^K
- Kill to end of line (placing into kill buffer).
- ^Y
- Yank kill buffer into current location.
- ^SPC
- Set mark.
- ^W
- Kill region (cuts from previously set mark to current location, into kill buffer).
- M-W
- Copy region (into kill buffer).
- ^V
- Next page.
- M-V
- Previous page.
- M-<
- Start of buffer.
- M->
- End of buffer.
- ^X^C
- Save buffers and quit.
- ^X-O
- Next window.
- ^X-N
- Next window.
- ^X-P
- Previous window.
- ^X-U
- Undo.
- ^_
- Undo.
For more key bindings, type ``M-x describe-bindings''
CONFIGURATION AND COMMANDS
Amongst other major differences, the mg configuration files are much simpler than real emacs. There are two configuration files, .mg and .mg-TERM Here, TERM represents the name of your terminal type; e.g., if your terminal type is set to ``vt100'' mg will use .mg-vt100 as a startup file. The terminal type startup file is used first. The startup file format is a list of commands, one per line, as used for interactive evaluation, e.g.:auto-fill-mode set-fill-column 72 global-set-key "\^x\^f" find-file
Here's another example sequence that you may find useful. By default, ``()'' and ``[]'' are recognized as brackets, so bracket matching can be done. The following defines ``{}'' as brackets, and turns on the mode that causes the cursor to "blink" to show you matching brackets.
global-set-key } blink-matching-paren-hack blink-matching-paren set-default-mode blink
More complicated key mappings are also possible, though there are some internal limitations compared to regular emacs. An example of how to map control characters and sequences follows, illustrating the Gosling-like line scrolling characters.
global-set-key "\^Z" scroll-one-line-up global-set-key "\ez" scroll-one-line-down global-set-key "\^_" suspend-emacs
You can use auto-execute like GNU Emacs' auto-mode-alist and foo-mode-hook variables.
auto-execute "*.c" auto-indent-mode auto-execute "/tmp/mutt-*" mail-mode
In order to use 8-bit characters, the Meta key needs to be disabled. This is required to read high bit characters like German umlauts. ESC can be used instead of the Meta key - see the Sx KEY BINDINGS section for details. Execute the following command or add it to .mg to disable the Meta keys on startup:
meta-key-mode
As in Emacs, comments begin with a semicolon and continue to end of line.
FILES
- ~/.mg
- normal startup file
- ~/.mg-TERM
- terminal-specific startup file
SEE ALSO
vi(1)CAVEATS
mg differs primarily in not having special modes for tasks other than straight editing, e.g., mail and news, and in not having special modes that support various programming languages. It does have text justification and auto-fill mode. Since it is written completely in C, there is no language in which you can write extensions. However, you can rebind keys and change some parameters. There are no limits to line length or format. Command, buffer, and file name completion and listing can be done using the spacebar and tab keys.Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre