Feb 16 2019

Learning VIM

In this blog post, I'm going to update it as I continue to learn vim. This post will be a reminder of shortcuts and set ups for making it easy to use and learn.

editor , programming , vim

This year I made it a goal to try to improve my knowledge of using vim. It started to make a bit more sense after watching this Talk on going mouseless with Vim, Tmux, and Hotkeys. The presenter did a good job on walking though the basics.

I created these tables below from the first few slides in his presentation. I use them as reminders on remembering that it’s all about:

Operators + Text Objects + Motions.

4 Modes

Mode                | Keystroke 
Esc                 | Normal Mode
i, a, c             | Insert Mode
v, V, <Ctrl-v>      | Visual Mode
:, /                | Command-line Mode


Keystroke | Action 
c     | change 
d     | delete 
y     | yank into register 
~     | swap case 
gu    | make lowercase 
gU    | make uppercase 
!     | filter to external program 
<     | shift left 
>     | shift right 
=     | indent 

Text Objects

Keystroke | Action 
aw | a word 
iw | inner word 
aW | a WORD 
iW | inner WORD 
ap | a paragraph 
ip | inner paragraph 
ab | a bracket 
ib | inner bracket 
at | a tag block 
it | inner tag block 


Keystroke           | Action 
%                 | go to first matching paren / bracket 
[count]+          | down to first non-blank chat of line 
[count]$          | to end of line 
[count]f/F{char}  | to next occurrence of {char} 
[count]t/T{char}  | to before next occurrence of {char} 
[count]]m         | Go to beginning of next method 
[count]w/W        | go a word / WORD to the right 
[count]b/B        | go a word / WORD to the left 
[count]e/E        | go a word / WORD right 


Keystroke           | Action 
:s/bad/good/g     | changes all words bad to good in the current line 
:6,11s/bad/good/g | makes the same change, but in lines 6 to 11, including 6 and 11 
%s/bad/good/g     | makes the same change in entire file 

Continue Learning

This blog post will continue to get updated as I get familiar with setups and other things with vim.

Note: The Book Matering VIM Quickly has good information. The author breaks down concepts into smaller pieces.

Highly recommend signing up for the emails. The emails sent out are good reminders to keep practicing. The substitute section is from one of the emails.