Productive text editing with Vim

35
Productive Text Editing with Vim Bryan Bibat pangkaraniwang developer

description

Quick lightning talk for PyConPH 2012

Transcript of Productive text editing with Vim

Page 1: Productive text editing with Vim

Productive Text Editing with Vim

Bryan Bibatpangkaraniwang developer

Page 2: Productive text editing with Vim

Really old text-editors

vi – 35 years old

vim – 20 years old

Page 3: Productive text editing with Vim

Present in most *nix machines

Page 4: Productive text editing with Vim

Not just a weird editor with an “Insert mode”

Page 5: Productive text editing with Vim

i – insert mode

<esc> – normal mode

:e – open file

:w – write

:q – quit

Page 6: Productive text editing with Vim

vi – a language for editing

Page 7: Productive text editing with Vim

Tip 1:

Use insert mode only as needed.

Page 8: Productive text editing with Vim

Tip 8:

Plugins are fun.

Page 9: Productive text editing with Vim

Tip 3:

Normal mode is faster for navigation.

Page 10: Productive text editing with Vim

Tip 2:

“i” is not the only way to go to insert mode.

Page 11: Productive text editing with Vim

i – insert mode at currenta – (append) insert at next

I – insert at beginningA – append at end of line

Page 12: Productive text editing with Vim

o – new line at nextO – new line before

Page 13: Productive text editing with Vim

Tip 3:

Normal mode is faster for navigation.

Page 14: Productive text editing with Vim

Tip 3.1:

Feel free to use the arrow keys over h-j-k-l (though you

shouldn't use them much).

Page 15: Productive text editing with Vim

0 – beginning of line$ – end of line

w – next word

e – end of next wordb – prev word

f[char] – find char on same linet[char] – 'til char

Page 16: Productive text editing with Vim

* – next same word# – prev same word

Page 17: Productive text editing with Vim

/[pattern] – search for pattern?[pattern] – search backward

n – nextN – previous

Page 18: Productive text editing with Vim

Tip 4:

Learn the many text manipulation commands.

Page 19: Productive text editing with Vim

. – repeat last actionu – undo

<ctrl>r – redo

Page 20: Productive text editing with Vim

y – yank (copy)

Page 21: Productive text editing with Vim

Tip 4.1:

Using certain commands twice will apply the command to the

current line.

Page 22: Productive text editing with Vim

d – deletec – change (go to insert)

Page 23: Productive text editing with Vim

Tip 5:

You must learn combining commands with motion

commands.

Page 24: Productive text editing with Vim

ct[space] - replace everything until space

Page 25: Productive text editing with Vim

Tip 6:

Visual mode allows you to select text.

Page 26: Productive text editing with Vim

v – enter visual mode

V – enter visual line mode

Page 27: Productive text editing with Vim

Tip 7:

Split screen and tabs can make programming more convenient.

Page 28: Productive text editing with Vim

:split – horizontal split:vsplit – vertical split

ctrl-w[direction] – switch

:tabnew – new tabgt – change tab

Page 29: Productive text editing with Vim

Tip 8:

Plugins are fun.

Page 30: Productive text editing with Vim

Tip 9:

Learn a new thing every day/week.

Page 31: Productive text editing with Vim
Page 32: Productive text editing with Vim
Page 33: Productive text editing with Vim

Thank you for listening!

github.com/bryanbibat@bry_bibat

pd.bryanbibat.net

Page 34: Productive text editing with Vim
Page 35: Productive text editing with Vim

Thank you for listening!

github.com/bryanbibat@bry_bibat

pd.bryanbibat.net