Help: swap file created in vim each time I am editing code ?

19 views
Skip to first unread message

Kunal Chauhan

unread,
May 2, 2020, 11:59:30 AM5/2/20
to vim...@googlegroups.com
Hi Team,

I am facing issue that each time a swp file is created as I am editing code.



Description is below :

 

(1) Another program may be editing the same file.  If this is the case,

    be careful not to end up with two different instances of the same

    file when making changes.  Quit, or continue with caution.

(2) An edit session for this file crashed.

    If this is the case, use ":recover" or "vim -r /home/divyanshu/kunal/madLte/vRSC

-Client/oam/lte_tr069/cwmp/common/include/map_glue.h"

    to recover the changes (see ":help recovery").

    If you did this already, delete the swap file "/home/divyanshu/kunal/madLte/vRSC

-Client/oam/lte_tr069/cwmp/common/include/.map_glue.h.swp"


--
Thanks with Regards!

Kunal Chauhan
Mob:09813614826
Mob:08860397903

George Dinwiddie

unread,
May 2, 2020, 12:25:40 PM5/2/20
to vim...@googlegroups.com
Kunal,

On 5/2/20 11:59 AM, Kunal Chauhan wrote:
> Hi Team,
>
> I am facing issue that each time a swp file is created as I am editing code.

The .swp file is a normal part of vim operation. If you exit the file in
a normal fashion, vim will delete the .swp file.

>
>
>
> Description is below :
>
> (1) Another program may be editing the same file.  If this is the case,
>
>     be careful not to end up with two different instances of the same
>
>     file when making changes.  Quit, or continue with caution.

If you open another window on the same file, then both windows will be
fighting to edit the same file with indeterminate results.

>
> (2) An edit session for this file crashed.
>
>     If this is the case, use ":recover" or "vim -r
> /home/divyanshu/kunal/madLte/vRSC
>
> -Client/oam/lte_tr069/cwmp/common/include/map_glue.h"
>
>     to recover the changes (see ":help recovery").
>
>     If you did this already, delete the swap file
> "/home/divyanshu/kunal/madLte/vRSC
>
> -Client/oam/lte_tr069/cwmp/common/include/.map_glue.h.swp"

If you exit without letting vim do this cleanup, you'll get that warning
when you reopen the file. This can happen if you shut down your computer
with vim windows open. Exit all files before terminating vim and this
won't happen.

- George

--
----------------------------------------------------------------------
* George Dinwiddie * http://blog.gdinwiddie.com
Software Development http://www.idiacomputing.com
Consultant and Coach
----------------------------------------------------------------------

Charles Campbell

unread,
May 4, 2020, 1:30:17 PM5/4/20
to vim...@googlegroups.com
If you insist on being unable to recover from various issues, you can: 
:set noswf  .  That will turn swapfiles off.

Regards,
Chip Campbell

Kunal Chauhan

unread,
May 4, 2020, 1:33:40 PM5/4/20
to vim...@googlegroups.com
This can be happen ? If my friend and me both has open same file remotely on same server. If this is case then what action will be the safer?

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/9f549c70-6d02-fd94-d784-4bd9f5505b13%40drchip.org.

George Dinwiddie

unread,
May 4, 2020, 2:02:36 PM5/4/20
to vim...@googlegroups.com, Kunal Chauhan
Kunal,

On 5/4/20 1:33 PM, Kunal Chauhan wrote:
> This can be happen ? If my friend and me both has open same file
> remotely on same server. If this is case then what action will be the safer?

Vim is not designed for simultaneous editing of the same file. If two
instances of vim are editing the same file, expect there to be some
corruption of the file. This warning alerts you to the fact that this
could happen.

The safest action would be to talk with your friend and coordinate
access to the file.

If you don't need to make changes to the file, you could open it in
read-only mode ('vim -R' or 'view'). This is handy when you want to yank
contents from a file but not modify it.

If you both need to make changes to the same file, the safest thing is
to use two different working directories and a version control system.
You check out the file(s) in your working directory and make the changes
you need. Then you update your working directory from the version
control system, merging any changes to files that were changed by your
and someone else. Check that everything is OK, and then checkin your
changes with the merges.

- George

>
> On 4 May 2020 11:00 p.m., "Charles Campbell" <camp...@drchip.org
> send an email to vim_use+u...@googlegroups.com
> <mailto:vim_use%2Bunsu...@googlegroups.com>.
> <https://groups.google.com/d/msgid/vim_use/9f549c70-6d02-fd94-d784-4bd9f5505b13%40drchip.org>.
>
> --
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google
> Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to vim_use+u...@googlegroups.com
> <mailto:vim_use+u...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vim_use/CACEFAc3za9GJOg0E25fXXGoR6S4p9CGKehfkdKeanOrK3Jzygg%40mail.gmail.com
> <https://groups.google.com/d/msgid/vim_use/CACEFAc3za9GJOg0E25fXXGoR6S4p9CGKehfkdKeanOrK3Jzygg%40mail.gmail.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages