Stories
Slash Boxes
Comments

SoylentNews is people

SoylentNews is powered by your submissions, so send in your scoop. Only 18 submissions in the queue.

Submission Preview

Link to Story

The Compositional Nature of Vim

Accepted submission by Anonymous Coward at 2019-08-04 13:36:02
Software

http://ismail.badawi.io/blog/2014/04/23/the-compositional-nature-of-vim/ [badawi.io]

I use vim. I’ve used vim since I started programming; the very first program I wrote – hello world in C, following along a cprogramming.com tutorial – was typed out in vim, inside a cygwin environment on Windows. Naturally, at first it was hard and intimidating. I didn’t know how to do anything, least of all edit text. I learned about insert mode and normal mode. I learned about navigating using hjkl, and deleting the current line with dd, and saving and 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 line with yy, and paste it somewhere with p. This meant that yyp duplicated the current line! I learned that I could indent the current line with >>, and also that I could indent the next 5 lines with 5>>. I learned that gg jumped to the top of the file. I learned that I could jump to line 34 with 34G. I also learned a strange incantation – I could write %s/foo/bar/g to replace all occurrences of foo with bar in the whole file. I used this all the time, and vim felt really powerful!

I went on like this for years. What I’m trying to get at is that I never really took the time to learn how vim worked. I had no clue about the big picture. 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 my peers in university thought me knowledgeable enough to come to me with their vim questions, really I was just getting by on ad-hoc memorization.


Original Submission