How to recover a sublime 3 session? - sublimetext2

Well, I'm using sublime text 3 and i did something really stupid. I just rewrote a file in which I've recently made some changes and lost it all. I did that pasting an older version, saving it and closing the file.
I need to know if there's any way to recover that old file. In my ~/Library/Application Support/Sublime Text 3/Local/ I can see two sublime_session files:
'Session.sublime_session' from yesterday and
'Auto Save Session.sublime_session' saved today
I have opened them with sublime, but how could I restore a file? Is it possible?

You can't recover changes in file closed with Sublime Text 3. When you close file, your undo buffer is lost forever.
Sublime Text 4 behave same way.

Related

CSS file either deleted or is hidden in atom

I have been learning for just over a month now and I started my first project and I was coming to a close with it and literally last sec the CSS file is blank. I am using chrome and atom text editor. I did not have my git acc linked to it so history is not saved on it. The only thing showing on the file for the class is "
1
*
*
*
*
*
"
When I hit backspace it takes forever to delete because I'm pretty sure my code is just hidden there or something. I have no idea what happened. I spent some hours trying to fix it but no dice.
Have you tried opening the file in explorer?
If you right click on your project folder there is an option to open in file explorer. (This may say "Show in file manager" if you're using the latest version of Atom)
Check if the file is there, if it is, try opening it notepad or another simple text editor.
If it's not there it may have been corrupted, I've used atom quite a bit and never encountered this problem.
If it is, you can always just delete the file in your project folder and make a new one, pasting the contents in from when you opened it in notepad.

Saving sublime text snippets in a directory for reuse on different pc

Hey guys i am new to Sublime. I read in documentation how to create snippets. Now my question is how to save them in to a directory and then maybe reuse them on another PC.
Thanks.
You should save snippets in your Packages/User directory, where Packages is the directory opened by selecting Preferences -> Browse Packages.... You can then copy the .sublime-snippet files to your other PC by whatever means you prefer.
Save the file. When you do, you'll need to determine two things: its file name & where to save it.
File name: The file must end with .sublime-snippet, like this: foo.sublime-snippet. What goes in front of .sublime-snippet is up to you. I like to use the tabTrigger if at all possible, along with the main part of the scope in front of the tabTrigger, giving me this: html-p.sublime-snippet.
Where to save it: When you press Save, Sublime Text should automatically try to save the file in the right folder.
You shouldn't have to worry about the location, as Sublime Text should take care of it for you, but if for some weird reason you're not in the right place, then you'll need to navigate to the right location.

Sublime Text 2 - writing a script to process multimarkdown

There is an excellent package to preview markdown written using sublime text. I wanted to know how I might modify it, or perhaps use it as the basis for writing one that could process multi-markdown.
I'm using Linux (Ubuntu) and I'm currently calling multimarkdown in the terminal on each file.
One of the issues I think I might face is that multimarkdown refuses to parse an open file for some reason.
Any thoughts on how I might begin this or if an alternative solution exists would be very gratefully received.
There is a MultiMarkdown option in the syntax list - View > Syntax > Markdown > MultiMarkdown. Isn't that working? By the way the syntax (and almost any other) files are in packages folder of Sublime Text 2. This is the syntax file:
/Users/[username]/Library/Application Support/Sublime Text 2/Packages/Markdown/Markdown.tmLanguage
And MultiMarkdown file is in the same directory.
I'm intrigued by your statement that "multimarkdown refuses to parse an open file". Can you provide more information, or email me, or open an issue on github? MultiMarkdown doesn't check to see whether a file is open or not --- it simply reads the file and processes it. So if there's a problem, then the OS is not allowing MMD to proceed for some reason...
I don't have Sublime Text installed on Ubuntu (I generally use a command line only version of Ubuntu for testing MMD), so I can't test this situation exactly. I haven't had any other reports of difficulties parsing files (open or not). I don't have any trouble with Sublime Text 2 on Mac OS X and MMD.
As an alternative, you could try using one of the support scripts (e.g. mmd if you want MMD->HTML) and see if that has the same problem with open files.
PS> Are you using the latest build of MultiMarkdown, e.g. 4.2+?? (Though it shouldn't change anything related to open files)

Where does Sublime Text 2 store editing information?

When I perform these steps:
Open an existing file in Sublime Text 2.
Type in arbitrary text at an arbitrary place in the file.
Close Sublime Text 2.
Note, I have not saved the changes.
Open Sublime Text 2.
Open the file from step 1.
I see changes in the file. But if I view the file in, let's say, Notepad, I see no changes.
Where does Sublime Text 2 keep the changes made to files?
As far as I'm concerned the question isn't answered completely...
As nnnn explained, the unsaved changes of a project are saved in its sublime-workspace file.
But if you haven't created a project and you are just working on some files, sublime also does remember the unsaved changes. These were saved in 'Session.sublime_session'.
Where the session can be found, depends on your operating system:
OS X: ~/Library/Application Support/Sublime Text 2/Settings/
Windows: %APPDATA%\Sublime Text 2\Settings\
Linux: ~/.config/sublime-text-2/Settings/
(I just found this info some kind of accidentally in the official sublime forum)
If you have made a project, the magical file-restore fairy will be in the folder where you told Sublime to store your project, in a file called [yourprojectname].sublime-workspace.
If you delete that workspace file before opening, Sublime will nuke your changes and complain about opening any previously open files. This move will probably cause you some grief, so don't try it unless you've already saved all necessary changes.
The workspace saves, among other things, your window layout, all the contents of any files that are open, and your last find/replace/autocomplete entries. (That is why your autocomplete gets "smarter" over time).
Note the little symbol where there is normally an x to close the tab. If it is a dot instead of an x, the file is considered unsaved and will be brought back also unsaved when you re-open Sublime.
I have the issue after updating Sublime Text 2 (old version) to Sublime Text (new version) on macOS. I don't know why the old version has the suffix "2".
Anyway, a solution to restore the whole my previous session is to copy a file Session.sublime_session, before the manipulation close the Sublime Text app, then execute a command:
cp ~/Library/Application\ Support/Sublime\ Text\ 2/Settings/Session.sublime_session ~/Library/Application\ Support/Sublime\ Text/Local/Session.sublime_session
And finally, start the Sublime Text app.

How to prevent Sublime Text 2 from opening that last open file / project when starting up

I am on Lion - and in the command line, when I open up my project using "subl ." in my project folder - it opens up the last project I had open before I quit Sublime.
I have the Max Preference "Restore windows when quitting" unchecked.
How to I prevent this behaviour? Is there a preference setting for this?
I think the behavior you want can be enabled by changing the hot_exit and remember_open_files settings. If you check out the "Global Settings - Default" preferences, there are some comments there describing these settings.
If you want to change them, you should override them in the "Global Settings - User" file to preserve your changes across updates.
If anyone is wondering how to do this in sublime text 3, copy and paste the following into settings - user:
"hot_exit": false,
"remember_open_files": false,
I could only get it to work by also setting "hot_exit": false in my preferences.
On Linux, I had an issue where I couldn't even start Sublime Text 3 because there were too many files open and it would hang before I got a chance to change the settings.
I did what Mike Wizowski suggested and edited my $HOME/.config/sublime-text-3/Packages/User/Preferences.sublime-settings to include those settings.
However, restarting Sublime Text after this did not seem to fix my problem because Sublime still opened all the files and folders.
I found that deleting the 2 ".sublime_session" files in $HOME/.config/sublime-text-3/Local/ made Sublime Text forget what the recently opened files/folders were, thus fixing my hanging text editor.