Error analysis of swap file “*. SWP” already exists! When editing files with VIM

When editing a file with VIM, exit the terminal in time out, or close the terminal directly without quitting, resulting in an abnormal exit scenario. The following error will be reported when editing again:
Found a swap file by the name “.test.txt. SWP “
owned by: root dated: Thu Jun 27 14:38:06 2019
file name: ~root/test.txt
modified: YES
user name: root host name: VMcentos
process ID: 20994
While opening file “test.txt”
dated: Thu Jun 27 13:42:52 2019
(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,
(2) An edit session for this file comedown.
If this is the case,
to recover (see “:help recovery”).
If you did this already, delete the swap file “.test.txp “
to avoid this message.
Swap file “.test.txt.swp” already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:
Use LL-A command to check, there is indeed a hidden file, originally when editing the file, the system will copy a temporary file. Test.txt.swap, also will edit this file, the temporary file will be written to the official file when executing: W, the temporary file will be deleted when executing: Q.
Delete the file.test.txt.swap, rm.test.txt.swap

Read More: