Unable to Edit Sublime Text's Default Settings - configuration

I would like to edit my default settings in Sublime Text 3 (beta build 3059) to not ignore the Vintage package - via Preferences > Settings - Default. I am running Sublime Text on Windows 7 Pro x64.
The Vintage package's documentation says to edit and save the default settings file to enable Vintage mode:
When I click the Settings - Default menu item, the default Preferences.sublime-settings file opens with expected content; but I cannot edit it. For example, deleting or backspacing to remove "Vintage" in "ignored_packages": ["Vintage"] does nothing.
I thought maybe the default settings file was marked readonly and tried to check it: C:\Users\me\AppData\Roaming\Sublime Text 3\Packages\Default\Preferences.sublime-settings does not exist. C:\Users\me\AppData\Roaming\Sublime Text 3\Packages\Default does not exist either.
To work around this, I tried to save the default settings file that Sublime Text opened for me - to see if that would create the Default directory and Preferences.sublime-settings in it. Instead Sublime Text gave the following error:
Unable to save C:\Users\me\AppData\Roaming\Sublime Text 3\Packages\Default\Preferences.sublime-settings
Error: The system cannot find the path specified.
Has anyone encountered this issue with Sublime Text 3 (specifically in trying to enable Vintage mode or otherwise) and worked around it...or found an authoritative explanation for it?
I reason that next I could try to add the missing Default directory myself, create an empty Preferences.sublime-settings text file in it, and try again to save the default settings file that Sublime Text opened for me; but this is starting to feel kludgy.

You should not edit the default settings. Add the files you want to ignore to the file Packages/User/Preferences.sublime-settings. You can open this file by going to Preferences - >Settings - User. Anything you set here will override the default settings.

I understand that you want to Not ignore the Vintage rather.
This still can be done using the Preferences.sublime-setting-User. AFAIK, any value given in this file overwrites the entries in Preferences.sublime-setting-Default.
Simply add this line with the "Vintage" removed in it to your User preferences and you'll be fine. (Remember to save the file after you did the edit and the change will happen instantly)
Also, not that VI mode in sublime is on edit more by default so make sure you press Esc first to make sure VI is activated.
// Settings in here override those in "Default/Preferences.sublime-settings",
// and are overridden in turn by file type specific settings.
{
"ignored_packages": []
}
Update
The latest format is,
{
"ignored_packages":
[
// Line below is commented out to enable Vintage.
//"Vintage"
],
// To start Sublime in Command moder
// rather than Insert mode.
"vintage_start_in_command_mode": true
}

Install 'PackageResourceViewer' from 'Install Package' in the Command Palette.
Then use 'PackageResourceViewer' command in the Command Palette.
Use that to extract/open the default packages you previously were unable to.
More information here : https://github.com/skuroda/PackageResourceViewer

I use Sublime Text3 recently in Windows 10. I'm trying to change the file: Packages/User/Preferences.sublime-settings. And met your problem "Enable to sa ve Preferences.sublime-settings".
I solve this by changing file Preferences.sublime-settings's property, in Security, edit "user"'s permissions. Allowed to modify.
And then I can edit and save Preferences.sublime-settings

When I install Sublime Text in Linux, I report the message NOTADIRECTORYERROR: [ERRNO 20] NOT A DIRECTORY. At first I thought it was because the Defalut folder was missing, but later I realized it wasn't. I then checked the Settings of my SublimeREPL. Sublime-setings and deleted the contents after bin, and found that the program worked fine.
old: "default_extend_env": {"PATH": "{PATH}:/home/bgnv5/anaconda3/bin/python"},
new: "default_extend_env": {"PATH": "{PATH}:/home/bgnv5/anaconda3/bin/"},
Spent a lot of time to find problems, I hope to help you.

Related

Why doesn’t this hotkey configuration for Sublime Text work?

I have configured Ctrl+B to open a file in my browser, but when I press Ctrl+B when the editor is focused on some HTML page, it doesn’t work. Why not?
more details:
what makes me confused is that this ctrl+b works if it is combined to other command such as close, but why not openInBrowser command, so does st2 support this command, how to know whether it support this command or not?
Edit 1:
you may find openInBrowser command in this link http://www.sublimetext.com/docs/commands
Edit 2
#MattDMo what is the corresponding name of command then, i cannot find them in its official document http://www.sublimetext.com/docs/2/
The command you are looking for is open_in_browser, not openInBrowser (which is an old Sublime Text 1 command). So, your keymapping should work with that. However, if you weren't already aware, CtrlB is already mapped to the Build command, used for running build systems. It's not a very good idea to overwrite built-in commands, especially one as important as this one, so I'd suggest changing your keybinding to:
{ "keys": ["ctrl+alt+b"], "command": "open_in_browser" }
This isn't in use by any of the default Sublime commands, although some plugins may use it.

Sublime Text Default Save Options

