Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 07-24-2010, 02:05 PM   #1
Senior Member
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,604

Rep: Reputation: 51
vim and its swap file(s).

linux kernel 2.6, Slackware 12.0 (GNU).

Sometimes, when I load a file (text file) with vim, I am notified by vim the following way.
Swap file ".text_file_1.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:
As I must still get familiarized with vim and its monstrous manual (man pages), at that point what I do is to try to exit vim leaving things untouched and, then, use some linux tool (e.g. diff) to investigate what happens with the file in question or what is the most convenitn course of action.

But I have always the terrible doubt: do I press Q or do I press A? It is because of this that I write this post. Regards.

EDIT: I know I can do 'info vim' and, with a bit of luck, find out the information I'm looking for. But my experience with the vim manual tells me it is rather improbable to find it but with a great deal of ingenuity and effort.
Old 07-24-2010, 02:26 PM   #2
Registered: Feb 2009
Location: New Delhi
Distribution: Linux mint,Ubuntu,Debian,RHEL 5,slackware 13.1, free BSD,solaris.
Posts: 186
Blog Entries: 3

Rep: Reputation: 33
vim is a great editor if you want to leave things unchanged try
this will open the file in the read only mode that is no changes can be made
then try quitting vim by


if u find your file as it is you left last time you can delete this swap file

Old 07-24-2010, 02:49 PM   #3
Senior Member
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,604

Original Poster
Rep: Reputation: 51
Perhaps I must make myself a bit clearer: there are files
text_file_1~ and
.text_file_1.swp. In addition,
text_file_1.bak, a result of my sometimes booting M$-DOS.
Before I run vim, the set of all four files is in a certain state. Let us call it State_1. Then I get vim's notification when trying to load the file ('vim text_file_1'). Now, by exiting vim, the set will be in a new state. Let's call it State_2.

And what I want to do is this: exit vim in such a way that State_1 = State_2. So, my question is: do I quit ('Q') or do I abort ('A'). Any suggestion will be welcome. Thanks for reading.

EDIT: if vim had a man page, I could simply look for the string 'abort' and, with a little luck, I would have vim telling me exactly what Abort does. Unfortunately, all there is in my hard disk/optical medium is the info tex file. I mean: all I can do is 'info vim'.

Last edited by stf92; 07-24-2010 at 03:07 PM.
Old 07-25-2010, 01:08 AM   #4
LQ Newbie
Registered: Nov 2008
Posts: 4

Rep: Reputation: 2
Start vim and try this command
Old 07-25-2010, 01:23 AM   #5
Senior Member
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,604

Original Poster
Rep: Reputation: 51
Thanks a lot. Regards.


swap, vim

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can swap file or a swap partition be mounted and read? Mr-Bisquit Linux - General 3 06-08-2009 02:16 PM
Editor comparison: vim VS vim-lite, Cleaning vim Ruler2112 *BSD 4 04-13-2009 04:26 PM
vim always says swap file already exists for a particular file leftty Linux - Software 1 09-13-2008 01:53 PM
swap space (or) swap file yusufs Linux - Newbie 8 07-17-2008 02:02 AM
Need Help Increasing Swap by creating a swap file froggo Red Hat 3 06-13-2006 08:04 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:47 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration