15
9

More than 3 years have passed since last update.

vimで「E325:ATTENTION」エラーの対処法

Last updated at Posted at 2020-08-22

vimでエラー

vim操作でエラーが出たときの対処法をメモしておきます。

# vim .bash_profile

こちらのcmdを打つと下記のようなエラーが出てきました。

E325: ATTENTION
Found a swap file by the name ".bash_profile.swp"
          owned by: hogehoge   dated: 木  6 27 13:52:56 2019
         file name: ~hogehoge/.bash_profile
          modified: YES
         user name: hogehoge   host name: hogehoge.local
        process ID: 25913
While opening file ".bash_profile"
             dated: 水  7 10 10:29:16 2019
      NEWER than swap file!

(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 .bash_profile"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file ".bash_profile.swp"
    to avoid this message.

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

原因

原因は以前の操作時に保存せず消してしまったかららしいです。
終了するときは下記のリンクのcmdを使いましょう。
https://qiita.com/kon_yu/items/b8864ff566b8b67a9810

対処法

.bash_profile.swpができているので下記のコマンドで探す

# ls -la 
-rw-r--r--     1 hogehoge  staff  12288  6 27  2019 .bash_profile.swp

みつかりました。

# rm .bash_profile.swp

これで.bash_profile.swpのエラーが消え通常どうりの操作ができるようになりました。

15
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
9