Question: I'd like to modify my `.vimrc` to read the value of a variable from an external file. How can I do this?

Specifically, a friend and I share a git repo with our `.vim` files, but there are a few small differences in what we want in our configs. So most of the file is common, but we use if statements to determine whether to load user-specific sections, like this:

```
let whoami = "user2"
if whoami == "user1"
...

```

After checking our common `.vimrc` out of source control, we each have to change the `let whoami` assignment so our own section will be loaded. Instead, I'd like to keep a separate file, which can be different for each of us, and from which vim will load that variable value.

Maybe another angle on this is: **Will vim automatically read all the files in my `.vim` directory?** If so, we could each put a symlink in there called username.vim, and link that to an external file that would be different for each of us.

Answer: 
Using a try/catch
-----------------

Since asking this question, I've come up with another use case for loading an external file: machine-specific tweaks.

Since I may or may not need to make tweaks on a given machine, I'm using a `try/catch` to load the external file; if there's no such file, I let it fail silently.

```
" If there are any machine-specific tweaks for Vim, load them from the following file.
try 
  source ~/.vimrc_machine_specific
catch
  " No such file? No problem; just ignore it.
endtry 

```
the name of the logged-in user is available in the $USER environment variable. you can access that variable easily:

```
:echo $USER

```

so, just use

```
execute "silent! source vimrc." . $USER

```

in your vimrc and put your user specific settings into 

```
vimrc.joe

```

or whatever your login-name is