How do you configure JSHint options globally in Sublime Text 2? - sublimetext2

I'd like to turn off particular warnings globally when using Sublime Text 2's JSHint plugin. For instance, "laxcomma".
I tried editing the .jshintrc file in JSHint's Sublime Packages folder, but this did not work.
{
"laxcomma": true
}
Adding a project specific .jshintrc file with the same options solves the issue for that particular project, but I would like these options to be global.
Any suggestions?

From the JSHint docs page:
http://www.jshint.com/docs/
JSHint will look for this file in the current working directory and, if not found, will move one level up the directory tree all the way up to the filesystem root.
So, technically you could put a .jshintrc file at the root level of your filesystem (/.jshintrc) and every new project would default to those options. Individual projects could override them as needed.

If anyone's having trouble creating a .jshintrc in Windows, you could go to AppData\Roaming\Sublime Text 3\Packages\SublimeLinter, copy .editorconfig for example, rename and edit it then place it in your root directory like #philip-walton suggested.
If you edit the file here, you may need to Run your text editor as administrator.
If you try to rename the file here, you may need to right-click the file, go to Security, Advanced, change the Owner object name to yourself (PC-Name\User-Name), then also Add yourself to the list of Permissions by selecting the Principal.

Related

Different user settings for synced sublime

I've synced my User folder with sublime settings.
But what if I want to use different settings for different machines? For example, in settings of terminal package I define path to Git Bash, and it's
"terminal": "C:/Program Files (x86)/Git/bin/sh.exe"
on one machine, and
"terminal": "C:/Program Files/Git/bin/sh.exe"
on another.
I've tried to use default settings, but they refresh all the time.
Maybe look into this package: https://packagecontrol.io/packages/PackageSync
I've never used it, but according to the README,
PackageSync provides the following user configurable settings:
...
ignore_files [array]
The list of files to ignore when backing up.
So you would want to create a PackageSync.sublime_settings file that has this in it:
{
"ignore_files": "Terminal.sublime_settings"
}
This isn't ideal since it prevents the enitre file from syncing, not just that one entry (the "terminal": "C:/Program Files (x86)/Git/bin/sh.exe" entry), but it should work. (Disclaimer: I have not tried this myself)
Alternative: Possible workaround:
You could also just use the line "terminal" : "~/my_custom_terminal_shortcut" in your settings and then create a ~/my_custom_terminal_shortcut file on each computer that links to the appropriate location

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.

Exclude some folders from module declaration suggestions in PhpStorm

When I try to click on some function in PhpStorm with a CRTL button the system tries to bring me to a definition of this function. Sometimes there are multiple definitions and the annoying page shows up telling to chose to which definition you want to go. Like here:
Because I am using grunt and minifing / concatenating results, the definitions is in multiple places. I know that I should ignore everything in node_modules, but the system does not. Is there a way for me to exclude some of the folders?
If you don't need any completion/navigation/etc. from your local node_modules, you can exclude this folder from your project:
right-click, Mark directory as/Excluded
You will still be able to run Grunt, but files in these folders won't be indexed and thus suggested for completion/navigation

SublimeCodeIntel and Symfony2 autoloading

I am trying to move from PHPStorm to Sublime Text 3 but I got stuck on the autocomplete using SublimeCodeIntel in conjunction with Symfony 2. How can I make SublimeCodeIntel to scan all the vendor/ and src/ directory of my project?
Right now whenever I'm in the controller and I'm typing something like
$response = new Response()
$response->get
I get Warning: evaluating 'Request' at GamesController.php#27: could not resolve first part of 'Request'.
First, select the Settings-Default and Settings-User options under Preferences -> Packages -> SublimeCodeIntel. Copy the full text of the Default file and paste it into the User file, which should be empty if you haven't customized the plugin at all. You can now close the Default file.
Now, in the main body of the preferences, set
"codeintel_max_recursive_dir_depth": 25,
"codeintel_scan_files_in_project": true,
Next, scroll down to the bottom to the codeintel_config array, and edit the PHP section to the following:
"PHP": {
"phpExtraPaths": ["/path/to/library/files", "/another/path"],
"codeintel_scan_files_in_project": true,
"codeintel_max_recursive_dir_depth": 25
}
Save the file, restart Sublime, and you should be all set. If for some reason it's still not working, go to your ~/.codeintel/db directory and delete the PHP directory. You may also find a similar directory in the root of your project, so if it exists go ahead and delete that one too. This forces a reindexing of your code and includes, and since it's based on your new config options everything should work as expected. Remember that reindexing can take some time, so be patient.
Good luck!

How do I edit HTML.tmLanguage in sublime on mac osx

I'm to change it to support non-quote id, as in:
<div id=someId></div>
I found this
http://www.sublimetext.com/forum/viewtopic.php?f=3&t=8129
But am having issues finding where to edit the tmLanguage file
Don't listen to Jamie's answer. You should never be editing the Pristine packages. Instead, you can find all of Sublime Text's packages and grammar files in ~/Library/Application Support/Sublime Text/Packages or, from within Sublime Text, go to Sublime Text > Preferences > Browse Packages. However, if you edit HTML.tmLanguage from within the HTML folder, your changes will be overridden when Sublime Text is updated. To prevent this, duplicate the HTML folder and renaming it to Better HTML. Then in your User Settings (Preferences > Settings - User) add the following:
"ignored_packages":
[
"HTML",
"Vintage"
],
By ignoring the default HTML package, Sublime Text will be forced to use your version of the HTML.tmLanguage file and your changes will be preserved.
You can find the HTML.tmLanguage file by going to /Applications and then control/right click on Sublime Text 2.app and select 'Show Package Contents'. Then navigate to /Contents/Mac OS/Pristine Packages/.
Inside that folder, you should see a collection of sublime-package files. Find HTML.sublime-package and rename it to HTML.zip. You should then be able to extract the archive, just like any other zip folder, and inside you should find all assests related to Sublime's HTML package - including the HTML.tmlanguage.
Make sure to recompress and then rename the folder back to .sublime-package after making your edits!
EDIT: I have since recognised that this is incorrect, the Pristine Packages should never be edited. Follow BoundinCode's answer instead!