Telling Vim not to create swap and backup files.


It should come as no surprise to those who know me that I rely on Vim almost nearly always for any sort of text editing tasks. If you have used Vim before with little more than passing curiosity, you will have noticed and been annoyed by the swap file Vim creates when opening a file and the backup file that is created after committing changes to the file. While there is a very good reason why Vim does that by default, one which you may come to appreciate when things turn sour following a morning you woke up on the wrong side of bed on, it still is pretty annoying to have one extra file with a clumsy extension cluttering up the space whenever you open a file. Well, at least, it always does a splendid job of stomping on my nerves.

There is a way to get around to that, though. There is always a way. The following two directives which would go into the system-wide or user-specific “vimrc” file disable, respectively: a) creation of swap file whenever a file is opened using Vim; b) creation of a backup file whenever an opened file is altered and saved through Vim.

set noswapfile
set nobackup

I plucked these two from Vim Tip #907.

2 thoughts on “Telling Vim not to create swap and backup files.

  1. Pingback: Telling Vim not to create swap and backup files. | Tea Break

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s