Brief Emulator for Visual Studio Code
Brief Text Editor Emulation and Keymap for Visual Studio Code
This extension adds key bindings and functionality that attempts to emulate many features of the original BRIEF MS-DOS application. Adds it's numbered bookmarks, overtype mode, home-home-home and end-end-end, line marking modes, single key cut copy and paste, clipboard swap, and clipboard history commands, as well as most of the original keybindings.
Some history. BRIEF (Basic Re-configurable Interactive Editing Facility) was a popular programmer's text editor in the late 1980s and early 1990s. Developed by UnderWare Inc, it was quite powerful and feature rich for its time. See the Wikipedia page "Brief (text editor)" for more information.
Installation
This extension has been tested on Linux and limited testing on Windows. I don't have a Mac. After you install the extension, it should just start working.
There are a few ways to install an extension in Visual Studio Code. You can...
- Show the EXTENSIONS Sidebar by either pressing (ctrl+shift+x), or click on the "Extensions" icon in the "Activity Bar", or open the command palette (ctrl+shift+p) select "Extensions: Install Extension", or click on the "Manage" icon in the "Activity Bar" and select "Extensions". Then click in the "Search Extensions in Marketplace" box and enter "brief4vscode" to find the extension. Then click the install button.
- Launch VS Code Quick Open (ctrl+p), type the command "ext install rkdawenterprises.brief4vscode", and press enter.
Commands
The following are the key bindings and commands implemented by the plugin.
Some Brief functionality is currently the Visual Studio Code default, or close enough.
No intentional changes to mouse functionality.
None of the commands should work unless the cursor is in an active "TextDocument". So the extension shouldn't interfere with existing functionality.
Multi-root workspaces are not supported and not tested, but should only affect the relative bookmark feature; It should default to global bookmarks.
Help and Undo/Redo
Key Binding | Command | Description |
Alt + H | Help | Show the contextual help window. |
Alt + U, Keypad Multiply | Undo | Undo the last command. |
Ctrl + U | Redo | Redoes the commands that have been previously undone. |
Saving and Exiting
Key Binding | Command | Description |
Alt + O | Change output file name | Change the file name of the current editor. This not only changes the output file name, but also commits the change to file storage. |
Alt + X | Exit | Exits the IDE. |
Alt + W | Write | Writes the current editor's file to storage. |
Ctrl + X | Write all and exit | Writes all unsaved content to storage and exits the IDE. |
Cursor Movement
Key Binding | Command | Description |
Home | Beginning of line or window or file | Moves the cursor to the beginning of the line or the window or the file depending on whether it is already there. Pressing <Home> will move the cursor/caret to the beginning of the current line if it is not already there. If the cursor/caret is already at the beginning of the line, pressing <Home> will move the cursor/caret to the beginning of the window. If the cursor/caret is already at the beginning of the window, pressing <Home> will move the cursor/caret to the beginning of the buffer/file. |
End | End of line or window or file | Moves the cursor to the end of the line or the window or the file depending on whether it is already there. Pressing <End> will move the cursor/caret to the end of the current line if it is not already there. If the cursor/caret is already at the end of the line, pressing <End> will move the cursor/caret to the end of the window. If the cursor/caret is already at the end of the window, pressing <End> will move the cursor/caret to the end of the buffer/file. |
Ctrl + Home | Top of window | Moves the cursor to the top fully visible line of the window. |
Ctrl + End | End of window | Moves the cursor to the bottom fully visible line of the window. |
Ctrl + PgUp | Top of buffer/file | Moves the cursor to the first character position of the editor. Hitting the <Home> key up to 3 times will also do this. |
Ctrl + PgDn | End of buffer/file | Moves the cursor to the last character position of the editor. Hitting the <End> key up to 3 times will also do this. |
Ctrl + → | Next word | Moves the cursor to the last character of the next word. |
Ctrl + ← | Previous word | Moves the cursor to the first character of the previous word. |
Alt + G | Go to line | Opens the "Goto Dialog" and moves the cursor to the requested line number. |
Windows
Key Binding | Command | Description |
Ctrl + T | Line to top of window | Moves the line, that the cursor is currently on, to the top of the current window. |
Ctrl + C | Center line in window | Moves the current line to the center of the current window. |
Ctrl + B | Line to bottom of window | Moves the current line to the bottom of the current window. |
Editing Text
Key Binding | Command | Description |
Alt + D | Delete line | Deletes the current line. |
Alt + Backspace | Delete next word | Deletes from the current cursor position to the end of the current word. |
Ctrl + Backspace | Delete previous word | Deletes from the current cursor position the be beginning of the current word. |
Ctrl + K | Delete to beginning of line | Deletes from the current cursor position to the beginning of the line. |
Alt + K | Delete to end of line | Deletes from the current cursor position to the end of the line. |
Alt + I | Insert mode toggle | Toggles between the insert and overstrike modes. |
Ctrl + Enter | Open line | Insert a blank line after the current line. |
Blocks and Marks
Key Binding | Command | Description |
Alt + M | Mark toggle | Toggle normal marking mode. Use cursor or single click mouse to move cursor and expand selection. |
Alt + L | Line Mark toggle | Toggle line marking mode. Use cursor or single click mouse to move cursor and expand selection. |
Alt + C | Column Mark toggle* | Toggle column marking mode. Use cursor or single click mouse to move cursor and expand selection. |
Alt + A | Noninclusive Mark toggle | Equivalent to Mark, except that the marked area does not include the character at the end of the block. Essentially begins the marking mode with no visible selection, unlike Mark which automatically selects the first character. |
Alt + [1-10] | Drop bookmark | Inserts a numbered (1-10) bookmark into the editor and the current cursor posiotion. Bookmark 10 is dropped using the 0 key. |
Alt + J | Jump to bookmark | Waits for a bookmark number, [1-10] then jumps to that number. Bookmark 10 is the 0 key. |
Alt + B | Bookmark List | Open bookmark list dialog. Scroll and select a bookmark to jump to. Can also delete bookmarks. This is a new command and the key assignment was taken from the "buffer list" command, which is not implemented. |
Scrap
Key Binding | Command | Description |
Keypad Plus | Copy to scrap | Copies the marked selection to the scrap buffer (the clipboard). |
Keypad Minus | Cut to scrap | Cuts the marked selection to the scrap buffer. |
Ins | Paste from scrap | Pastes the latest scrap buffer item into the current editor. |
Shift + Ins | Paste from history | Opens the "Paste from clipboard History Dialog" and pastes the selected scrap item into the current editor. This is a new command. |
Alt + Ins | Swap selection and scrap | Exchanges the current selection with the latest scrap buffer item, i.e. cuts the current selection, and in it's place, pastes the current scrap. New command. Comes in handy when you want to extract some existing code from a complex statement and make it a new variable. First create the new variable then copy it. Then select the code statement and swap <Alt+Ins>. Then paste the code after the new variable. |
Search and Translate (replace)
Key Binding | Command | Description |
Alt + S | Search forward | Opens Find/Replace dialog which facilitates both search/replace forward and backward. |
Alt + T | Translate forward | Also opens Find/Replace dialog. |
Shift + F5 | Search again | Searches forwards using previous search parameters. |
Alt + F5 | Search backward | Searches backwards using previous search parameters. |
Shift + F6 | Translate again | Translates (replaces) forwards using previous search/replace parameters. Only works if the search dialog is open. |
Ctrl + R | Repeat | Opens the "Repeat Dialog", then repeats the requested command, or inserts the requested char/string into the editor, the requested number of times. Not all commands are supported or work well. Actually accepts any "non-printable" key sequence, so not sure what works actually. |
Notes*
- Really can't properly implement Brief's "Column Marking Mode" until Visual Studio Code supports "virtual space".
- The extension may not currently work very well with line/code folding (not tested). So best to unfold the area of the file you are working on if you want the commands to work as expected.
- I can only account for Brief defined keystrokes in the marking modes. Turn off an active marking mode to use other commands. I couldn't find a way to generally monitor all keystrokes to disable an active marking mode.
Enter bugs at "Brief for VS Code Issues".
You can email me at rkdawenterprises@gmail.com.no!spam. I don't look at this very often so it may take a while to hear back.
I started using Brief in the early 1990s when I was at Compaq Computer Corporation working on printers.
I thought at the time that it was way superior to any editor I had used to date. I've used it for so long,
the key bindings and particular functionality has just stuck with me.
I created this project as an exercise for me to learn Visual Studio Code extension development; Just having fun. I don't think that there is a high demand for Brief emulation anywhere. Also, I have always really liked the Brief key assignments and feature set and I try and set it up in any editor I use. So if you are/were also into Brief, I hope you enjoy using this.
One of the goals of this project was to have minimal functional effect on the Visual Studio Code "TextDocument" editor. So this is by no means a perfect example of the Brief editor, and it's a little quirky at times, mainly because it is limited by the API and architecture of the existing editor. I try to note any deviations in the command descriptions, at least, deviations from the limited documentation and knowledge I have. I have also added some commands as documented below. You can, of course, disable any key bindings and/or set them back to default in the "settings->keyboard shortcuts.
BTW, I don't have a working example of Brief, just the old documentation. Feel free to let me know if I have implemented something improperly. Also, I did not try to emulate all of Brief's functionality. This is most certainly a subset.
License
Copyright 2019-2024 RKDAW Enterprises and Ralph Williamson
Licensed under the Apache License, Version 2.0 (the "License"); You may not use this file except in compliance with the License.
You may obtain a copy of the License at Apache License Verson 2.0.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and
limitations under the License.