r/programming • • May 23 '17

Stack Overflow: Helping One Million Developers Exit Vim

https://stackoverflow.blog/2017/05/23/stack-overflow-helping-one-million-developers-exit-vim/
9.2k Upvotes

1.1k comments sorted by

View all comments

2

u/michaelpaoli May 24 '17

vim annoys me ... lots. Typical examples:

:q
E37: No write since last change (add ! to override)
:q!
E37: No write since last change (add ! to override)
E162: No write since last change for buffer "[No Name]"
:q!!
E488: Trailing characters

Lots more examples:
vim annoyances
nvi(1) rocks! :-) nvi(1) is also vi(1) on BSD systems.

1

u/bart2019 May 24 '17

Annoyances? How about this one.

When you press "a" to append on the current line, it doesn't move the cursor at the end of the line. Instead, it moves it to the position of the last character, for example, on the last letter.

W...T...F...

2

u/michaelpaoli May 24 '17

Nothin' unexpected there, standard vi/nvi behavior,
a to append after the current cursor position
A to append at the end of the line

In general with vi/nvi standard behavior, uppercase does/impacts something bigger or more general than the otherwise similar lowercase,
e.g. b vs. B, e vs. E, h vs. H, l vs. L, r vs. R, s vs. S, u vs. U, w vs. W, etc. But that's just in general. There are also highly useful (often slight) exceptions/variations, e.g.: f vs. F vs. ^F (forward vs. backwards vs. screenful), i vs. I (before vs. before first non-whitespace on line (or beginning of line if no non-whitespace on line)), n vs. N (forward vs. backwards), o vs. O (below vs. above), p vs. P (after vs. before), t vs. T (forward vs. backwards), x vs. X (current vs. to left).

"slide" set I've used many times for vi training presentations:
vi - basic introduction through advanced tips and "tricks" (works best along with the verbal presentation and fair number of quick demonstrations along the way, and some other handout materials - including ye olde vi (not vim!) quick reference card (best printed as double sided 11" x 8.5" tri-fold), and tutorial introduction:
Ex/Vi Quick Reference
An Introduction to Display Editing with Vi