SUBLIME Theme Color Scheme Modifications - user-interface

I'm using Sublime Text 2 and the Color Scheme is iPlastic. How can i change the followings:
Modified/Edited Tab Bar FONT COLOR (Current is 'red')
Highlighting Current Line (Currently i do not have highlighting for current line)
Change the background color of CODE AREA (White-area in the picture)
I showed as the Screenshot below. I believe/hope i need to modify the iPlastic.tmTheme file. But for those certain things above, i don't know what tags to add.
Thanks!

To change current tabs font color, you have to find "class": "tab_label" elements in your .sublime-theme, and modify or add an "fg". Something like this:
{
"class": "tab_label",
"parents": [{"class": "tab_control", "attributes": ["selected"]}],
"fg": [255, 0, 0]
}
(If you didn't set any custom theme, the default is Packages/Theme - Default/Default.sublime-theme).
To highlight current line, you have to set
"highlight_line": true
in your Settings - User.
To change the background color of code area, you have to add something like this:
<dict>
<key>name</key>
<string>Source base background</string>
<key>scope</key>
<string>text,source</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#FFFFFF</string>
</dict>
</dict>
to your .tmTheme color scheme. Of course you should change #FFFFFF color to whatever you need.

Related

Is color scheme file cached?

I'm using IDLE color scheme for Sublime 3, but it did not have diff syntax highglight. SO I found one that I could use it. I added it using PackageResourceViewer. After adding additional content into scheme, I noticed diff syntax working. But I did not like that insertion was colored blue and diff header was green.
So I swapped colors between diff header and insertion. But it had no effect. Header was still green and insertion was still blue. It looks like file is cached somewhere, because I could even delete diff highlight declaration and it would still show me highlights.
My current scheme (with swapped colors) is this:
<dict>
<key>name</key>
<string>diff.header</string>
<key>scope</key>
<string>meta.diff, meta.diff.header</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#3333FF</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>diff.deleted</string>
<key>scope</key>
<string>markup.deleted</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#DD5555</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>diff.inserted</string>
<key>scope</key>
<string>markup.inserted</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#009933</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>diff.changed</string>
<key>scope</key>
<string>markup.changed</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#E6DB74</string>
</dict>
</dict>
Note. Even if I close sublime, open with PRV, I can see that in file my changes persist, but actual syntax is still showed from initial copy/paste.
Some packages quite often decide to make tweaks to the color scheme, and thus create a new color scheme so as to not mess with the original - then they set your active color scheme to their tweaked copy. Therefore, although ST doesn't cache the color scheme - it will look as though it does.
To check, you can see the output from view.settings().get('color_scheme') Enter in the ST console (View menu -> Show Console) - most often the packages that do this name their copy of the color scheme as the original with (package name) appended to the end.
Or check the main User preferences file. Just set it back to your color scheme, and the package will probably do the same thing again but at least it should include your changes this time.

Styling escape character in Sublime Text

I want to style escape character and only escape character differently using custom color scheme (I intend to make it faded to make regexp more readable).
Is it possible to do this? Preferably it would work in general, but something limited to Ruby also would be highly useful.
It sure is possible!
<dict>
<key>name</key>
<string>Escape character</string>
<key>scope</key>
<string>constant.character.escape</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#F38630</string>
</dict>
</dict>
Actually this is the scope for the escape character along with the escaped character.
Remember you may always find the corresponding scope by moving the caret to the characters and pressing:
{ "keys": ["ctrl+alt+shift+p"], "command": "show_scope_name" }
(You will see the scope key in the status bar).

Sublime Text: Change highlight background

I would like to change the color on all the found instances (when you use find) of the word that have been found. I noticed that the highlightBackground key just changes the first instance. Is there a way to change the highlight color of all the found instances?
The following examples are from the Neon Color Scheme (full disclosure - I'm its designer):
So I'm searching though my Package Control.sublime-settings file trying to find all of my packages with HTML (case-insensitive) in their name. I open up the Find dialog (CtrlF on Windows/Linux, ⌘F on OS X) and type HTML into the search box, after unchecking the regex, case-sensitive, and whole-word options. The following appears:
The yellow background behind the first found item on Line 22 is themed using the findHighlight setting, while the blue font (foreground) is themed using findHighlightForeground. I can hit F3 (Win/Lin, ⌘G on OS X) to scroll through each match.
However, say I want a multi-selection so I can change them all at once. I hit Find All (AltEnter, ⌥Enter on OS X) and the window now looks like so:
This is the same coloring used when you manually select text. The bright blue background is themed using the selection setting, while the bright green border around it is themed using selectionBorder. The text color (foreground) is the same as defined elsewhere in the color scheme for that particular scope. Defining selectionForeground doesn't seem to have any effect.
The full settings dict for Neon looks like this:
<dict>
<key>settings</key>
<dict>
<key>activeGuide</key>
<string>#FF0080</string>
<key>background</key>
<string>#000000</string>
<key>caret</key>
<string>#FFFFFF</string>
<key>findHighlight</key>
<string>#F2FF06</string>
<key>findHighlightForeground</key>
<string>#1515FF</string>
<key>foreground</key>
<string>#FFFFFF</string>
<key>guide</key>
<string>#6F6F6F</string>
<key>inactiveSelection</key>
<string>#353576</string>
<!-- invisibles doesn't seem to work for me -->
<key>invisibles</key>
<string>#06FF05</string>
<key>lineHighlight</key>
<string>#2D2D2D</string>
<key>selection</key>
<string>#0205FF</string>
<key>selectionBorder</key>
<string>#06FF05</string>
<key>stackGuide</key>
<string>#06FF05</string>
</dict>
</dict>
I hope this helps!

Sublime Text 2: how to change white space characters color?

The color seems to be linked to the foreground in themes. I assume it's using less alpha. Is there a way to control this?
There's now a Sublime plugin for this.
Install the HighlightWhitespaces plugin
Add the following color settings (tailored to your preference) to your color_scheme file. This file ends in .tmTheme and the path can be found by looking at the value for the key "color_scheme" in your settings file.
<dict>
<key>name</key>
<string>highlight.whitespace</string>
<key>scope</key>
<string>highlight.whitespace</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#020202</string>
<key>foreground</key>
<string>#805050</string>
</dict>
</dict>
Specify that this color should be used by adding the following to the user settings of the HighlightWhitespaces plugin:
{
"highlight_whitespaces_space_highlight_scope_name": "highlight.whitespace",
"highlight_whitespaces_tab_highlight_scope_name": "highlight.whitespace",
"highlight_whitespaces_eol_highlight_scope_name": "highlight.whitespace",
"highlight_whitespaces_mixed_highlight_scope_name": "highlight.whitespace"
}
Relax and enjoy :-)
You may want to try installing PersistentRegexHighlight from Package Control and then use a blank-character regex like [\x20 ] to add a specific color or color scope.
You'd want to combine this with drawWhiteSpace: "all", in Sublime user prefs.
You can change the tab underline alpha by changing the foreground alpha.
To change the color of spaces requires changes to every syntax file.
A few years later, I was struggling with this in Sublime Text 3 build 3083. I hope this helps anyone. In addition to Chris Like's suggestion to install PersistentRegexHighlight and setting "draw_white_space": "all" in the user preferences and the pattern to one or more occurances of tabs and spaces, i.e. [ \t]+ in the PersistentRegexHighlight user settings, i had to also also set "color_scope": "highlight.whitespace" and add the following dict to the theme along with the other ones in the settings array:
<dict>
<key>name</key>
<string>highlight.whitespace</string>
<key>scope</key>
<string>highlight.whitespace</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#020202</string>
<key>foreground</key>
<string>#805050</string>
</dict>
</dict>
which by the way oddly only outlines in red if the background is set to black, i.e #000000
Note that this method does not require editing any syntax files.

Xcode indentation key bindings

Is there a way to get Xcode 4 to indent text so that pressing tab on selected text would indent it, shift + tab would unindent like in many editors?
The default ⌘] and ⌘[ do not seem to work, probably because I have a Finnish keyboard layout. Pressing the key combination for [ (alt + 8) and additionally holding down ⌘ does not indent.
In Xcode preferences I found "Key Bindings" and "Shift Right", "Shift Left", but it does not seem to understand shift + tab. If I try to press shift + tab I get ⇧⌘⇤.
As a workaround if you can't enter shift-tab, you could find the key binding (stored at ~/Library/Developer/Xcode/UserData/KeyBindings and modify it directly. It's XML so you should be able to do this without too much trouble.
Setting the Tab binding for Shift Right did not work for me either even when remapping "Insert Tab" to something else (seems hardcoded/bug). However I did get Alt + Tab and Shift + Alt + Tab binding working (with the Finnish Keyboard layout, didn't test extended or sami). I still had to remap "Insert Tab without Extra Action" from Alt + Tab to Alt + Ctrl + Tab, you could avoid this by using Ctrl instead of Alt for shifting.
Here is the xml file for it.
cd ~/Library/Developer/Xcode/UserData/KeyBindings
vi Default.idekeybindings (probably empty plist, if not extend appropriately)
Paste:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Menu Key Bindings</key>
<dict>
<key>Key Bindings</key>
<array>
<dict>
<key>Action</key>
<string>shiftRight:</string>
<key>Alternate</key>
<string>NO</string>
<key>CommandID</key>
<string>Xcode.IDESourceEditor.CmdDefinition.ShiftRight</string>
<key>Group</key>
<string>Editor Menu for Source Code</string>
<key>GroupID</key>
<string>Xcode.IDESourceEditor.MenuDefinition.Editor</string>
<key>GroupedAlternate</key>
<string>NO</string>
<key>Keyboard Shortcut</key>
<string>~ </string>
<key>Navigation</key>
<string>NO</string>
<key>Parent Title</key>
<string>Structure</string>
<key>Title</key>
<string>Shift Right</string>
</dict>
<dict>
<key>Action</key>
<string>shiftLeft:</string>
<key>Alternate</key>
<string>NO</string>
<key>CommandID</key>
<string>Xcode.IDESourceEditor.CmdDefinition.ShiftLeft</string>
<key>Group</key>
<string>Editor Menu for Source Code</string>
<key>GroupID</key>
<string>Xcode.IDESourceEditor.MenuDefinition.Editor</string>
<key>GroupedAlternate</key>
<string>NO</string>
<key>Keyboard Shortcut</key>
<string>~$</string>
<key>Navigation</key>
<string>NO</string>
<key>Parent Title</key>
<string>Structure</string>
<key>Title</key>
<string>Shift Left</string>
</dict>
</array>
<key>Version</key>
<integer>3</integer>
</dict>
<key>Text Key Bindings</key>
<dict>
<key>Key Bindings</key>
<dict>
<key>^~ </key>
<string>insertTabIgnoringFieldEditor:</string>
</dict>
<key>Version</key>
<integer>3</integer>
</dict>
</dict>
</plist>
Tabbing is included with Xcode, it's just a different key combination. The keyboard short cuts are Command-] for indent and Command-[ for un-indent.
Another handy feature of Visual Studio that is also in Xcode is the block select feature. In Visual Studio if you hold down the Alt key while clicking and dragging you can select a block of text whose start and end columns don’t have to be the beginning and end of the line.
You can also do this in Xcode by holding down the Option key while clicking and dragging.
Found this information here:
http://idevhub.com/xcode-tips-selection-indent-and-block-select/

Resources