vim for mere mortals

59
Vim for Mere Mortals @VimIndy 06.2016

Upload: clayton-parker

Post on 08-Jan-2017

174 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Vim for Mere Mortals

Vim forMere Mortals

@VimIndy 06.2016

Page 2: Vim for Mere Mortals

Who am I?@claytron IRL and on the internets

Senior Software Engineer at TinderBox Vimmer ca. 2003

Page 3: Vim for Mere Mortals

is hard retro.

Page 4: Vim for Mere Mortals

Don't rage :quit! just yet...

Page 5: Vim for Mere Mortals

Fundamentals

Page 6: Vim for Mere Mortals

You start by learning the minimal to survive,

then you integrate all the tricks slowly.— Learn Vim Progressively

Page 7: Vim for Mere Mortals

$ vimtutor

Page 8: Vim for Mere Mortals

in Neovim:Tutor

command line$ alias vimtutor='nvim -c Tutor'

Page 9: Vim for Mere Mortals

Terminology

Page 10: Vim for Mere Mortals

A buffer is the in-memory text of a file.A window is a viewport on a buffer.

A tab page is a collection of windows.:help window

Page 11: Vim for Mere Mortals
Page 12: Vim for Mere Mortals
Page 13: Vim for Mere Mortals

Modal Editing

Page 14: Vim for Mere Mortals

NormalVisualSelectInsert

CommandEx

Page 15: Vim for Mere Mortals

How do you generate a random string?

Page 16: Vim for Mere Mortals

Put a first year CS student in front of Vim and tell them to save and exit.

Page 17: Vim for Mere Mortals

#normalmodeproblems

Page 18: Vim for Mere Mortals

Normal Mode

Page 19: Vim for Mere Mortals

Insert Mode

Page 20: Vim for Mere Mortals

Command Mode

Page 21: Vim for Mere Mortals

Help!

Page 22: Vim for Mere Mortals

:help

Page 23: Vim for Mere Mortals

:help help

Page 24: Vim for Mere Mortals

For any topic :help syntasticFor an option :help 'syntastic_ignore_files'For a command :help :SyntasticInfo

Page 25: Vim for Mere Mortals

:helpgrep syntastic.*checker\c

Page 26: Vim for Mere Mortals

:tab help intro

Page 27: Vim for Mere Mortals

1. Help commands *online-help*

*help* *<Help>* *:h* *:help* *<F1>* *i_<F1>* *i_<Help>*<Help> or:h[elp] Open a window and display the help file in read-only mode. If there is a help window open already, use that one. Otherwise, if the current window uses the full width of the screen or is at least 80 characters wide, the help window will appear just above the current window. Otherwise the new window is put at the very top.

Page 28: Vim for Mere Mortals

VimIndy Slack.#vim on Freenode.

Vi and Vim StackExchange.

Page 29: Vim for Mere Mortals

Vim! Do you speak it?

Page 30: Vim for Mere Mortals

:help motion.txt

Page 31: Vim for Mere Mortals

2d3w │││└─ motion ││└─ count │└─ operator └─ count

Page 32: Vim for Mere Mortals

ggguG

the jerry yang treatment.

Page 33: Vim for Mere Mortals

xp

Transpose characters.

Page 34: Vim for Mere Mortals

dw

Delete till end of word.

Page 35: Vim for Mere Mortals

diw

Delete the current word.

Page 36: Vim for Mere Mortals

d2w

Delete two words.

Page 37: Vim for Mere Mortals

dd

Delete a line.

Page 38: Vim for Mere Mortals

d2d

Delete two lines.

Page 39: Vim for Mere Mortals

cw ciw c2w cg_ cG

vw viw v2w vg_ vG

Page 40: Vim for Mere Mortals

68i-<Esc>

Add an ascii bar

Page 41: Vim for Mere Mortals

2d3w │││└─ motion ││└─ count │└─ operator └─ count

Page 42: Vim for Mere Mortals

Arrow Keys?

Page 43: Vim for Mere Mortals

Experienced users prefer the hjkl keys because they are always right

under their fingers.

Page 44: Vim for Mere Mortals

Beginners often prefer the arrow keys,

because they do not know what the hjkl keys do.

Page 45: Vim for Mere Mortals

The mnemonic value of hjkl is clear from looking at the

keyboard.Think of j as an arrow pointing downwards.

— :help motion.txt

Page 46: Vim for Mere Mortals

VIMWIZARD

[1] a man who has magical powers, especially in legends and fairy tales

Page 47: Vim for Mere Mortals

You can use yourMOUSE

Page 48: Vim for Mere Mortals

Use vim-sensible to start out.Or go all in with Vim Bootstrap, Janus or spf13.

Page 49: Vim for Mere Mortals

Plugins

Page 50: Vim for Mere Mortals

Plugin ManagersPathogenVundlevim-plug

vim-addon-managerdein.vimVizardryVimana

Page 51: Vim for Mere Mortals

Install Pluginscall plug#begin()Plug 'tpope/vim-sensible'Plug 'scrooloose/syntastic'call plug#end()

Page 52: Vim for Mere Mortals

Pillaging .vimrc

Page 53: Vim for Mere Mortals

THE END

Page 55: Vim for Mere Mortals

Screencasts

→ Vimcasts→ Derek Wyatt Tutorials

Page 57: Vim for Mere Mortals

Photo Credits Title (B.B. Wijdieks)

Fundamentals (@nobida) Terminology (@nicklockey)

Modal (@chrisobayda) Help (@mountaineer4061)

Help (@carbonated) Do you speak it? (@reallyboring) Arrow Keys (@regocasasnovas)

hjkl (@donpdonp) mouse (@kapy)

Sensible (@matt_gibson) Plugins (@chicagobart) Pillaging (Damian Gadal)

Links (@volvob12b)⬅ This Picture (@rhodes)

Thanks to and

Page 58: Vim for Mere Mortals

Vim for Mere Mortals by claytron is licensed under a Creative Commons Attribution-ShareAlike 4.0

International License.

Page 59: Vim for Mere Mortals

*bar*| To screen column [count] in the current line. |exclusive| motion. Ceci n'est pas une pipe.