Change settings of BracketHighlighter Package Sublime Text - sublimetext2

how can i change the threshold in my BracketHighlighter to highlight brackets that are farther apart?
Instead of displaying a question mark in the left bar I still want to be able to locate the brackets

You can change the settings either in
~/Library/Application Support/Sublime Text 2/Packages/BracketHighlighter/bh_core.sublime-settings
or in your user settings
~/Library/Application Support/Sublime Text 2/Packages/User/bh_core.sublime-settings
Relevant settings include:
// Match brackets only when the cursor is touching the inside of the bracket
"match_only_adjacent": false,
// Character threshold to search
"search_threshold": 55000,
// Set mode for string escapes to ignore (regex|string)
"bracket_string_escape_mode": "string",
// Set max number of multi-select brackets that will be searched automatically
"auto_selection_threshold" : 10000,

While in Sublime navigate to preferences then goto package settings and select bracket - user settings. Insert the following lines to increase threshold or ignore (not recommended). The default is 5K.
// Character threshold to search
"search_threshold": 1005000,
// Ignore threshold
"ignore_threshold": false,

Related

Sublime Text 2 - Drop Cursor From Multiple Line Selection

I've been using ST2 for a while now and am curious if there is a way to select multiple lines and drop the top or bottom selection.
For instance, if we selected four of them and then, drop the top cursor, I'd only have three selections. This would be very helpful when I'm doing multi-line edits with slightly different data.
You can open the ST console ctrl+` and write del view.sel()[0] to delete the first and del view.sel()[-1] to delete the last selection. You can obviously adapt the number to delete an other selection.
An alternative is to install MultiEditUtils with "selection fields", which is written to slightly modify single selections while working with multiple selections. Add the keybindings:
// default use of selection_fields
{ "keys": ["alt+d"], "command": "selection_fields" },
// add the current selections as a fields
{ "keys": ["alt+a"], "command": "selection_fields", "args": {"mode": "add"} },
// jump and remove current selection in selection_fields
{ "keys": ["ctrl+alt+d"], "command": "selection_fields",
"args": {"mode": "smart", "only_other": true} },
// cancel selection_fields and remove current selection
{ "keys": ["ctrl+alt+shift+d"], "command": "selection_fields",
"args": {"mode": "toggle", "only_other": true} },
Afterwards you can press alt+d to change the selections to "fields". Now move with tab or shift+tab to the selection you want to remove. Press ctrl+alt+d to remove the selection and jump to the next field. Press ctrl+alt+shift+d to remove the selection and convert all other fields to selections. Press escape to convert all fields to selections.
This is possible using subtractive drag select. On Windows and Linux, hold down Alt (on OS X, hold down ⌘Alt) while holding down mouse button 1 (typically the left mouse button, for right-handed users) and dragging across the cursor, either from left to right or right to left - the drag needs to start in the editing area, though, not the gutter to the left of the text where the line numbers are. Subtractive select also works when selecting words, lines, or columns - just hold down Alt or ⌘Alt while double- or triple-clicking, or selecting columns.
For a full list of available mouse combinations, go to your Packages folder, the one opened when selecting Preferences → Browse Packages…, go to the Default folder, and open Default (YourOSHere).sublime-mousemap (YourOSHere being one of Windows, Linux, or OSX) with JSON syntax highlighting. If you're using Sublime Text 3 (which I very strongly recommend upgrading to), you'll need to install PackageResourceViewer, as the files in Default are now in a .sublime-package archive. Once installed, select PackageResourceViewer: Open Resource, scroll down to Default, then select the .sublime-mousemap file that corresponds to your operating system.

turning off auto completion of matching brackets in Adobe Brackets

I have only just started using Adobe Brackets for HTML development. As a programming newcomer, I am still not savvy enough to look in all the right places to change defaults. When I type a beginning tag in Brackets (HTML) like < p >, the editor automatically adds the ending tag < /p >, assuming that I will enter text between the two tags. So I get < p > < /p >. Often I want to put the tags around existing text and do not want the auto completion of the end tag upon entering the beginning tag. How do I change the default in Adobe Brackets so that I do not get the auto-completion of the end tag?
You can do this by setting the dontCloseTags option in the Brackets preferences file.
Go to the Debug menu and select Open Preferences File. You will see a side-by-side view of defaultPreferences.json on the left and brackets.json on the right. These are Brackets' default settings and your settings file, respectively. defaultPreferences.json lists all the possible options that can be set and their default values, but the file itself can't be modified.
Look at the comments in defaultPreferences.json for closeTags. What we care about is dontCloseTags.
Set dontCloseTags inside of closeTags. For example, my defaultPreferences.json file looks like this:
{
"fonts.fontSize": "12px",
"fonts.fontFamily": "'SourceCodePro-Medium', MS ゴシック, 'MS Gothic', monospace",
"themes.theme": "dark-theme",
"useTabChar": true,
"tabSize": 5
}
And so I would set it up like this, adding a comma after the last entry before starting a new one below:
{
"fonts.fontSize": "12px",
"fonts.fontFamily": "'SourceCodePro-Medium', MS ゴシック, 'MS Gothic', monospace",
"themes.theme": "dark-theme",
"useTabChar": true,
"tabSize": 5,
"closeTags": {
"dontCloseTags": ["p", "img"],
"whenOpening": true
}
}
I set whenOpening to true because I found that sometimes Brackets won't autocomplete any tags without me asserting that value, even though it's the default.
Press Ctrl + S to save your preferences and then close the two files.
Click on the icon next to the settings icon next to the Left heading in the sidebar, then select No Split. This will remove the two columns.
I hope this helps, and have fun looking at the other settings in defaultPreferences.json, since Brackets won't add a front-end for those settings for a while (it's in the works). Just make sure to match the syntax exactly as it is in defaultPreferences.json (except for the comments). JSON also wants commas between stuff inside {} and [], but do not add a trailing comma after the last item in each grouping. If the option you want is inside another option (for example, dontCloseTags is inside of closeTags{}), you need to include the main option and its grouping symbol thing.
Just use a boolean "false" for the value of the field name(s) if you want to shut that object to not function at all
"closeTags": {
"whenOpening": false,
"whenClosing": false
}
This sets the value of the closeTag field with Boolean defined values of two more objects which results with all auto-completing, closing tags to stop working.
After saving your changes, be sure the new file is loaded by restarting the application. All save does is saves your edits, any changes will not be seen until you restart the application.

Unintentionally Sublime-text different setting for two file

I have problem with sublime tab indent.
I have to file: reply.php and view.php
==============================================
view.php:
Tab indents is replaced with spaces.
One tab equals with 2 space.
==============================================
reply.php:
Tabs is not replaced with spaces
One tab equals 4 spaces.
==============================================
Why? I want reply.php indent and setting. How I can fix this?
Go to View -> Indentation and make sure that Tab Width is set to 4, then click on Convert Indentation to Tabs. Double-check the other options there to make sure nothing is set that you don't want, such as Indent Using Spaces.
To make sure that PHP files are always displayed with tabs, save the following as Packages/User/PHP.sublime-settings:
{
"tab_size": 4,
"translate_tabs_to_spaces": false
}

Disable Marks Column from Sublime Text 2 Gutter

Is there a way to disable the marks column in the gutter on the left side of Sublime Text 2?
I was able to disable the fold_buttons using the following setting in the settings file:
"fold_buttons": false
In case it isn't clear, I'm talking about the whitespace reserved for the mark (dot) shown below:
Find "Settings - User" from Sublime Text 2 menus (its location depending on the platform). When you click it, it will open a new, empty or almost empty file. Here is a sample portion of it:
{
"auto_complete": true,
"auto_complete_commit_on_tab": true,
"gutter": true
}
The setting you are asking for is the "gutter". Make it false and you will achieve what you asked for.
Things to note:
The curly braces at the beginning and end are important.
Each setting has a comma after it. Except the last one.

Sublime Text 2, faster alternative to find and replace regex?

$_POST['daily_limit'];
$whatever = $_POST['smoke'];
$_POST['soup'] + $_POST['cake'];
to
$this->input->post('daily_limit');
$whatever = $this->input->post('smoke');
$this->input->post('soup') + $this->input->post('cake');
In this example, is there any faster way to switch from $_POST[] to $this->input->post() without writing up a regular expression find and replace? I don't care if it takes multiple steps. Writing the regex for this (find: \$_POST\[(.*?)\] replace: \$this->input->post\($1\)) takes longer than changing them all manually (maybe I'm just not good at regex). Any ideas?
I'm making a brash assumption here, that you have only one variable within each pair of brackets and that the variables only contain alphanumeric characters. ['soup'+'bacon'] will break this trick, as will ['soup-with-bacon'].
With your cursor, highlight an instance of $_POST[ - nothing else.
Hit Alt+F3 if you're on Windows/Linux (Cmd+ShiftG in Mac?)
Try to scroll through and see if everything that's selected is everything you want to replace.
Type $this->input->post( - nothing else.
Press → to move all cursors to the right of the first quote.
Press Ctrl+→ (this is the only remotely wtfh4xxy part of the process, and only if you're not used to navigating by word with the cursor) to navigate over the variable.
Press → twice to move all cursors to the right of the next quote.
Replace the ]with a ).
#nnnn I did a variation of your version to remove the wtfh4xxy part.
select:$_POST
altf3
type: $this->input->post(
ctrlshiftm
ctrlx
ctrlshiftm
ctrlv
type: )
Sublime text ftw!