Slide 1

Slide 1 text

❤ WebStorm 1

Slide 2

Slide 2 text

@nicknisi 2

Slide 3

Slide 3 text

3

Slide 4

Slide 4 text

❤ WebStorm Vim 4

Slide 5

Slide 5 text

5

Slide 6

Slide 6 text

❤ WebStorm Vim Minecraft 6

Slide 7

Slide 7 text

But I NEED an IDE 7

Slide 8

Slide 8 text

No you don't 8

Slide 9

Slide 9 text

Why vim? • highly customizable • runs everywhere • works with any programming languages • scriptable 9

Slide 10

Slide 10 text

10

Slide 11

Slide 11 text

start the timer 11

Slide 12

Slide 12 text

Install vim 12

Slide 13

Slide 13 text

(it's probably already there) 13

Slide 14

Slide 14 text

brew install macvim --override-system-vim 14

Slide 15

Slide 15 text

Features 15

Slide 16

Slide 16 text

Modal editing 16

Slide 17

Slide 17 text

Modal editing Change the meaning of the keys in each mode of operation • Normal mode - navigate the structure of the file • Insert mode - editing the file • Visual mode - highlight portions of the file to manipulate at once • Ex mode - command mode 17

Slide 18

Slide 18 text

Normal mode 18

Slide 19

Slide 19 text

DON'T USE ARROW KEYS 19

Slide 20

Slide 20 text

DON'T USE THE MOUSE 20

Slide 21

Slide 21 text

You're a programmer. Strive to be lazy. 21

Slide 22

Slide 22 text

h j k l left up down right 22

Slide 23

Slide 23 text

• ^E - scroll the window down • ^Y - scroll the window up • ^F - scroll down one page • ^B - scroll up one page • H - move cursor to the top of the window • M - move cursor to the middle of the window • L - move cursor to the bottom of the window • gg - go to top of file 23

Slide 24

Slide 24 text

Elite! 24

Slide 25

Slide 25 text

The secret sauce 25

Slide 26

Slide 26 text

The secret sauce • text objects and motions • the DOT command • macros 26

Slide 27

Slide 27 text

Text objects and motions 27

Slide 28

Slide 28 text

Think of a file as more than individual characters 28

Slide 29

Slide 29 text

text objects • w - words • s - sentences • p - paragraphs • t - tags1 1 tags available in XML/HTML files 29

Slide 30

Slide 30 text

Motions • a- all • i - in • t - 'til • f - find forward • F - find backward 30

Slide 31

Slide 31 text

Combine with comands 31

Slide 32

Slide 32 text

Commands • d - delete (also cut) • c - change (delete, then place in insert mode) • y - yank (copy) • v - visually select 32

Slide 33

Slide 33 text

{command}{text object or motion} 33

Slide 34

Slide 34 text

diw delete in word 34

Slide 35

Slide 35 text

caw change all word 35

Slide 36

Slide 36 text

yi) yank all text inside parentheses 36

Slide 37

Slide 37 text

va" visually select all inside doublequotes Including doublequotes 37

Slide 38

Slide 38 text

Repetition The DOT command . 38

Slide 39

Slide 39 text

Repeat the last command 39

Slide 40

Slide 40 text

that's it 40

Slide 41

Slide 41 text

but it's powerful 41

Slide 42

Slide 42 text

Additional commands • dd / yy - delete/yank the current line • D / C - delete/change until end of line • ^ / $ - move to the beginning/end of line • I / A - move to the beginning/end of line and insert • o / O - insert new line above/below current line and insert 42

Slide 43

Slide 43 text

Try and make actions repeatable Practice it 43

Slide 44

Slide 44 text

Not everything is repeatable at least with the DOT command 44

Slide 45

Slide 45 text

MACROS 45

Slide 46

Slide 46 text

Macro A sequence of commands recorded to a register 46

Slide 47

Slide 47 text

Record a macro • q{register} • (do the things) • q Play a macro • @{register} 47

Slide 48

Slide 48 text

Plugins 48

Slide 49

Slide 49 text

Plugins • vundle - plugin manager • nerdtree - file drawer • ctrlp - fuzzy file finder • fugitive - git tool • syntastic - syntax checker / linter 49

Slide 50

Slide 50 text

But My IDE does more 50

Slide 51

Slide 51 text

Vim is extemely customizable Plugins tailor vim to your needs 51

Slide 52

Slide 52 text

But we can still do more 52

Slide 53

Slide 53 text

53

Slide 54

Slide 54 text

vim + tmux 54

Slide 55

Slide 55 text

tmux brew install tmux 55

Slide 56

Slide 56 text

What is tmux? • Terminal multiplexer • View and control multiple consoles • Preconfigure environments 56

Slide 57

Slide 57 text

tmux new-session -s {session-name} 57

Slide 58

Slide 58 text

tmux new-session -s pasta 58

Slide 59

Slide 59 text

~/.tmux.conf - tmux configuration • configure tmux # unbind default prefix and set it to Ctrl+a unbind C-b set -g prefix C-a bind C-a send-prefix 59

Slide 60

Slide 60 text

There's a lot that tmux can do 60

Slide 61

Slide 61 text

Synchronize-panes 61

Slide 62

Slide 62 text

Create splits on the fly 62

Slide 63

Slide 63 text

tmux + vim = ❤ 63

Slide 64

Slide 64 text

benmills/vimux Interact with tmux from vim 64

Slide 65

Slide 65 text

Execute commands from vim in a split :call VimuxRunCommand("grunt test") Map the commands to a key nmap z :call VimuxRunCommand("grunt test") 65

Slide 66

Slide 66 text

I ❤ vim and I think you will, too 66

Slide 67

Slide 67 text

Learn your editor well (even if it's not vim) 67

Slide 68

Slide 68 text

Don't copy someone else's configuration Make it your own 68

Slide 69

Slide 69 text

But share your configuration 69

Slide 70

Slide 70 text

dotfiles • Share your configuration • Steal ideas from others • nicknisi/dotfiles Others • bryanforbes/dotfiles • jason0x43/dotfiles 70

Slide 71

Slide 71 text

Keep practicing 71

Slide 72

Slide 72 text

❤ https://github.com/nicknisi/vim-workshop 72