Brief Mode / Brief Emulator / Brief Editor -*- mode: org; -*- #+STARTUP: showall #+STARTUP: hidestars * Brief The Brief editor v3.1 was once very popular among programmers in the MS-DOS days. It was famous for its easy-to-learn. Most of the command 'K'eys are associated with meaningful 'K'eywords. Usually, it can be mastered within an hour and difficult to forget. For example, the first key bring the cursor to home (beginning) of current line, a consecutive second key to the home (beginning) of the window and a third to the home (beginning) of the file. Similarly for the key. To paste/insert clipboard contents into current file just press ,... and so on. Personally, I've been using this key combination for over 27+ years (by the time Y2018 this guide was written) and have never changed, since the beginning of the MS-DOS Brief Editor days; the later 17+ years of the 27 are using Emacs with this Brief Mode. [Actually, after 17+ years of Emacs I still can't (or simply, don't need to) remember the default Emacs keys except for (cancel half-entered commands) and -x -c (quit Emacs, in case I don't have my Brief mode at hand).] * Installation ** Quick steps for non-Emacs users: 1. Install Emacs, better be Emacs version 24 above (Emacs26 recommended). For Debian/Ubuntu users: $ sudo apt install emacs -y 2. Download Brief package using emacs command line: $ emacs --batch --eval "(progn (package-initialize) (package-refresh-contents) (package-install 'brief))" 3. Now the Brief package should be installed in "~/.emacs.d/elpa/brief-#.##" (where #.## is the version number, by the time this document is written it's 5.87). You can either add this into PATH, or copy (link) the launcher bash script "~/.emacs.d/elpa/brief-#.##/b" to anywhere within your PATH (notice this launcher exists only after v5.87). Now you can start Emacs brief emulator, just run the launcher: $ b That's it! (If 'b' fail to launch, the package might not be properly installed, try step 2 and 3 again, or do it like Emacs users below.) ** For Emacs users, just install the ELPA brief package with menu -> "Options" -> "Manage Emacs Packages", then add (require 'brief) (brief-easy-start) ;; will do (brief-mode 1) into ~/.emacs to enable it. (For what `brief-easy-start' does please search "brief-easy-start" following.) * Key Commands: ** Basic editing commands are just like any other editor, cursor movement using arrow up/down/left/right; page up/down; line home/end; with key pressed cursor movement keys mark text selection. , , and also behaves the same as other editors; when text region is selected, and deletes the whole selection. ** The first thing need to memorize about Emacs is that the cancellation is usually *not* done by the key but mostly by -g key. ** All of the command keys are easy to memorize by the meaningful 'K'eyword associated 'K'ey: +|---------------------------------------------|---------------------|+ | *Command meaning & 'K'eyword* | *Key* | +|---------------------------------------------|---------------------|+ | e'X'it Emacs Brief Emulator: | -X | |---------------------------------------------+---------------------| | 'E'dit a file: | -E | |---------------------------------------------+---------------------| | 'B'uffer list: | -B | | press to quit buffer list | | |---------------------------------------------+---------------------| | Go to 'home' (beginning) of line: | | | Go to 'home' (beginning) of window: | (2nd ) | | Go to 'home' (beginning) of file: | (3rd ) | |---------------------------------------------+---------------------| | Go to 'end' of line: | | | Go to 'end' of window: | (2nd ) | | Go to 'end' of file: | (3rd ) | |---------------------------------------------+---------------------| | 'H'elp: | -H | | press or to quit help system | | | (For key-specific help, press "-h k", | | | then followed by the key command sequence. | | | For example: "-h k" "") | | |---------------------------------------------+---------------------| | 'G'oto line: | -G | |---------------------------------------------+---------------------| | 'L'ine oriented text selecting: | -L | | followed by cursor commands | | |---------------------------------------------+---------------------| | 'C'olumn oriented text selecting: | -C | | followed by cursor commands | | |---------------------------------------------+---------------------| | Start line 'M'arking: | -M | |---------------------------------------------+---------------------| | Copy ('+') text selection into clipboard: | | | if no text selected, copy current line | - | |---------------------------------------------+---------------------| | Cut ('-') text selection into clipboard: | | | if no text selected, cut current line | - | |---------------------------------------------+---------------------| | Paste clipboard texts into current line: | | | if text selected, replace selected | | |---------------------------------------------+---------------------| | 'D'elete a line(s): | -D | | if text selected, delete selected | | |---------------------------------------------+---------------------| | 'K'ill till end of line: | -K | |---------------------------------------------+---------------------| | 'R'ead a file and insert into current line: | -R | |---------------------------------------------+---------------------| | 'W'rite (save) editing file: | -W | | if text selected, save selected region to | | | a file (will prompt for a file name) | | |---------------------------------------------+---------------------| | 'O'utput as another file name: | -O | | (save as, will prompt for a file name) | | |---------------------------------------------+---------------------| | 'P'rint buffer/selected region: | -P | |---------------------------------------------+---------------------| | Toggle 'I'nserting/overwriting mode: | -I | |---------------------------------------------+---------------------| | 'U'ndo: | -U | | | | |---------------------------------------------+---------------------| | Buffer 'F'ilename: | -F | |---------------------------------------------+---------------------| | Jump to bookmark '0' ... '9': | -0 .. -9 | |---------------------------------------------+---------------------| | Set a bookmark 'J'ump: | -J | |---------------------------------------------+---------------------| | Switch to previous ('-') buffer: | -<-> | | | -<_> | |---------------------------------------------+---------------------| | Switch to next ('+') buffer: | -<+> | | | -<=> | |---------------------------------------------+---------------------| ** Frequently used commands adjusted for Emacs: |----------------------------------------------+-------------------| | Cancel a command | -G | | | | |----------------------------------------------+-------------------| | Execute Emacs extended command (the original | | | Emacs M-x) | | |----------------------------------------------+-------------------| ** Search () and Replace () commands: By default the un-prefixed commands search/replace forwards. Prefixed key change their meaning: (ALTer direction) means "backward", means "repeat" and <'C'ontrol> means "'C'urrent" or sometimes "forwards". *** Search: |--------------------------------------------------+------------------------| | Search regular expression forwards | | | Search regular expression backwards | - | |--------------------------------------------------+------------------------| | Repeat previous search in the last direction | - | | Repeat previous search forwards | -- | | Repeat previous search backwards | -- | |--------------------------------------------------+------------------------| | Search current word (at cursor) forwards | - | | Search current word (at cursor) backwards | -- | |--------------------------------------------------+------------------------| | Interactive search forwards | -S | | Interactive search backwards | -S | |--------------------------------------------------+------------------------| *** Replace: |---------------------------------------------------+------------------------| | Replace regular expression forwards | | | Replace regular expression backwards | - | |---------------------------------------------------+------------------------| | Repeat previous replacement in the last direction | - | | Repeat previous replacement forwards | -- | | Repeat previous replacement backwards | -- | |---------------------------------------------------+------------------------| | Replace current word (at cursor) forwards | - | | Replace current word (at cursor) backwards | -- | |---------------------------------------------------+------------------------| *** Toggle search & replace behavior (for current buffer): |------------------------------------------------------+--------------------| | Toggle case sensitivity (default case sensitive) | - | |------------------------------------------------------+--------------------| | Toggle regular expression (default) or simple string | - | |------------------------------------------------------+--------------------| ** Window control commands: All commands are relative to the current cursor location: |----------------------------------------------------+--------------| | Switch to the window the arrow points to | | |----------------------------------------------------+--------------| | Adjust current window size at the border the arrow | | | points to | | |----------------------------------------------------+--------------| | Split a new window in the direction that the arrow | | | points to | | |----------------------------------------------------+--------------| | Delete the window that the arrow points to | | |----------------------------------------------------+--------------| | Delete current window | - | |----------------------------------------------------+--------------| ** Keystroke macro commands: |--------------------------------------------------------+--------------| | Start/End remembering keystroke commands into a macro | | |--------------------------------------------------------+--------------| | Pause recording keystroke macro | - | |--------------------------------------------------------+--------------| | Playback just recorded macro | | |--------------------------------------------------------+--------------| | Load keystroke macro from a file, will prompt for a | - | | file name | | |--------------------------------------------------------+--------------| | Save keystroke macro to a file, will prompt for a file | - | | name | | |--------------------------------------------------------+--------------| ** Compilation commands: |-------------------------------------------------------+-------------| | Compile buffer, will prompt for a compilation command | - | |-------------------------------------------------------+-------------| | Jump to the first compilation error message in the | -P | | compilation buffer | | |-------------------------------------------------------+-------------| | Jump to the next compilation error message | -N | |-------------------------------------------------------+-------------| * Emacs specific or miscellaneous extended commands: |---------------------------------------------------+------------------------| | Move backwards an expression, or matching | - | | parenthesis backwards | | | Move forwards an expression, or matching | - | | parenthesis forwards | | |---------------------------------------------------+------------------------| | Move backwards a word | - | | Move forwards a word | - | |---------------------------------------------------+------------------------| | Indent current line, or region if text selected | | |---------------------------------------------------+------------------------| | Indent whole buffer | -- | |---------------------------------------------------+------------------------| | Emacs C-x prefix | -X | |---------------------------------------------------+------------------------| | Emacs C-u universal prefix argument | -U | |---------------------------------------------------+------------------------| | Open menu bar | - | |---------------------------------------------------+------------------------| | Open shell | -Z | |---------------------------------------------------+------------------------| | Find a file | | |---------------------------------------------------+------------------------| | Toggle current buffer read only | - | |---------------------------------------------------+------------------------| | Delete following word | - | |---------------------------------------------------+------------------------| | Delete previous word | - | | | - | |---------------------------------------------------+------------------------| | Redo during undo: one arrow key, then do undos | -Us | |---------------------------------------------------+------------------------| | Show Brief mode version | -V | |---------------------------------------------------+------------------------| | Scroll up one line | -E | | Scroll down one line | -D | |---------------------------------------------------+------------------------| | Go to beginning of file | - | | Go to end of file | - | |---------------------------------------------------+------------------------| | Go to beginning of window | - | | Go to end of window | - | |---------------------------------------------------+------------------------| | Go to first line of window | - | | Go to last line of window | - | |---------------------------------------------------+------------------------| | Open a new next line and goto it, but does not | - | | split current line | | |---------------------------------------------------+------------------------| | Recenter horizontally, this is usually used for a | --L | | long line in truncation mode to scroll texts | | | leftwards or rightwards to left/middle/right of | | | current window. It's an implementation against | | | Emacs default -L which recenter vertically | | | to top/middle/bottom of current window | | |---------------------------------------------------+------------------------| | Save buffer and exit Emacs immediately | ---X | |---------------------------------------------------+------------------------| * There are some less favored default Emacs settings which makes the editing experience in Emacs quite unlike other editors, especially for programmers. For example, text wrapping is by default enabled so a program line could easily wrapped to next line if window size changed; text scrolling is jumppy in both horizontal and vertical directions and on / the cursor does not stay at the same position. All these behaviors can be easily adjusted by changing default settings. With the quick launcher 'b' all these are fixed. The / are rewritten in Brief while function `brief-easy-start' changed other settings then do `(brief-mode 1)' to enable Brief mode. If you launch Emacs without using quick launcher 'b' or `brief-easy-start' function, you may want to include those changes into your ~/.emacs init script: ;;--------------------------------------------------------------------------; (setq-default truncate-lines t) ;; disable line wrapping ; ;;(setq-default global-visual-line-mode t) ; (setq scroll-step 1 ;; set vertical scroll not jumppy ; scroll-conservatively 101) ; (setq hscroll-margin 1 ;; set horizontal scroll not jumppy ; hscroll-step 1) ; (scroll-bar-mode -1) ;; small border without scroll bar ; ;;--------------------------------------------------------------------------; Or you can refer to the source code "brief.el" for function `brief-easy-start'. * For more details like Cygwin 2.x users note, please check the comments in the source code "brief.el". Luke Lee