Hic Sunt Dracones: if this is your first exposure to vim and you
intended to avail yourself of the introductory chapter, kindly type
- :q<enter> and try again.
+ :q!<ENTER> and run vimtutor for Chapter 1 instead.
The approximate time required to complete this chapter is 8-10 minutes,
depending upon how much time is spent with experimentation.
MNEMONIC: into register(") named (a) (y)ank (i)nner (w)ord
- 3. Navigate forward to the word 'cookie' (fk or 2fc or $2b or /co<enter>)
+ 3. Navigate forward to the word 'cookie' (fk or 2fc or $2b or /co<ENTER>)
and type "byiw
- 4. Navigate to any point on the word 'Vince' and type ciw<C-r>a<ESC>
+ 4. Navigate to any point on the word 'Vince' and type ciw<CTRL-R>a<ESC>
MNEMONIC: (c)hange (i)nner (w)ord with <contents of (r)egister> named (a)
- 5. Navigate to any point on the word 'cake' and type ciw<C-r>b<ESC>
+ 5. Navigate to any point on the word 'cake' and type ciw<CTRL-R>b<ESC>
---> a) Edward will henceforth be in charge of the cookie rations
b) In this capacity, Vince will have sole cake discretionary powers
REFERENCE: Registers :h registers
Named Registers :h quotea
- Motion :h motion.txt<enter> /inner<enter>
- CTRL-R :h insert<enter> /CTRL-R<enter>
+ Motion :h motion.txt<ENTER> /inner<ENTER>
+ CTRL-R :h insert<ENTER> /CTRL-R<ENTER>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2. Navigate to any point on the supplied number
- 3. Type ciw<C-r>=60*60*24<enter>
+ 3. Type ciw<CTRL-R> followed by =60*60*24<ENTER>
4. On the next line, enter insert mode and add today's date with
- <C-r>=system('date')<enter>
+ <CTRL-R> followed by =system('date')<ENTER>
NOTE: All calls to system are OS dependent, e.g. on Windows use
system('date /t') or :r!date /t
1. Move the cursor to the line below marked --->
- 2. yank the zeroth line, then inspect registers with :reg<enter>
+ 2. yank the zeroth line, then inspect registers with :reg<ENTER>
3. delete line 0. with "cdd, then inspect registers
(Where do you expect line 0 to be?)
NOTE: a common conundrum when coding is moving around large chunks of code.
The following technique helps avoid number line calculations associated
with operations like "a147d or :945,1091d a or even worse using
- i<C-r>=1091-945<enter> first
+ i<CTRL-R> followed by =1091-945<ENTER> first
1. Move the cursor to the line below marked --->
3. Change a whole word from anywhere within a word: ciw
4. Insert text directly from registers in insert mode: (C-r)a
- 5. Insert the results of simple arithmetic operations: (C-r)=60*60<enter>
+ 5. Insert the results of simple arithmetic operations: <CTRL-R> followed by
+ =60*60<ENTER>
in insert mode
- 6. Insert the results of system calls: (C-r)=system('ls -1')
+ 6. Insert the results of system calls: <CTRL-R> followed by
+ =system('ls -1')<ENTER>
in insert mode
7. Inspect registers with :reg