The Compositional Nature of Vim
[Editor's note: Though this story is nearly 5 years old, it seems to provide a nice summary of some of the various capabilities that vim offers. There is much more detail in the linked article than in this excerpt. Hopefully, in reading through that article newcomers will gain perspective and long-time-users may happen upon something useful they'd never seen before.]
An Anonymous Coward writes:
http://ismail.badawi.io/blog/2014/04/23/the-compositional-nature-of-vim/
I use vim. I've used vim since I started programming; the very first program Iwrote - hello world in C, following along a cprogramming.com tutorial - wastyped out in vim, inside a cygwin environment on Windows. Naturally, at firstit was hard and intimidating. I didn't know how to do anything, least of alledit text. I learned about insert mode and normal mode. I learned aboutnavigating using hjkl, and deleting the current line with dd, and savingand quitting with :wq, and for a long time that was it.
Over time I learned more and more. I learned that I could copy the current linewith yy, and paste it somewhere with p. This meant that yyp duplicatedthe current line! I learned that I could indent the current line with >>, andalso that I could indent the next 5 lines with 5>>. I learned that ggjumped to the top of the file. I learned that I could jump to line 34 with34G. I also learned a strange incantation - I could write %s/foo/bar/g toreplace all occurrences of foo with bar in the whole file. I used this allthe time, and vim felt really powerful!
I went on like this for years. What I'm trying to get at is that I neverreally took the time to learn how vim worked. I had no clue about the bigpicture. I didn't know any concepts. Even though I used vim for hours each day,and I felt like I was constantly improving and learning new things, and mypeers in university thought me knowledgeable enough to come to me with theirvim questions, really I was just getting by on ad-hoc memorization.
The power of composition
There's a combinatorial effect here. If I know about o operators, m motionsand t text objects, I can do up to o * (m + t) different things. Every newoperator I learn lets me do up to m + t new things, and every motion or textobject I learn lets me do up to o new things. Once you internalize vim'slanguage for editing text, then not only does editing text efficiently becomeeasier, but you also start learning at a much faster rate, as every new thingyou learn interacts with all the things you already know.
Read more of this story at SoylentNews.