Skip to content

ralphkw1/brief4vscode

Repository files navigation

icon

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...

  1. 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.
  2. 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 BindingCommandDescription
Alt + HHelpShow the contextual help window.
Alt + U, Keypad MultiplyUndoUndo the last command.
Ctrl + URedoRedoes the commands that have been previously undone.
Saving and Exiting
Key BindingCommandDescription
Alt + OChange output file nameChange the file name of the current editor. This not only changes the output file name, but also commits the change to file storage.
Alt + XExitExits the IDE.
Alt + WWriteWrites the current editor's file to storage.
Ctrl + XWrite all and exitWrites all unsaved content to storage and exits the IDE.
Cursor Movement
Key BindingCommandDescription
HomeBeginning of line or window or fileMoves 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.
EndEnd of line or window or fileMoves 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 + HomeTop of windowMoves the cursor to the top fully visible line of the window.
Ctrl + EndEnd of windowMoves the cursor to the bottom fully visible line of the window.
Ctrl + PgUpTop of buffer/fileMoves the cursor to the first character position of the editor. Hitting the <Home> key up to 3 times will also do this.
Ctrl + PgDnEnd of buffer/fileMoves the cursor to the last character position of the editor. Hitting the <End> key up to 3 times will also do this.
Ctrl + →Next wordMoves the cursor to the last character of the next word.
Ctrl + ←Previous wordMoves the cursor to the first character of the previous word.
Alt + GGo to lineOpens the "Goto Dialog" and moves the cursor to the requested line number.
Windows
Key BindingCommandDescription
Ctrl + TLine to top of windowMoves the line, that the cursor is currently on, to the top of the current window.
Ctrl + CCenter line in windowMoves the current line to the center of the current window.
Ctrl + BLine to bottom of windowMoves the current line to the bottom of the current window.
Editing Text
Key BindingCommandDescription
Alt + DDelete lineDeletes the current line.
Alt + BackspaceDelete next wordDeletes from the current cursor position to the end of the current word.
Ctrl + BackspaceDelete previous wordDeletes from the current cursor position the be beginning of the current word.
Ctrl + KDelete to beginning of lineDeletes from the current cursor position to the beginning of the line.
Alt + KDelete to end of lineDeletes from the current cursor position to the end of the line.
Alt + IInsert mode toggleToggles between the insert and overstrike modes.
Ctrl + EnterOpen lineInsert a blank line after the current line.
Blocks and Marks
Key BindingCommandDescription
Alt + MMark toggleToggle normal marking mode. Use cursor or single click mouse to move cursor and expand selection.
Alt + LLine Mark toggleToggle line marking mode. Use cursor or single click mouse to move cursor and expand selection.
Alt + CColumn Mark toggle*Toggle column marking mode. Use cursor or single click mouse to move cursor and expand selection.
Alt + ANoninclusive Mark toggleEquivalent 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 bookmarkInserts a numbered (1-10) bookmark into the editor and the current cursor posiotion. Bookmark 10 is dropped using the 0 key.
Alt + JJump to bookmarkWaits for a bookmark number, [1-10] then jumps to that number. Bookmark 10 is the 0 key.
Alt + BBookmark ListOpen 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 BindingCommandDescription
Keypad PlusCopy to scrapCopies the marked selection to the scrap buffer (the clipboard).
Keypad MinusCut to scrapCuts the marked selection to the scrap buffer.
InsPaste from scrapPastes the latest scrap buffer item into the current editor.
Shift + InsPaste from historyOpens the "Paste from clipboard History Dialog" and pastes the selected scrap item into the current editor. This is a new command.
Alt + InsSwap selection and scrapExchanges 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 BindingCommandDescription
Alt + SSearch forwardOpens Find/Replace dialog which facilitates both search/replace forward and backward.
Alt + TTranslate forwardAlso opens Find/Replace dialog.
Shift + F5Search againSearches forwards using previous search parameters.
Alt + F5Search backwardSearches backwards using previous search parameters.
Shift + F6Translate againTranslates (replaces) forwards using previous search/replace parameters. Only works if the search dialog is open.
Ctrl + RRepeatOpens 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.

Contact/Bugs

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.

About

Brief Text Editor Emulation for Visual Studio Code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published