Ved command line & keymap {{ currentPage ? currentPage.title : "" }}

Ved has a very definite design and part of that it has two input areas: a main display area and a single-line at the top of the screen called the "status line", although it would be more natural to call it the command line.

When the cursor is in the main area, Ved is in a listening loop that maps key-sequences into things-to-do. A lot of normal keys just turn into "insert the character you just typed". But some of them are elaborate actions.

When the cursor is on the status bar, which is actually a 1-line windows into a buffer of commands (much like emacs), the RETURN key is temporarily redefined (it's a mode). Typically you type a command and then press RETURN, the command is executed and the cursor is put back in the main area.

So the question is how do you get onto the command/status line? The answer is that you use a key-sequence that in Ved's documentation is referred to as ENTER. On the old VT100s that we used to use, this was in fact the ENTER key. However, on modern systems the ENTER key is frequently unavailable as a distinctive key because the operating system (well, device driver) decides it has a better idea. For example, on my Windows 10 system it generates ^M and there's not a huge amount I can do about that (I have KeyTweak installed and I do in fact mess it about - but it doesn't really fix the issue.) And if the operating system isn't in the way, the terminal emulator is quite likely to make it impossible. And num-lock just messes everything up.

So in Ved documentation ENTER means "the key sequence that gets you up to the command/status line & leaves you on a new empty line". You will find that the default setup bizarrely uses ^G for that. Why? Presumably the folk involved were at their wits end trying to find a system that vaguely hung together on a bunch of different systems.

It is not really possible to come up with a definitive keymap for Ved inside xterm-based emulators.

Ved suffers particularly from this because the original designs were based on the old VT100 & VT220 terminals. The keypad was fully available and Ved made excellent use of this and the function keys. But on macOS, for example, the Application Function keys - the ones that are specifically available for Applications to use for their own purposes - cannot be used by Applications. And on Windows, the keypad sequences change depending on numlock and the right hand keys are actually intercepted at a low level and translated into their non-keypad equivalents. So the best keymaps for Ved can't be reliably implemented. That's why the "standard" Ved keymap is so limited and a bit weird.

A couple of really helpful hints to anyone learning Ved:

There is no undo function in Ved. It's completely missing. I spent days looking for it when I was learning Ved. Now you don't need to, lucky you.

Ved is a line oriented plainish text editor that presents the user with the conceptual model of an infinite quadrant of character cells. There's no wrap line option as a result (!). The only compromise on this is the treatment of tab characters, which are treated as spanning multiple character cells.

Selection isn't done from a one-character position to another. Instead a block of lines can be "marked", which you can think of as a selection of a number of lines - but it's much more persistent than a selection and each buffer has its own selection. This is called a "marked range". This is actually one of Ved's strongest design features. I certainly miss it very much in modern editors.

In normal operation, Ved divides the screen horizontally into an upper and lower pane which acts as windows onto in-memory buffers. You can't have two windows on the same buffer, unfortunately.

You can expand the 1/2 height pane using ESC w and switch panes with ESC x. These are the two most useful sequences.

{{{ content }}}