【问题标题】:sublime - how to save file on close automaticallysublime - 如何在关闭时自动保存文件
【发布时间】:2023-08-16 14:07:01
【问题描述】:

如何配置 Sublime 2 以自动保存我关闭的文件?它的行为应该类似于,用户打开文件、进行编辑、关闭文件,并且即使用户没有手动保存编辑的文件,编辑也会自动保存。

这很接近,但我希望它在文件关闭时保存而不是失去焦点。

https://docs.sublimetext.io/reference/settings.html
save_on_focus_lost

【问题讨论】:

  • 为什么你接受了一个提示因此不会自动保存文件的答案?

标签: editor text-editor sublimetext2


【解决方案1】:

您希望在仅关闭一个文件或所有打开的文件(窗口)都关闭时神奇地保存文件吗?在第一种情况下,我建议将每个文件打开到 SublimeText2 的不同窗口中。

在第二种情况下,您正在寻找 hot_exit :Preferences.sublime-settings

// Exiting the application with hot_exit enabled will cause it to close
// immediately without prompting. Unsaved modifications and open files will
// be preserved and restored when next starting.
//
// Closing a window with an associated project will also close the window
// without prompting, preserving unsaved changes in the workspace file
// alongside the project.
"hot_exit": true,

除了remember_open_files,您还可以在退出时自动保存并选择下次是否打开这些文件。

【讨论】:

  • 但将 hot_exit 设置为 true 是默认设置,不会改变任何内容。它。设置“hot_exit”:false,不自动保存,提示。并且将 remember_open_files 设置为 true 或 false 对其提示的事实没有任何影响。所以,不是自动的。
最近更新 更多