Fireship · @fireship

Vim in 100 Seconds

Uploaded February 10, 2021 · Length 11:53

Vim in 100 Seconds

Summary

Learn Vim in 100 seconds and discover its benefits for coding efficiency and productivity.

  • vim
  • vim editor
  • keyboard navigation
  • text editor
  • coding efficiency
  • productivity

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    them a text editor for writing code

  2. 0:02

    where you navigate around the screen

  3. 0:03

    with a keyboard instead of a mouse it's

  4. 0:05

    based on the original unix text editor

  5. 0:07

    vi which came about in 1976 then vi

  6. 0:11

    improved or vim followed it in 1991 with

  7. 0:14

    a bunch of improvements but why in the

  8. 0:16

    age of modern ides would you ever want

  9. 0:18

    to use a keyboard-based text editor when

  10. 0:21

    you write code all day every day your

  11. 0:22

    fingers should be glued to the keyboard

  12. 0:24

    at all times every time you touch the

  13. 0:26

    mouse your productivity declines

  14. 0:28

    learning to code with them is like

  15. 0:29

    learning to play an instrument it'll be

  16. 0:31

    painful at first but that pain will lead

  17. 0:33

    to more precise and productive code

  18. 0:35

    editing in the future them runs in the

  19. 0:37

    terminal and it's installed on almost

  20. 0:38

    every machine and at some point you'll

  21. 0:40

    likely find yourself accidentally

  22. 0:42

    dropped into them with no way to escape

  23. 0:47

    if you find yourself there you can quit

  24. 0:48

    them by typing colonqueue that will

  25. 0:50

    close an unmodified file or if it has

  26. 0:52

    been modified you can use cubebang to

  27. 0:55

    throw away your changes or wq to write

  28. 0:58

    the changes and then quit now that we're

  29. 1:00

    out let's use them to open up a file

  30. 1:02

    currently we're in normal mode but we

  31. 1:04

    can toggle between different modes like

  32. 1:06

    insert visual and command line depending

  33. 1:09

    on what we're trying to do we can move

  34. 1:10

    around the text with the arrow keys or

  35. 1:12

    the letters h j k l if we find a

  36. 1:14

    character we want to delete we can hit x

  37. 1:16

    or double d to quickly delete an entire

  38. 1:19

    line if that was a mistake hit u to undo

  39. 1:22

    it now currently the document is kind of

  40. 1:23

    hard to read so let's add line numbers

  41. 1:25

    by running colon set number and now we

  42. 1:28

    can navigate to any line with colon

  43. 1:29

    number now if we want to change some

  44. 1:31

    text we need to go into insert mode by

  45. 1:33

    hitting i and that frees up the keyboard

  46. 1:35

    for us to type into the document once

  47. 1:37

    we're done modifying our code we can hit

  48. 1:39

    the escape key to go back to normal mode

  49. 1:41

    but now like any good developer we need

  50. 1:44

    to copy and paste some code in here from

  51. 1:45

    stack overflow we can paste from the

  52. 1:47

    system clipboard by entering plus p into

  53. 1:50

    vim and now that our software is

  54. 1:51

    complete we can hit colon w to save it

  55. 1:54

    then run the program directly from bim

  56. 1:56

    with colon bang followed by the shell

  57. 1:58

    command we want to run congratulations