LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices

Reply
 
LinkBack Search this Thread
Old 07-24-2010, 02:05 PM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 2,914

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


linux kernel 2.6, Slackware 12.0 (GNU).

Hi:
Sometimes, when I load a file (text file) with vim, I am notified by vim the following way.
Code:
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
rahulkya
Member
 
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
[o]
this will open the file in the read only mode that is no changes can be made
then try quitting vim by

:q!

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

RahulKumar07
reform.co.nr
 
Old 07-24-2010, 02:49 PM   #3
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 2,914

Original Poster
Rep: Reputation: 45
Perhaps I must make myself a bit clearer: there are files
text_file_1,
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
perforser
LQ Newbie
 
Registered: Nov 2008
Posts: 4

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

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


Reply

Tags
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
Trackbacks are Off
Pingbacks are On
Refbacks are 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


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

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