Why when I save a file in Sublime Text 3 is the default save location the Sublime install directory and why is the default file type nothing?
I want to set the default save location to the Desktop and the default file type to .txt, how can I do this?
Here are my settings:
{
"font_size": 9,
"hot_exit": false,
"ignored_packages": ["Vintage"],
"remember_open_files": false
}
Without no line of code:
Preferences -> Settings -> paste this "default_dir": "your/favorite/path"
And you are done.
More here: https://sublime-text-unofficial-documentation.readthedocs.io/en/latest/reference/settings.html#file-and-directory-settings
Doesn't (currently) address the default extension issue, but you can also try AdvancedNewFile. Rather than creating an unnamed buffer, this plugin creates a named file. The default location is configurable, though there is no default extension.
Disclaimer: I'm the maintainer of the AdvancedNewFile plugin.
Edit
I've updated AdvancedNewFile to support default file extensions.
You can install the Default File Type plugin manually. It's a very simple plugin, and while the Package Control page says that it's for Sublime Text 2 only, I just installed it under OSX and it works fine. To install, navigate to %APPDATA%\Sublime Text 3\Packages and run
git clone https://github.com/spadgos/sublime-DefaultFileType.git DefaultFileType
Then, copy Packages\DefaultFileType\default_file_type.sublime-settings to Packages\User and change its contents to the following:
{
"default_new_file_syntax": "Packages/Text/Plain text.tmLanguage",
"use_current_file_syntax": false
}
Save the file, and now whenever you hit CtrlN to create a new file, it will be set to plain text. The plugin only works with the key combo, not via the File -> New File menu option.
As far as the save location goes, I have a theory, but I haven't been able to find documentation to back it up. At least on Win7 (for me), it seems like the default save location is the directory which contains the file that was open when you hit CtrlN or File -> New File to create the new file. For example, I had my Packages\User\Preferences.sublime-settings file open when I created a new file, and hitting CtrlS opened the Save dialog in Packages\User. I saved the file to the Desktop, hit CtrlN for a new file, entered something, then hit CtrlS and the Save dialog opened in the Desktop.
So, while there isn't a preferences setting for default save location, at least on Windows you can tweak it by always keeping a Desktop file open, then creating new files while that Desktop file is focused.
This should be a built-in option, honestly, but it seems fairly simple to automate yourself. Hit Tools -> New Plugin
Then paste this over the file that's created, hit save and call it "DefaultLanguage.py" or something:
import sublime, sublime_plugin
class EverythingIsPowerShell(sublime_plugin.EventListener):
def on_new(self, view):
view.set_syntax_file('Packages/PowerShell/Support/PowershellSyntax.tmLanguage')
Of course, you can change the language from PowerShell to ... whatever you prefer. You just need the relative path to the tmLanguage. You can get that by opening a file in your favorite language and then open the console (View->Show Console) and type:
view.settings().get('syntax')

Error trying to parse settings in Sublime Text 2.0.2

I am new to Sublime Text, and I haven't been able to fix or find an answer to this problem anywhere.
I just installed Sublime Text, and in the beginning it worked fine. Then I tried to change some settings under Preferences-> Settings User, e.g. font size. When I saved, it returned the error:
Error trying to parse settings: Expected string in C:\Users\Michael\AppData\Roaming\Sublime Text 2\Packages\User\Preferences.sublime-settings:18:1
(Where my ST packages are installed)
Now, whenever I try to open Sublime Text 2, it displays the same error message, and will not run.
I uninstalled and re-installed ST, and the problem remains (after I try to change my preferences).
I am running Sublime Text 2.0.2 on Windows 7.
Any insights into how to fix this problem (or better yet, why this problem emerged in the first place) would be most welcome.
Edit: This is the contents of the preference file (I don't know how to upload the file itself, if it is even possible)
// Settings in here override those in "Default/Preferences.sublime-settings", and
// are overridden in turn by file type specific settings.
// "User/Preferences.sublime-settings", which overrides the settings in here.
//
// Settings may also be placed in file type specific options files, for
// example, in Packages/Python/Python.sublime-settings for python files.
{
// Sets the colors used within the text area
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
// Note that the font_face and font_size are overriden in the platform
// specific settings file, for example, "Preferences (Linux).sublime-settings".
// Because of this, setting them here will have no effect: you must set them
// in your User File Preferences.
"font_face": "",
"font_size": 10,
}
Remove the last comma. Change:
"font_size": 10,
to:
"font_size": 10
I've just run into the same issue and I fixed it by:
Validate JSON is valid
Ensure file encoding is "UTF-8" (File > Save with encoding...)

How do I remove cssLint highlight in sublime text 2

I'm (trying to) using CSS Lint plugin for Sublime Text 2.
Once I've run it, I can't remove the highlight.
"Escape" just remove the console window.
Hitting again the command just "re-lints".
How can I remove the highlight?
Thanks
Changing the Preferences for a ST2 Plugin
Go to Preferences -> Package Settings -> CSS Lint
Choose Settings - Default to see the default settings for this
plugin.
If there are items in this section you would like to change, copy and paste the default settings in the Settings - User file, and then change them there.
This process will ensure that your changed settings are preserved if/when the plugin is updated.
Another Plugin Option
As a side note, I prefer using SublimeLinter. It includes cssLint and has a pretty robust set of settings options. You can find more information about this plugin on this SO question.

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.