Sublime Text 2 / Sublime Text 3 bring back unsaved files on osx - macos

In sublime I know even if you don't save the changes in a file later one you can start from where you left off. I opened a new tab in sublime and closed the application before I save my file. Does sublime save a temp file somewhere in the computer (I am using MAC OSx)

Sublime Text 2 stores the files in ~/Library/Application Support/Sublime Text 2/Settings, in the .sublime_session files that are located there.
The contents of those files are a large JSON blob that contains the individual tab contents. Search in the file for the file name / tab name / a key word in the document and you should be able to get what you need.
For Sublime Text 3, use the following path:
~/Library/Application Support/Sublime Text 3/Local/Session.sublime_session
Credit to: eebbesen

I know it's a late answer but here's where I found it.
Linux: ~/.config/sublime-text-3/Local/Session.sublime_session
Windows: %USERPROFILE%\AppData\Roaming\Sublime Text 2\Settings\Session.sublime_session
Hope this helps someone someday.

As far as I know, Sublime Text keeps open files when you quit the application. However, if you close the tabs or project window without saving, the changes are lost.
In the former case, the files are saved in Local/Session.sublime-session (I'm using ST3 though, could be different in ST2!) You can open ST's packages folder from the command palette using "Browse Packages".

For Sublime Text 3,
Windows: %USERPROFILE%\AppData\Roaming\Sublime Text 3\Local\Session.sublime_session

For Sublime Text 3 / For Sublime Text 4
If you used portable version(.zip) version then refer to
sublime_installation_folder\Data\Local\Session.sublime_session
PS: Make a backup, before replacing the file, in case, you want to revert
This gives you your unsaved files and opened files as per your recent view.

Related

Sublime text 3 Notepad++ theme

Does anyone know exact steps for adjusting notepad++ theme or look in sublime text 3.
There is one link which is not completely clear to me, and I am looking for some other solution.
Someone already made whole theme.
Here https://gist.github.com/rafaelmussi/3743237 is theme code. It says for sublime text 2, but it also work for sublime text 3.
Installation steps:
1) Open Sublime text and go to: Preferences->Browse packages... or on your hard disc go to: \AppData\Roaming\Sublime Text 3\Packages.
2) Create there some folder where you want to put your theme file, or you can put it in some of already created folder with other themes.
3) Create file Nodepad.tmTheme and put code from github link above into file.
4) Copy file in new created folder or some other folders with themes.
5) Open Sublime text 3 editor, go to: Preferences->Settings-User
6) Reference your new created theme here. Something like:
{
"color_scheme": "Packages/User/NotepadTheme/Nodepad.tmTheme",
}
save and that is it.

Sublime Text navigate to file in sidebar when opened with CTRL+P ("goto anything")

Say I've got opened a project or a directory structure in Sublime Text. When I open a file with CTRL+P, I frequently navigate in the sidebar to the directory that contains it after opening the file, to get my bearings in a large project. It would be nice if this could be automated.
Is there a way to configure this, or a plugin for it? I wasn't able to find anything.
If I understand you correctly, you want to have the sidebar expand to some file that you find with Goto Anything. To do so, you can install the SyncedSideBar package.
SyncedSideBar
Sublime Text 2 plugin to sync project sidebar (folder view) with
currently active file.
Sublime Text 2 highlights only those files that are already expanded.
This plugin highlights all files (eg. opened with cmd+p).

How to refresh Sublime Text 3 workspace color schemes?

When you save a project, Sublime Text will create a .sublime-workspace file. In this file, there is an array of buffers, and for each buffer there is a color_scheme property. This is set to whatever color scheme was chosen when the buffers and workspace were created.
I recently changed my theme and color scheme in my user settings file. How can I refresh all of my project's workspaces so that way it uses my new color_scheme provided in my user preference file without needed to edit each project's workspace file one-by-one?
Expanding on the answer given by Tot you can do this for all views in all windows that are open by using a nested list comprehension (remember this is Python so we can be pretty flexible):
[ v.settings().erase("color_scheme") for views in [ w.views() for w in sublime.windows() ] for v in views ]
This way you don't have to run the command in each tab individually.
The only way I found to reset tabs to user's chosen color scheme is to enter this in the console :
view.settings().erase("color_scheme")
This will reset the color scheme of the selected tab - unfortunately you'll have to do it for each tab. But it's still quicker than closing and reopening the tab.
I only have this issue with Sublime Text 3 on Mac OS X.
Source : https://www.sublimetext.com/forum/viewtopic.php?f=3&t=19310
P.S. : If you've just updated your color scheme file, you'll sometimes have to execute this command twice. Just type the up arrow in the console to write the last command again.
Windows 10 AppData-related Solution
Please make sure that you are in a similar situation as me before trying this solution (see below). Steps:
Note the language and package that the Error loading colour scheme reports (my case was: markdown and MarkdownEditing).
Go to your AppData directory (type %AppData% in file explorer address bar).
Open directory Sublime Text 3, or whatever your version is.
Open the .sublime-settings file that matches the language from step 1.
Remove any lines that refer to the package you noted from step 1.
Remember that this file should be a properly formatted JSON file when you remove lines manually. Save this file and restart Sublime Text.
Background
I've decided to post here in case some of the python script solutions didn't work for you and your situation is similar to mine. I'm using GitHub to sync my Sublime Text AppData (Windows 10), in order to keep my workflow settings the same on multiple machines. Recently, I noticed that when I uninstalled a certain package on one of my machines, I accidentally merged some configuration files for that non-existent package on my other machine. This resulted in a persistent Error loading colour scheme, in particular for me when changing syntax to markdown (the package was MarkdownEditing for reference).

Where to put .tmLanguage in sublime text 3?

I'm having trouble with Ruby syntax highlighting in combination with RegExp.
Someone suggested that I update my Ruby.tmLanguage file with some additional code.
Problem is, I can't locate this file on my computer. Inside sublime_text_3/Packages I only see .sublime-package files, which I can't properly open with sublime text; it only shows numbers.
Do I have to create this file myself, and if so, where?
Or does this work differently in sublime text 3 (as opposed to 2, which was probably the latest version when this solution got posted).
reference to additional Ruby.tmLanguage code: https://gist.github.com/elgalu/3921521
Those .sublime-package files are actually zip files in disguise. The default Ruby.tmLanguage file can be extracted from Ruby.sublime-package. Open it with some sort of archive manager. Copy and rename the extension to .zip if you have to.
Once you've made the changes in Ruby.tmLanguage, the modified file goes somewhere in your packages folder (I can't remember exactly where), which you can open from ST by going to Preferences > Browse Packages.

How do I create a .conf file in Mac osx Lion?

I'm using plain text format on text edit and I'm also storing the file as filename.conf but it always ends up getting stored as filename.conf.txt. I've even unchecked the box that says "If no extension is provided, use .txt"
TextEdit just doesn't seem to recognize .conf as an extension?
Any help with this?
Open TextEdit's Preferences, and switch to the Open and Save section. Under the When Saving a File panel, uncheck the Add '.txt' extension to plain text files option.

Resources