Upgrade to Pro — share decks privately, control downloads, hide ads and more …

:vim! theory + practice

:vim! theory + practice

vim can frustrate but also delight. here, then, is everything you need to get rolling with vim and get over the frustrating bits and skip to the delight. some material may not be suitable for emacs users.

as presented as Ozalid 2016.

Transcript

  1. :vim! theory + practice @jm3

  2. :help theory

  3. :history bill% ls ~/1976

  4. :why vim?

  5. :turing-complete

  6. :turing-complete

  7. any editor will “get you there”

  8. Vim is a stick-shift 2 1 3 4 R

  9. :taoist view

  10. jm3’s “Tao of Vim” • minimal distractions • to know

    vim is to know unix • in vim, editing is programming • vim is everywhere
  11. :beware false-prophets •“don’t use the mouse” •“don’t use the arrow

    keys” •“use my dotfiles” :) see Yehuda’s “Everyone Who Tried to Convince Me to use Vim was Wrong”
  12. :review theory ~ any editor will get you there ~

    stick shift ~ tao: + minimalism + to know vim is to know unix + editing is programming + vim is everywhere ~ beware “false prophets”: + mouse == OK, arrow keys are fine
  13. :help practice :q :qq :q!Q :1qqZZ!q :WTF how do i

    get out of here?
  14. :basics! launch + save + exit

  15. :basics foo.rb :e Edit foo.rb

  16. :basics : w Write

  17. :basics eXit : x

  18. :basics Quit : q

  19. :basics w : Write + Quit q

  20. :basics Z Z GTFO

  21. switching modes…

  22. Command Mode Editing Mode two very different modes Esc

  23. Sphinx of black quartz, judge my vow! i a o

    entering Edit mode:
  24. Sphinx of black quartz, judge my vow! i a o

    entering Edit mode:
  25. Sphinx of black quartz, judge my vow! i a o

    entering Edit mode:
  26. Sphinx of black quartz, judge my vow! i a o

    entering Edit mode:
  27. Basics review: edit write exit :w :e :x insert append

    ohhhh a i o
  28. :motion!

  29. :motion j h k movement l :masochism

  30. Remember: word + line + block jump + search

  31. :motion w forward word back word b

  32. :motion ⏎ line

  33. :motion ] forward block backward block [

  34. :motion foo / Search

  35. :motion foo ? Search backwards

  36. :motion Go to line number 10 G

  37. :motion G Jump to ”corners” G 1

  38. / Motion review: word + line + block ⏎ w

    b [ ] jump + search 47 G foo
  39. :editing!

  40. :editing d delete change c i insert append a

  41. Commands stack like LEGOs

  42. d w Delete word

  43. d w Delete word

  44. d 3 Delete 3 words w

  45. 3 d Delete 3 words w

  46. w d 3 Delete 3 words

  47. c w Change word

  48. c w Change word

  49. D Delete line

  50. 10 D Delete 10 lines

  51. D 10 Delete 10 lines

  52. foo / d Delete to “foo”

  53. foo / d Delete to “foo”

  54. foo / d Delete to “foo”

  55. :file-slinging!

  56. :file-slinging foo.rb :e Edit foo.rb remember this?

  57. :file-slinging :e Edit some-dir try this! ~

  58. :file-slinging :help NERDTree github.com/tpope/vim-pathogen

  59. :magic powers

  60. Demo ^ (ctl+6) toggle + jump between buffers list buffers

    with :ls jump with 1^
  61. Demo recent files toggle previous file

  62. Demo tab complete anything SuperTab git://github.com/ervandew/supertab

  63. Demo Tabular git://github.com/godlygeek/tabular alignment

  64. Demo outline mode Markdown-Folding git://github.com/nelstrom/vim-markdown-folding

  65. Demo keep your place set cursorline

  66. Demo balance braces %

  67. Demo jsHint highlight JS errors on save git://github.com/Shutnik/jshint2.vim

  68. Demo highlight syntax colorscheme solarized * first thing I wanted

    in a text editor
  69. Demo Vim-Plug + Vundle + pathogen

  70. :wq! @jm3 github.com/jm3/dotfiles