vim Configuring Vim Files and directories

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!


Whatever you do to customize Vim, it should NEVER happen outside of $HOME:

  • on Linux, BSD and Cygwin, $HOME is usually /home/username/,
  • on Mac OS X, $HOME is /Users/username/,
  • on Windows, $HOME is usually C:\Users\username\.

The canonical location for your vimrc and your vim directory is at the root of that $HOME directory:

  • on Unix-like systems

    $HOME/.vimrc       <-- the file
    $HOME/.vim/        <-- the directory
  • on Windows

    $HOME\_vimrc       <-- the file
    $HOME\vimfiles\    <-- the directory

The layout above is guaranteed to work, now and in the future.

Vim 7.4 made it possible to keep your lovely vimrc inside your vim directory. It is really a good idea, if only because it makes it easier to move your config around.

If you use 7.4 exclusively, the following will be enough:

  • on Unix-like systems

  • on Windows


If you want the benefits of a self-contained vim/ but use both 7.4 and an older version, or only an older version, the simplest, future-proof, solution is to put this line and only this line:

runtime vimrc

in this file:

  • on Unix-like systems

  • on Windows


and do your configuration in $HOME/.vim/vimrc or $HOME\vimfiles\vimrc.

Got any vim Question?