Jan 152019
 

Now that the click-bait is out of the way, vi movement keys are perfectly reasonable particularly to those who have been using them for decades (which includes me). But for ages, vi itself has supported the arrow keys for movement as well as the tradition cursor movement keys.

For the benefit of those who have not used vi and are wondering what those traditional cursor movement keys are, they are H (left), J (down), K (up), L (right). A bit like the gamer’s set of movement keys – W, A, S, and D, except that the vi movement keys pre-date arrow keys.

There are those who will claim that the traditional movement keys are more efficient as they require less hand movement. And they are. So it is perfectly understandable that many tiling window managers and other keyboard-centric software uses these movement keys.

But someone who hasn’t spend decades hard-wiring the vi movement keys into their brain, will find vi-style key bindings inscrutable. And the fix? Just use the arrow keys as well.

There is no harm in having two key sequences do the same thing; no harm in emphasising that the arrow keys work too. And indeed no harm encouraging the use of vi-style movement keys by emphasising their efficiency.

Don’t forget that someone learning a new tiling window manager (or most other things) can be put off by the silliest of things – such as inscrutable control keys.

Rusty Handrail
Oct 272016
 

I have recently been ‘entertaining’ myself with watching some videos on the vim editor which to the uninitiated is an extremely powerful if somewhat ‘unusual’ editor that is popular amongst Linux power users. One of the surprising things that came up was that apparently there are experienced vim users who are not aware of why the ex mode exists.

Or probably why the ex command exists.

In the dim and distant past (and in fact even longer than I’ve used Unix!), one of the possible ways of interacting with computers was with a printing terminal :-

On such a terminal, using a visual editor like vim (or it’s predecessor vi) would have been painful. Redrawing the screen would take a couple of minutes or more; imaging moving the cursor across from the beginning of the line to the end!

So it was common to use an alternative kind of editor – the line editor. The process of creating a file is somewhat clumsy :-

$ ex ~/Foo
"~/Foo" 1L, 4C
Entering Ex mode.  Type "visual" to go to Normal mode.
:p
Foo
:a
Bar
.
:p
Bar
:1
Foo
:write
:quit

Now for a quick explanation (although this is no tutorial on line editors!): The ex ~/Foo is the command given to start editing a pre-existing file called Foo in the ex editor. After the editor starts up, I enter the “p” command to print the current line. I then use the “a” command to append text after the first line, and enter a “.” on it’s own to finish adding lines. Again I use “p” to print the current line, and then “1” to print the first line.

Which is more than you’ll ever want to know about how to use ex, so why does it still exist?

The first reason is simply because it’s possible. It’s almost certainly fairly easy to support the ex mode with vim; after all the ex-mode is effectively the commands you get when you enter “:” within vim.

The next reason is that line editors were sometimes used within shell scripts to batch edit files, and somewhere out there is a shell script from hell that relies on ex to keep running.