Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson

Already subscribed? Sign In


    Vim's different modes

    Mike HartingtonMike Hartington

    One of Vim's most unique features are it's different modes. Learn how to use these modes and speed up your editing



    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson


    00:00 Vim is a modal editor, meaning to do anything in the editor you need to be in the correct mode. Now we already went over one of these modes, command mode. To enter command mode, press and hold the shift key and then the colon or semi-colon key, and we'll be brought to a prompt down at the bottom left corner of the editor. From here we can issue any commands we want to the editor. The default mode that Vim starts in is called normal mode.

    00:25 This is where we can navigate around a file using our navigation keys, and manipulate text. The next mode is insert mode. This is the mode we use when we want to insert text. To enter insert mode press the letter I on our keyboard and you'll see a little status indicator in the bottom left telling us we are in insert mode. From here we're free to add as much text as we want. To exit out of insert mode press the escape key on your keyboard. This will return you to normal mode.

    00:58 The last mode is visual mode. This is how we can go about selecting blocks of text from a file. To enter visual mode, press the letter V on our keyboard. Now using our movement keys we can select text from the file. In addition to selecting text one letter at a time, we can select a whole line by pressing shift and then V again. This is visual line mode. Again, to exit out of this, press the escape key. So a quick recap of our modes. Normal modes is the default mode that Vim starts in.

    01:30 To enter command mode press shift and then the color semi-colon key. To enter insert mode, press the letter I. To enter visual mode, press V. To enter visual line mode, press shift V, and then to exit back to normal mode from any other mode, press the escape key.