How do I “source” something in my .vimrc file?

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.vim

:so myStuff.vim

and if myStuff.vim contained these lines

set xx iI just intersted this<C-]>
set yy bbbb4dw

It’s the same as if you typed those commands into Vim

:set xx iI just intersted this<C-]>
:set yy bbbb4dw

The only file sourced by default is the .vimrc(_vimrc on 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 .vimrc like this

 so myPlugin.vim

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)