Configure Gvim backup files on Windows

Reading Time: 1 minute


This short post is how to move vim editor ~ files on Windows from your working directory.

I enjoy using vim because I write code much faster in it. It took some practice to achieve that, but now I am at position to not make jokes about vim editor, but to be more effective for my clients. Sometimes I need to use client computer, which usually means Windows operating system. First thing, I install Gvim, vim for windows.

After I run it, I first go to cmd mode

esc + :

and type


which gives you folder navigator. Then I move to git repository.

On windows, this folder becomes default folder for vim ~ (backup) files. This is not productive, because every file that you are working on, gets duplicate that starts with ~. As you still want to keep those backups, you need to edit vim config file, famous vimrc. It took me some time to find it on Windows (for any unix derivate this is your home folder). So I finally found it:

C:\Program Files (x86)\Vim\_vimrc

Not so fast, my young one. This file can be edited only as administrator, so you need to open it using Notepad++ in order to get info window that you need to open it as administrator. Now you can add to _vimrc following lines at the end:

set backupdir=~/vimtmp,.

set directory=~/vimtmp,.

set noundofile

Simple as that. Your repository folder is free of ~ files and you still have your backups!

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Karlo Smid

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.