Editing like a Vi person

Photo by Nubelson Fernandes on Unsplash

Enter the INSERT mode

Notice we have been moving around with commands, so we are in the command mode, or NORMAL mode. To edit, we need to switch to a INSERT mode. Type the letter i , voilà now you can start to type like without Vi.

I love typing, so I type type type.
^ start here
I love typing, so I type type type.
_ switch to insert
I love typing, so I type type type.
_ add a space

Exit the INSERT mode

In the INSERT mode, sooner than later you will discover a small catch. You can’t move around as before using the commands, such as j. But you might revert back to use the arrow keys, since you find those keys actually work.

More ways to enter INSERT

Normally these are the brutal forces to switch between INSERT and NORMAL mode:

i
enter INSERT mode from NORMAL mode
ESC
exit INSERT mode back to NORMAL mode
i
insert before the cursor
I (shift+i)
insert at the start of the line
a
insert after the cursor
A (shift+a)
insert after the end of the line
o
insert a new line below the current line
O (shift+o)
insert a new line above the current line
ea
insert at the end of the current word

More ways to exit INSERT

When we are done with the editing, we want to go back to the NORMAL mode, we do a ESC. However there’s not many variations to exit than enter. I don’t know why yet.

Ctrl-[
enter NORMAL mode
Ctrl-c
enter NORMAL mode
jk
remap the commands

Summary

Now you can move like a Vi person and edit like a Vi person, you are literally a Vi person. Please have some fun, keep in mind, it’s all about practice and explore the best way you can to make it work for you. Once it does, it makes you cool.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Fang Jin

Fang Jin

Front-end Engineer, book author of “Designing React Hooks the Right Way” sold at Amazon.