I already have the following setting in Preferences -> Settings - User
{
"translate_tabs_to_spaces": true,
"tabSize":2,
"detect_indentation": false
}
However opening a new file and hitting tab still indents 4 spaces. How can I make Sublime indent 2 spaces on new files?
It appears you didn't correctly spell tab size :
// Settings in here override those in "Default/Preferences.sublime-settings",
// and are overridden in turn by file type specific settings.
{
"tab_size": 2,
"translate_tabs_to_spaces": true
}
I tried this on Sublime and it works like a charm.
see here : http://www.sublimetext.com/docs/2/indentation.html
Related
Math formula field is small.
This is default behavior of the Latex plugin. Can the field can be expanded? If yes, then how can I do that?
I have browse to fix this solution but none of them match with what I want. Anyone know how to expand it?
This is the screen shot:
UPDATED
return{title:b.title,minWidth:1000,minHeight:650,contents:[{id:"info",elements:[{id:"equation",type:"textarea",rows:10,label:b.dialogInput, ..
Note: I can expand the dialog display but I cannot expand the textfield formula form. It seem like the variable rows not functioning.
Should I declare the variable rows in other file?
You can edit the code that displays this dialog.
In your ckeditor folder, under the /plugins/mathjax/dialogs/ folder, open the mathjax.js file.
To make the dialog wider change the minWidth attributes. For example, to set the width to 750 pixels:
return {
title: lang.title,
minWidth: 750,
minHeight: 100,
contents: [
To add more lines to the formula textbox, add the rows attribute with the number of lines you want (the rows attribute is not there by default so add it). For example, to make the textbox 10 lines long:
elements: [
{
id: 'equation',
type: 'textarea',
rows: 10,
label: lang.dialogInput,
Here's a screenshot with the above changes:
Save the file and clear your cache before testing.
Rather than taking my hand of the mouse to use Ctrl + Shift + /, I'd like to be able to comment code by highlighting it, and then while keeping the left mouse button held down, simultaneously right click and have it comment out - though I don't know if that's possible with Sublime Text keybinds.
If not, I'll just use a custom keyboard shortcut, but I'd prefer the mouse method.
You can customize mousebinds by creating a file named Default (Windows).sublime-mousemap, Default (OSX).sublime-mousemap, Default (Linux).sublime-mousemap or (for any OS) Default.sublime-mousemap in your settings folder \Packages\User and then creating your custom bind inside that file
You can read more here (it's actually about keybinds but the process of creating mousebinds is the same.)
I came up with something similar to what you are trying to achieve but could not bind mouse1 as modifier so the snippet below is working different.
After you've made a selection, click and hold right mouse button and then click left mouse button to toggle comment block on selected area.
[
{
"button": "button1", "count": 1, "modifiers": ["button2"],
"command": "toggle_comment", "args": {"block": true},
"press_command": "drag_select_callback"
}
]
This might be annoying if you comment something by accident, so you can change click to double click, by changing count value to 2 or 3 for triple click etc.
Block comment is defined by {"block": true}, if you would like line comments just change it to false
[
{
"button": "button1", "count": 1, "modifiers": ["button2"],
"command": "toggle_comment", "args": {"block": false},
"press_command": "drag_select_callback"
}
]
I'm using Sublime Text 3 as my code editor. I would like some help/explanation as to why the indentation misbehaves so much:
Is there any way to force the indentation when you open a file (I like it set to tabs, tabs_size = 4)?
Whenever I save a file, it automatically reverts the indentation to spaces... How would one go about avoiding that?
Any help is appreciated, I've been pulling my hair because of these tiny issues.
P.S.: Here are my settings
{
"color_scheme": "Packages/User/base16-ocean.dark (SL).tmTheme",
"detect_indentation": false,
"tab_size": 4,
"translate_tabs_to_spaces": false,
"font_face": "Source Code Pro",
"font_size": 15.0,
"ignored_packages":
[
"SideBarEnhancements",
"Vintage"
],
"theme": "Spacegray.sublime-theme",
"word_wrap": true
}
Is there a way/plugin in sublime text 3 for highlighting multiple character offset ranges? The ideal desired functionality would be something like this: given a range of character offsets (e.g. 200-400, 5000-5300, 6400-6450) highlight the corresponding ranges.
This can be done with a WindowCommand plugin. Go to Tools -> New Plugin... and replace the contents with the following:
import sublime
import sublime_plugin
class SelectRegionCommand(sublime_plugin.WindowCommand):
def highlight_region(self, regions):
region_list = []
if "," in regions:
for region in regions.split(","):
region_list.append(tuple(region.split("-")))
else:
region_list.append(tuple(regions.split("-")))
view = self.window.active_view()
view.show(int(region_list[0][0]))
for region in region_list:
begin = int(region[0])
end = int(region[1])
to_highlight = sublime.Region(begin, end)
view.sel().add(to_highlight)
def run(self):
message = "Enter offset range(s) to select, separated by commas:"
default = "0-100"
self.window.show_input_panel(message, default, self.highlight_region, None, None)
Save the file as Packages/User/select_region.py (it should open that directory automatically), where Packages is the directory opened by selecting Preferences -> Browse Packages....
Next, create a custom key binding to trigger the plugin. Open Preferences -> Key Bindings-User and add the following line:
{ "keys": ["ctrl+alt+shift+s"], "command": "select_region" }
If the file is empty, surround the key binding with square brackets [ ]. Save the file, and you're all set. Hitting CtrlAltShiftS will bring up an input panel at the bottom of the window where you can enter the character offsets. Please don't include any spaces, so your input should look like the following:
Hit Enter, and the regions you entered will be selected:
EDIT
I altered the code slightly so that the view scrolls to the beginning of the first region entered (it should be centered on the screen). If you don't want that functionality for some reason, just comment out the view.show(int(region_list[0][0])) line (line 14).
I'm having a problem with the Toggle Comment command ("Comment Line / Selection") in TextMate for Actionscript 2 (I know, I know). I've tried completely stripping the language set down to isolate the issue, and tried walking through the Ruby, both to no avail. My issue is that the command insists on using block comments for comment toggling (⌘ + /) and doesn't respect when I add a preferences file to change TM_COMMENT_MODE. I even tried using this simple preference:
{ shellVariables = (
{ name = 'TM_COMMENT_START';
value = '// ';
},
);
}
but no luck. I'm hoping that someone who speaks Ruby much better than myself (ie. at all) can find a simple fix for this. You can reproduce in any (recent) install of TextMate by creating a new actionscript 2 file and trying to ⌘ + / a section of code (or even a line). Contrast to a JS file which will use a line comment. Copy the "Comments" snippet from JavaScript to Actionscript bundles, and the problem will persist.
Thanks!
In your ActionScript Bundle, add a Preference called "Comments". In the editor part, add:
{ shellVariables = (
{ name = 'TM_COMMENT_START';
value = '// ';
},
{ name = 'TM_COMMENT_DISABLE_INDENT';
value = 'YES';
},
{ name = 'TM_COMMENT_START_2';
value = '/* ';
},
{ name = 'TM_COMMENT_END_2';
value = '*/';
},
);
}
and finally at the bottom, set the scope selector to: scope.actionscript.2
Here is an image of what mine looks like
be sure to use the Reload Bundles menu item after you've made these changes.