I’ve been working on expanding my vim-foo lately and I’ve run across a couple of plugins (autotag.vim for example) that require them to be “sourced” in my .vimrc file. What exactly does this mean and how do I do it?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Sourcing a file is ‘executing’ it. Essentially, each line of the file is considered a command. Sourcing it is the same as typing each command in order. You source with the command
:source(usually shortened to:so).So if you source
myStuff.vimand if
myStuff.vimcontained these linesIt’s the same as if you typed those commands into Vim
The only file sourced by default is the
.vimrc(_vimrcon windows) so that’s a place you can keep all the commands you use to set up Vim every time.Where it gets interesting is the fact that since a sourced file is just a series of commands, and sourcing is a command, you can source files from your source files. So plugins you use every time could be sourced when you start up Vim by adding a line to your
.vimrclike this