-
What is vim (also known as VI)? - An Editor! Like Sublime, TextMate etc.
-
Show of hands for people who use vim:-
- Every day? (Kind of expected)
- Ocassionally? (First part boring)
- Never? (Comfortable at the command-line?)
-
Format of this talk - [TOPIC, PRACTICAL FREESTYLE, TOPIC... etc]. Why PRACTICAL FREESTYLE TIME? Because I didn't get time to create some practical instructions. LEARNING IS IN DOING - ESPECIALLY WITH VIM.
-
What this talk is not
- A vim vs. Sublime talk
- A vim vs. TextMate talk
- A vim vs. IDE talk
-
I want to show you how I use vim
-
Why do few people use vim?
- Large barrier to entry
-
Why learn vim?... if it's so much pain
- Get more done with less keystrokes
- You want to reach for your mouse less!
- Lightweight
- Highly configurable and very powerful
-
I don't want this to put you off!, but learing VIM is a longterm commitment. To become an expert you need to be willing to learn a little bit more each day.
-
Use a Cheatsheet! You're not going to remember everything you learn here.
-
Let's get started:
- First off - Configure vim with my .vimrc setup.
- Then - Jump into learning the basics.
- Good news: You should already have vim installed!
- Talk about how vim is configured
- Talk about how to backup configuration
- Talk about how to install a new configuration from scratch
- Talk about vim plugins
- Talk about vundle
- RE-ENABLE cursor keys??
- Open a new file (normal mode)
- Add some text (insert mode)
- Copy and paste some text (visual mode)
- Save it (command mode)
- Normal Mode (Explain)
- Insert Mode (Explain)
- Visual Mode (Explain)
- Command-line Mode (Explain)
- i (move into insert mode on current character)
- a (moves into insert mode and moves to next character)
- o (moves into insert mode, creates a new line and moves cursor to it)
- ESC (move you back to Normal mode)
[[ PRACTICAL FREESTYLE TIME ]]
Motions and Operators are performed in Normal mode.
- h (left)
- j (down)
- k (up)
- l (right)
Why? Hands on the home row.
- Very hard to get use to - I wouldn't recommend it at the start because it heightens the barrier to entry.
- Turn off the cursor keys if you really want it to sink in.
Other Motions
- w (forward word)
- b (back word)
- $ (end of line)
- ^ (start of line)
Numbers with Motions
- 3w (forward three words)
- 2b (back two words)
Operators
Here are a few:
- d (delete)
- c (change)
- y (yank)
- dw (delete a word)
- d3w (delete three words)
- y3w (copy/yank three words)
- cw (delete a word - deletes and puts into insert mode)
- d$ (delete to end of line)
Special operations
- dd (delete current line)
Now's a good time for a...
[[ PRACTICAL FREESTYLE TIME ]]
Pair Text Objects
- i"
- i(
- i{
Word Text Objects
- iw = Current Word
- aw = Current Word plus one space
THESE ARE ONLY OF USE WHEN USED WITH AN OPERATOR
SO:
- ci"
- di(
- viw
etc.
- :e
- ctrlp Plugins
- NERDtree plugin
- :split
- :vsplit
- /
- n (next match forwards)
- N (next match backwards)
-
ctrlp
- \l
- to open in split window
-
nerdtree
- :NERDtree
-
vim-rails
-
gf
-
:Emodel
-
:Eview
-
:Econtroller
-
:Smodel
-
:Sview
-
:Scontroller
-
-
vim-easymotion
- \w
-
gundo
- \u