This lesson is for PRO members.

Unlock this lesson NOW!
Already subscribed? sign in

The Vim Config file

1:34 Tools lesson by

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.


egghead.io comment guidelines

Avatar
egghead.io

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.

Avatar
Boris

Hi,
thanks for this short videos. Would it be possible to share the .vimrc file used to get the result shown at the very end of the last video ?
Thank you.

Avatar
ephemera

thanks for sharing your .vimrc file! I also found :vsp, :sp, :!, :colorscheme very useful too.

Avatar
Nick Ostrovsky

Hi, how do you autocomplete in shell?

Avatar
Mike

Thats built in. If you start typing the name of anything, you can type the first few letters then hit to complete it

In reply to Nick Ostrovsky
Avatar
Xavier

Great stuff @mike!

In reply to Mike
Avatar
C. Corey Capel

The Tab key will attempt to autocomplete in the shell. Tab will also attempt to autocomplete the text you type when in vim's command mode.

In reply to Nick Ostrovsky
Avatar
Dan

Thanks for the series. Can you do some for plugins?

Avatar
hima

..i went to ur dotfiles github page and ran these statements on my terminal..(Since i already have git, node, npm installed on my mac)

brew tap thoughtbot/formulae
brew install rcm
git clone https://github.com/mhartington/dotfiles.git ~/.dotfiles
cd $HOME
rcup

now my vim is not working..it complaining this...
[dein] Does not work this version of Vim (703).
[dein] Does not work this version of Vim (703).
Error detected while processing /Users/siva/.vimrc:
line 26:
E117: Unknown function: dein#begin

Avatar
skorp

update your vim or install it via brew:
brew install vim --with-lua
add an alias to the new installed vim folder
.bashrc or aliases file if you have one.

alias vim="/usr/local/Cellar/vim/7.4.873/bin/vim"

In reply to hima

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.

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.

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.

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.

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.

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?