Fireship · @fireship
Vim in 100 Seconds
Uploaded February 10, 2021 · Length 11:53
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.
- 0:00
them a text editor for writing code
- 0:02
where you navigate around the screen
- 0:03
with a keyboard instead of a mouse it's
- 0:05
based on the original unix text editor
- 0:07
vi which came about in 1976 then vi
- 0:11
improved or vim followed it in 1991 with
- 0:14
a bunch of improvements but why in the
- 0:16
age of modern ides would you ever want
- 0:18
to use a keyboard-based text editor when
- 0:21
you write code all day every day your
- 0:22
fingers should be glued to the keyboard
- 0:24
at all times every time you touch the
- 0:26
mouse your productivity declines
- 0:28
learning to code with them is like
- 0:29
learning to play an instrument it'll be
- 0:31
painful at first but that pain will lead
- 0:33
to more precise and productive code
- 0:35
editing in the future them runs in the
- 0:37
terminal and it's installed on almost
- 0:38
every machine and at some point you'll
- 0:40
likely find yourself accidentally
- 0:42
dropped into them with no way to escape
- 0:47
if you find yourself there you can quit
- 0:48
them by typing colonqueue that will
- 0:50
close an unmodified file or if it has
- 0:52
been modified you can use cubebang to
- 0:55
throw away your changes or wq to write
- 0:58
the changes and then quit now that we're
- 1:00
out let's use them to open up a file
- 1:02
currently we're in normal mode but we
- 1:04
can toggle between different modes like
- 1:06
insert visual and command line depending
- 1:09
on what we're trying to do we can move
- 1:10
around the text with the arrow keys or
- 1:12
the letters h j k l if we find a
- 1:14
character we want to delete we can hit x
- 1:16
or double d to quickly delete an entire
- 1:19
line if that was a mistake hit u to undo
- 1:22
it now currently the document is kind of
- 1:23
hard to read so let's add line numbers
- 1:25
by running colon set number and now we
- 1:28
can navigate to any line with colon
- 1:29
number now if we want to change some
- 1:31
text we need to go into insert mode by
- 1:33
hitting i and that frees up the keyboard
- 1:35
for us to type into the document once
- 1:37
we're done modifying our code we can hit
- 1:39
the escape key to go back to normal mode
- 1:41
but now like any good developer we need
- 1:44
to copy and paste some code in here from
- 1:45
stack overflow we can paste from the
- 1:47
system clipboard by entering plus p into
- 1:50
vim and now that our software is
- 1:51
complete we can hit colon w to save it
- 1:54
then run the program directly from bim
- 1:56
with colon bang followed by the shell
- 1:58
command we want to run congratulations


