83

From http://www.catonmat.net/blog/why-vim-uses-hjkl-as-arrow-keys/: When Bill Joy created the vi text editor he used the ADM-3A terminal, which had the arrows on hjkl keys. Naturally he reused the same keys and the rest is history!


51

tl;dr: as of 2020, it would seem that about €1.35 million ($1.63 million USD) has been raised. ICCF & Vim seem very intertwined, and probably a majority of the donations came from Vim users, but there is no way anyone can be certain about this. Full answer: The ICCF has published financial reports. '94-'96 € 5 000 (estimate) 1997 € 7 241 ...


35

The whole point of select mode is to provide a selection behavior similar to the one used in conventional editors. On the same note, there's mswin.vim which changes a bunch of options and mappings to make Vim feel like a conventional editor. I can only assume those were added to please a subset of Vim users, probably at the time Vim was ported to Windows (...


34

This actually took quite some searching, but the correct way is 'Vim'. From :help pronounce: Vim is pronounced as one word, like Jim, not vi-ai-em. It's written with a capital, since it's a name, again like Jim. Some parts of the Vim documentation does the all-caps 'VIM' though, this seems to be older documentation. I could not find any references 'ViM' ...


26

From nvi(1): HISTORY The ex editor first appeared in 1BSD. The nex/nvi replacements for the ex/vi editor first appeared in 4.4BSD. Some background, from memory, so I hope got the details correct: In the beginning, UNIX was free. Everyone could request a copy from Ken, and he would send you a tape with the source (allegedly with the text "love, ...


25

Nobe4's answer is great, and explains why we use hjkl very well. However, it's really interesting to see the full keyboard, and a lot of strange things about vim make more sense when you can see the full keyboard it was designed on. For example, why does vi rely so heavily on the esc key, when it's in such a weird and uncomfortable place? This is why: As ...


20

The Unix section of the wiki page on configuration files, leads to the wiki page on run commands, which is where the rc comes from. Quoting from the run commands page: In the context of Unix-like systems, the term rc stands for the phrase "run commands". It is used for any file that contains startup information for a command. It is believed to have ...


18

The black hole register is used in the same situations as /dev/null: when you do an action that normally outputs something but you have no use for that output. Vim's default behavior is to "cut", not "delete". In most cases it doesn't matter but, sometimes, users may actually need to "delete". That's where the black hole register comes handy. Is this ...


18

I found a paper "An Introduction to Display Editing with Vi" by William Joy (vi creator) and Mark Horton (vi maintainer since 1979). From the paper it is clear that the default Y behavior is not a mistake, but a desired feature. In the "Rearranging and duplicating text" section they mention this: Try the command YP. This makes a copy of the current line ...


17

As to why these arrows were printed on these keys... it's because they could be used with the control key for local cursor movement. Ctrl-H and Ctrl-J (backspace and line feed) are obvious, and an easy mnemonic even today. Ctrl-K is "vertical tab", but was sometimes used for reverse linefeed on pre-ANSI terminals. The use of Ctrl-L for a non-destructive ...


17

Y was the yank command of the first vi version (ex-1.1, January 1, 1978). This version did not have the yy cammand. ex-2.2 (May 6, 1979) did have both yy and Y. So actually yy is a synonym for Y (Y predates yy).


13

At the most basic level, there's already an asymmetry between the search and replace portions of :substitute because the former is a regular expression and the latter is text, with specific additional escape sequences. This is just highlighted by the intuition you have about what \n means. For example, consider that \n in the search doesn't match a literal \...


13

The name VimL appeared in the documentation in July 2013. Vim's scripting language didn't have a name before that. VimL is the only name mentioned in the documentation. It doesn't really make it the official name but, well… that's the closest we have. FWIW I don't like it and will probably keep calling it vimscript for some time.


11

You know the story behind the hjkl keys in Vi? Well, : was unshifted on Vi author's ADM-3A terminal. No idea if that's the real explanation in this particular case, but it seems at least as plausible as the hjkl story.


9

Because the patches have been sitting in the TODO list for almost five years. Don't forget, vimscript wasn't designed: it is only the ever-changing interim result of a slow evolutionary process. Hell, it didn't even have an actual name in the doc until "VimL" was discreetly slipped in a bit before 7.4.


9

Is there any advantages or side-effects of an explicit set nocompatible that I'm perhaps missing? Actually, there are many side-effects. Every time compatible is set or reset Vim rescans all options (except "terminal") and switches defaults when necessary. After that it rebuilds quite a few internal tables for iskeyword, spelling, vartabs etc. (see ...


7

Well, generating random numbers isn't really the task of a an editor, IMHO. And with Vim, "the Unix way" to do it is to rely on other tools, that do it ... better. E.g. you can: on *nix systems, read "/dev/urandom" or similar call a program that does it write a plugin in python, ruby, lua etc. - all languages with 'random' support. Simple, non-security ...


6

A NUL byte is a string terminator in C, and for this reason Vim uses this convention, described in the manual at :h NL-used-for-Nul: <Nul> characters in the file are stored as <NL> in memory. In the display they are shown as "^@". The translation is done when reading and writing files. To match a <Nul> with a search pattern you can just enter ...


6

This is actually mark notation. Anytime you go into a visual selection the beginning of the selection is marked with the mark <, and the end with the mark >. You can also do ex-commands between two arbitrary marks that you place yourself. i.e. :'a,'bs/foo/bar/. Vim is just borrowing from the system already in place. As for what '>,'< would mean. ...


6

Besides deleting text, you can use the black hole register to delete other registers. Example: :let @a=@_ This is one way of clearing register "a.


6

Yes, they were both caused by changes to the packaging and unrelated to Vim itself. The first epoch bump (since all packages without an explicit epoch have an implicit 0 epoch) was introduced when the versioning of the package changed from x.y.patch-debrev to x.y-patch+debrev (i.e., 6.1.263-2 to 6.1-266+1). The latter sorts earlier than the former, so the ...


6

One reason you might want to include a guarded set nocompatible in your .vimrc is that compatible will not be automatically unset if you specify the vimrc with the -u flag: Using the "-u" argument with another argument than DEFAULTS has the side effect that the 'compatible' option will be on by default. It's for this reason that I have this version* in ...


5

The nomagic setting was created to support the edit mode, which was "designed for more casual or beginning users", rather than as a general "nothing is a metacharacter" mode. From the ex reference manual: The ex default setting of magic gives quick access to a powerful set of regular expression metacharacters. The disadvantage of magic is that the user ...


5

Vim has rand() function since 8.1.2342 rand([{expr}]) *rand()* *random* Return a pseudo-random Number generated with an xoshiro128** algorithm using seed {expr}. The returned number is 32 bits, also on 64 bits systems, for consistency. {expr} can be initialized by |srand()| and will be updated by ...


5

It's always been my understanding that vi followed the POSIX standard (BRE/ERE). Given the far more tight-knit technical community/ecosystem of the time I think he would have to have been a bit mad to veer from the standard of the time if he wanted people to adopt his editor. I don't currently have any direct evidence for this (like a quote from Bill ...


5

Bill Joy (the original author of vi) explains this in An Introduction to Display Editing with Vi. The [[ and ]] operations require the operation character to be doubled because they can move the cursor far from where it currently is. While it is easy to get back with the command ``, these commands would still be frustrating if they were easy to hit ...


4

Yes. Thanks Tumbler41 for the link.


3

vi was designed for use with glass terminals, the protocols of which often use many of the control-x commands down at the low end of ASCII. Others were reassigned in the move from paper terminals, such as Ctrl-L (form feed), which vi reinterprets from "form feed" to mean "repaint display" instead, that being more appropriate to a text editor. Commands like "...


3

Apparently magic/nomagic dates back to Ex (mentioned in the pdf user manual), but I'm not sure of the reasoning behind the original decision. If you're using Vim, there are 4 levels of 'magic' you can use. The two additional modes are explained in :help /magic: Use of "\v" means that in the pattern after it all ASCII characters except '0'-'9', 'a'-'z', 'A'-'...


3

At the time we (maintainers of snippet/template engines) had mappings using :vmap which were targetting the select mode. I still have a few traces of that in my lh-brackets plugin. Also the mswin.vim beasts were using vmap instead of smap, IIRC. I'm not sure if there were other big users of the select mode. Evolutions that break what is already working, ...


Only top voted, non community-wiki answers of a minimum length are eligible