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

@nicknisi 5

Slide 6

Slide 6 text

But I NEED an IDE 6

Slide 7

Slide 7 text

No you don't 7

Slide 8

Slide 8 text

Why vim? 4 highly customizable 4 runs everywhere 4 works with many programming languages 4 scriptable 8

Slide 9

Slide 9 text

Install vim 9

Slide 10

Slide 10 text

(it's probably already there) 10

Slide 11

Slide 11 text

brew install macvim --override-system-vim 11

Slide 12

Slide 12 text

Features 12

Slide 13

Slide 13 text

Modal editing 13

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

Normal mode 15

Slide 16

Slide 16 text

DON'T USE ARROW KEYS 16

Slide 17

Slide 17 text

DON'T USE THE MOUSE 17

Slide 18

Slide 18 text

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

Slide 19

Slide 19 text

h j k l left up down right 19

Slide 20

Slide 20 text

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

Slide 21

Slide 21 text

Elite! 21

Slide 22

Slide 22 text

The secret sauce 22

Slide 23

Slide 23 text

The secret sauce 4 text objects and motions 4 the DOT command 4 macros 23

Slide 24

Slide 24 text

Text objects and motions 24

Slide 25

Slide 25 text

Think of a file as more than individual characters 25

Slide 26

Slide 26 text

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

Slide 27

Slide 27 text

Motions 4 a- all 4 i - in 4 t - 'til 4 f - find forward 4 F - find backward 27

Slide 28

Slide 28 text

Combine with comands 28

Slide 29

Slide 29 text

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

Slide 30

Slide 30 text

{command}{text object or motion} 30

Slide 31

Slide 31 text

diw delete in word 31

Slide 32

Slide 32 text

caw change all word 32

Slide 33

Slide 33 text

yi) yank all text inside parentheses 33

Slide 34

Slide 34 text

va" visually select all inside doublequotes Including doublequotes 34

Slide 35

Slide 35 text

Repetition The DOT command . 35

Slide 36

Slide 36 text

Repeat the last command 36

Slide 37

Slide 37 text

that's it 37

Slide 38

Slide 38 text

but it's powerful 38

Slide 39

Slide 39 text

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

Slide 40

Slide 40 text

Try and make actions repeatable Practice it 40

Slide 41

Slide 41 text

Not everything is repeatable at least with the DOT command 41

Slide 42

Slide 42 text

MACROS 42

Slide 43

Slide 43 text

Macro A sequence of commands recorded to a register 43

Slide 44

Slide 44 text

Record a macro 4 q{register} 4 (do the things) 4 q Play a macro 4 @{register} 44

Slide 45

Slide 45 text

Plugins 45

Slide 46

Slide 46 text

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

Slide 47

Slide 47 text

But My IDE does more 47

Slide 48

Slide 48 text

Vim is extemely customizable Plugins tailor vim to your needs 48

Slide 49

Slide 49 text

But we can still do more 49

Slide 50

Slide 50 text

50

Slide 51

Slide 51 text

vim + tmux 51

Slide 52

Slide 52 text

tmux brew install tmux 52

Slide 53

Slide 53 text

What is tmux? 4 Terminal multiplexer 4 View and control multiple consoles 4 Preconfigure environments 53

Slide 54

Slide 54 text

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

Slide 55

Slide 55 text

tmux new-session -s pasta 55

Slide 56

Slide 56 text

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

Slide 57

Slide 57 text

There's a lot that tmux can do 57

Slide 58

Slide 58 text

Synchronize-panes 58

Slide 59

Slide 59 text

Create splits on the fly 59

Slide 60

Slide 60 text

tmux + vim = ❤ 60

Slide 61

Slide 61 text

benmills/vimux Interact with tmux from vim 61

Slide 62

Slide 62 text

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

Slide 63

Slide 63 text

I ❤ vim and I think you will, too 63

Slide 64

Slide 64 text

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

Slide 65

Slide 65 text

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

Slide 66

Slide 66 text

But share your configuration 66

Slide 67

Slide 67 text

dotfiles 4 Share your configuration 4 Steal ideas from others 4 nicknisi/dotfiles 67

Slide 68

Slide 68 text

Keep practicing 68

Slide 69

Slide 69 text

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