I was watching files with fsnotify which is a Go library, and I found there are many events triggered when I save a file.
Why does Sublime Text do so much?
2013/12/17 20:46:25 event: "parser.go": MODIFY 2013/12/17 20:46:25 event: ".subl317.tmp": MODIFY 2013/12/17 20:46:25 event: "parser.go": DELETE 2013/12/17 20:46:25 event: ".subl317.tmp": DELETE 2013/12/17 20:46:25 event: "parser.go": CREATE 2013/12/17 20:46:27 event: "parser.go": MODIFY 2013/12/17 20:46:27 event: ".subl3aa.tmp": MODIFY 2013/12/17 20:46:28 event: ".subl28d.tmp": CREATE 2013/12/17 20:46:28 event: ".subl28d.tmp": MODIFY 2013/12/17 20:46:28 event: "parser.go": MODIFY 2013/12/17 20:46:28 event: ".subl3aa.tmp": MODIFY 2013/12/17 20:46:28 event: "parser.go": DELETE 2013/12/17 20:46:28 event: ".subl3aa.tmp": DELETE
If you're using Windows, your session files should be here: C:\Users[your computer name]\AppData\Roaming\Sublime Text 3\Local.
Setting up Sublime's autosave People often forget to save files (I've been guilty of it myself), autosave will make sure your files are saved, even if you forget.
Sublime Text is a commonly-used text editor used to write Python code. Sublime Text's slick user interface along with its numerous extensions for syntax highlighting, source file finding and analyzing code metrics make the editor more accessible to new programmers than some other applications like Vim and Emacs.
Save a File with Sublime TextIn Sublime Text's top menu bar, choose File > New File. An untitled, blank file will appear. Next, choose File > Save or Save As.
With Sublime Text, choose File > New File from its top menu bar in order to save a file calledUntitled. blank line. Choosing File > Save or Save As will be the next step. The file extension has a big impact on how it works. How Do I Save And Run Code In Sublime Text?
However, you could save SweetWebsite.sublime-project in myhomedir/Desktop for all Sublime cares, and it would work exactly the same way. While it is possible to have unsaved files in a project, of course it's always best to save your work early and often, so you don't lose anything.
Every time you have something open in SublimeText, you are working in a new project. Until you save the project, there’s no record of your current setup ( besides the default option “remember_open_files” which makes the application start up with the last set of open files ).
Click the “Project” item on the menu (Sublime Text 2) Click “Save Project As”. Choose a folder to save your project in. You may want to save all of these files in a single folder*. Name your project. This exact file name will show up when choosing from existing projects, so I’d use something readable. Save & Done.
Sublime Text 3 (which I assume you're using) uses atomic saves by default (it can be disabled by setting "atomic_save": false
in your user settings), which means it creates temp files and then overwrites the original file (and deletes the temp file) on save. See this thread on the Sublime forums for a little more info, especially the reply from jps
(Sublime's author) on its disadvantages.
Basically, atomic saving is useful because if anything were to happen during saving you (theoretically) shouldn't end up with a corrupted original file. Downsides include potential loss of file metadata (although Sublime uses native OS X and Windows APIs to prevent that), unexpected behavior in directories with nonstandard permissions (for example, they allow modification of existing files, but not the creation of new ones), and issues when saving to some network drives or services like Dropbox, which I've experienced personally.
Since I originally answered this, I've come across a number of questions where post-save file-watching compilers/preprocessors like LESS/SASS/SCSS, Guard, etc. were not doing their thing because the original file they were watching had been deleted by atomic saving, then created again, but they weren't watching it any more. It can also severely affect file I/O speed when working with network filesystems, SSHFS in particular. It's a good idea in theory, but it can wreak havoc if you don't know it's there or what it's doing, so if you'll be doing any kind of work on networked/shared/watched files, it's probably best just to turn it off. Just go to Preferences -> Settings-User
and add this line
"atomic_save": false
to the end (the file has to be valid JSON, so make sure there's a comma ,
after the previous line). Save, and you're good to go!
As of Sublime Text 3 Build 3072, atomic_save
is now disabled by default! If you are a registered user, you can download the latest development build here. This feature has not been ported to the public beta (currently Build 3065), but hopefully a new version will be released soon. As of Feb/March 2015, Sublime's development pace has picked up substantially, with a number of new features having been added. Once the bugs have been worked out of them, a new public version should be forthcoming.
update to the UPDATE
"atomic_save": false
is (as of March 2015) now in the default settings from Build 3080 and higher.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With