Why do vim and less have such similar keybindings?

Solution 1:

Short answer, common historical roots in vi. Their creators were both users of an earlier Unix program, vi.

Here is a rough diagram to put their initial release dates and influence in perspective:

vi 1976
 | \      more 1978
 |  \     /
 |   \   /
 |     v
 |   less 1983
 v
vim 1991

Sources:

  • vi, 1976
  • more, 1978
  • less, 1983
  • vim, 1991

Vim

Vim, by Bram Moolenaar, is a clone of the Unix program vi. From within vim you can look at the help intro: :help intro, you see:

Vim is a text editor which includes almost all the commands from the Unix program "Vi" and ...

Less

Whereas the creator of less, Mark Nudelman explains on his FAQ:

Back in 1983, I was working for a now-defunct company called Integrated Office Systems. Some of our software ran on a Unix system and produced enormous log files of its transactions. We wanted to be able to search these log files for error messages. But the version of "vi" we were using couldn't handle files larger than a certain size, and our log files often exceeded that size. So we were forced to use "more" to view the files. The problem was, once we found an error message, what we really wanted to see was the transactions leading up to the error; that is, the lines in the log file immediately before the error message. But more didn't allow backward movement in the file.

So he was already using vi and more when he created less to overcome the limitations of both vi and more at that time.

When you do man less, you see the connection to vi:

Commands are based on both more and vi.

Vim and Less

So less and vim seem to coincidentally have commands similar to each other, only because, those commands are actually based on vi, which can be seen as their common ancestor.