使用Notepad++远程编辑WinSCP中打开的文本文件报错“file xxx does exist anymore”
我原来经常使用notepad++与WinSCP的配合,快速对远程Linux主机上的配置文件进行修改并保存。
最近在我的一台机器上,这个办法居然不灵了,有的时候可以,有的时候就报错:file does exist anymore. 如果keep in editor, 那也就无法保存到远程主机上了。
经过一番搜索,找到了参考资料部分记录的那篇文章。
因为当初乱点了个选项:
导致了这个问题,去掉就好了。
问题的解释如下:
You have the "External editor opens each file in separate window (process)" editor preference option enabled. That's what causing the problem.
The option is by default unchecked and should be checked only when you use an editor that opens each file in a separate process. That is not the case of Notepad++: When you open the file for editing in WinSCP and the Notepad++ is already running, the new Notepad++ instance just delegates the opening to the existing instance and exits. As you have the above option on, WinSCP detects the exit and considers the file to be closed (deleting it).
For details, see WinSCP documentation for Opening more files in a single editor instance.
大致意思是说,这个选项导致了这个问题,因为选项的意思是每次都使用一个新的编辑器的实例(instance)来编辑文件,而notepad++是会代理到已经打开的instance上再开一个tab,而这个代理的过程WinSCP不认,于是就报文件不存在了。
去掉这个选项,问题就解决了。
参考资料
============
WinSCP and Notepad++: File does not exist anymore?
https://superuser.com/questions/989538/winscp-and-notepad-file-does-not-exist-anymore