Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim Opening File E325 Attention Error

Tags:

vim

git-bash

On Git bash windows, I was editing .bash_profile file and then I decided not to save and closed the bash console. Now when I try to open the .bash_profile using vim, I get E325: Attention error. What should I do to fix this?

like image 798
neo Avatar asked Aug 03 '17 15:08

neo


People also ask

Can I delete SWP file?

Using the swapfile to recover your work doesn't automatically delete it, but if the recovery was successful, it's fine to delete it. Run vim on the file again and you should still get a swapfile dialog, but this time warning that the file is "NEWER than swap file".

How do you recover .SWP file in Linux?

To recover a file, simply open the original file. vim will notice that there is already a . swp file associated with the file and will give you a warning and ask what you want to do. Assuming you have the required privileges to write to the file, "recover" should be one of the options given.

What is a swap file vim?

Swap files store changes you've made to the buffer. If Vim or your computer crashes, they allow you to recover those changes. Swap files also provide a way to avoid multiple instances of Vim from editing the same file.


1 Answers

By closing the console without exiting Vim first, the Vim process got killed, and Vim didn't have a chance to properly shut down. Vim uses swap files to store the last unpersisted changes to a buffer to avoid data loss in case of a crash; you can read the whole story at :help E325.

In your case, as you've consciously closed the console, there probably weren't any pending changes to your .bash_profile [worth saving]. (But there's still the swap file!) Therefore, when prompted

  Swap file ".bash_profile.swp" already exists!
  [O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort, (D)elete it:

answer with D to remove the outdated swap file. Alternatively, you can also search for the .bash_profile.swp (by default, it resides in the same directory as the edited file, likely $HOME in your case) and delete it manually. (It's hidden; use ls -a in Bash, or Windows Explorer.)

In the future, please exit Vim (:qall[!]) before closing the console it runs in, to allow for a clean shutdown.

like image 64
Ingo Karkat Avatar answered Oct 20 '22 18:10

Ingo Karkat