This Lesson is for Members

Subscribe today and get access to all lessons! Plus direct HD download for offline use, enhances transcripts, member comment forums, and iTunes "podcast" RSS feed. Level up your skills now!

Unlock This Lesson

Already subscribed? Sign In

Autoplay

    The Vim Config file

    Mike HartingtonMike Hartington

    Now that you know how to enable features in Vim, let's store all of them in one place so we don't need to constantly set them all the time.

    vimVim
    Code

    Code

    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
    Transcript

    Transcript

    00:01 In our last lesson, we looked at how we can set of Vim's options once we have the editor running. While this works, it's not ideal. If we were to quit the editor and, then, start it back up again, we'd have to go back and reset all those options all over.

    00:19 Instead, we can create a Vim config file called .vimrc and store all of our options there. This file sits in our home directory and will be run every time we start Vim. Let's quit this file and, then, start a new Vim session.

    00:36 This time, we're going to create our Vimrc file. To start off our RCFile, we'll add the original options for syntax highlighting and line numbers. Let's also enable some file type detection and some features to expand tabs into two spaces.

    01:01 Lastly, we'll enable being able to backspace over essentially anything. With these settings in place, we'll save and quit Vim, then open our sample.js file again. Now we have all these settings in place, and we didn't need to enable them one by one.

    01:23 The Vimrc file can be as minimal as the one we've just created or much more complex, loading other scripts that add more functionality to the editor.

    Discuss

    Discuss