Notes: Practical Vim by Drew Neil

Posted on June 18, 2018 by jcb

Contents



Preliminaries

Commands:

Command Action
:help :h display help file
:substitute :s search and replace
vimtutor teaches basic vim use

How The Book is Structured

Each chapter covers a theme proceeding from novice to advanced within the chapter.

Not designed to be read in order, but that’s what I’m going to do anyway.

How My Notes are Structured:

Each chapter gets a markdown file, every tip gets a section. The commands covered in the chapter will be listed at the top of each chapter note file.

Interspersed in each section will be my commentary.

Learn to Touch Type, Then Learn Vim

Seriously, learn to touch type. It’s actually super fun and satisfying. It’s also the single biggest piece of low-hanging productivity fruit you can pluck. You don’t have to be a 100 wpm or even an 80 wpm typist. I type at 60 wpm, but 40 is totally fine. It’s not about the speed, it’s about the fluidity of thought that comes from looking at what you’re doing on the screen rather than at your hands. It’s about willing a word to appear in front of you and having your fingers magically move to make it happen.

It’s about making the machine an extension of your mind. Which also why we learn vim.

Read the Forgotten Manual

The Vim documentation is delightful. Truly delightful. Our world of software is a barren wasteland where ravaging hordes of brogrammers prowl in the darkness, pouncing on unwary beginners with cries of “git gud, scrub”. But there are rare pockets of civilization in this wilderness, oases to shelter the weary traveler, and one of the best of these is the Vim documentation. It is plainly written, it is comprehensive, it is tastefully formatted and organized, it is perfectly integrated into the software it is documenting. Rejoice, developers, and weep, for you will rarely have it this good.

Notation for Simulating Vim on the Page

Notation Meaning
x press ‘x’ once
dw press d then x
dap press d, a, p
<C-n> <Ctrl> and n
f{char} f then any character
f{a-z} f then any lowercase letter
f{a-zA-Z} f then any lowercase or uppercase letter
d{motion} d then any motion command
<C-r>{register} <Ctrl> and r, then a register address
<C-w><C-j> <C-w> then <C-j>
<Esc> Escape key
<CR> Enter key (CR stands for Carriage Return)
<S-Tab> <Shift> and <Tab> at the same time

Prompt Meaning
$ system shell outside vim
: Command-Line mode Ex command
/ Forward search
? Backward search
= Command-Line mode evaluate Vim script

All the cursor position notation is intuitive. It looks exactly like what happens in-editor.

Use Vim’s Factory Settings

How about no? I like my .vimrc. If I find a mismatch while doing any exercises (unlikely, my .vimrc is pretty minimal), then and only then will I run vim -u NONE -N.

Vim in the Terminal or GUI

Terminal. Obviously terminal. Vastly superior in its integration with the shell environment.