Skip to content

Commit cbaf648

Browse files
committed
notebook-specific color theme to more clearly separate input/output areas
1 parent b279482 commit cbaf648

6 files changed

Lines changed: 749 additions & 18 deletions
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"color_scheme": "Packages/SublimeIPythonNotebook/ipynb2.hidden-tmTheme",
3+
4+
}

SublimeIPythonNotebook.tmLanguage

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
2+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
55
<key>fileTypes</key>
@@ -12,7 +12,8 @@
1212
<array>
1313
<dict>
1414
<key>begin</key>
15-
<string>\#Input-R\[.*\]</string>
15+
<string>\#Input-R\[.*\]
16+
</string>
1617
<key>beginCaptures</key>
1718
<dict>
1819
<key>0</key>
@@ -21,6 +22,8 @@
2122
<string>comment</string>
2223
</dict>
2324
</dict>
25+
<key>contentName</key>
26+
<string>ipynb.source.input.r</string>
2427
<key>end</key>
2528
<string>\#\/Input</string>
2629
<key>endCaptures</key>
@@ -31,8 +34,6 @@
3134
<string>comment</string>
3235
</dict>
3336
</dict>
34-
<key>name</key>
35-
<string>ipynb.source.input.r</string>
3637
<key>patterns</key>
3738
<array>
3839
<dict>
@@ -43,7 +44,8 @@
4344
</dict>
4445
<dict>
4546
<key>begin</key>
46-
<string>\#Input\[.*\]</string>
47+
<string>\#Input\[.*\]
48+
</string>
4749
<key>beginCaptures</key>
4850
<dict>
4951
<key>0</key>
@@ -52,6 +54,8 @@
5254
<string>comment</string>
5355
</dict>
5456
</dict>
57+
<key>contentName</key>
58+
<string>ipynb.source.input.python</string>
5559
<key>end</key>
5660
<string>\#\/Input</string>
5761
<key>endCaptures</key>
@@ -62,8 +66,6 @@
6266
<string>comment</string>
6367
</dict>
6468
</dict>
65-
<key>name</key>
66-
<string>ipynb.source.input.python</string>
6769
<key>patterns</key>
6870
<array>
6971
<dict>
@@ -74,7 +76,8 @@
7476
</dict>
7577
<dict>
7678
<key>begin</key>
77-
<string>\#Output\[.*\]</string>
79+
<string>\#Output\[.*\]
80+
</string>
7881
<key>beginCaptures</key>
7982
<dict>
8083
<key>0</key>
@@ -83,6 +86,8 @@
8386
<string>comment</string>
8487
</dict>
8588
</dict>
89+
<key>contentName</key>
90+
<string>ipynb.source.output</string>
8691
<key>end</key>
8792
<string>\#\/Output</string>
8893
<key>endCaptures</key>
@@ -93,8 +98,6 @@
9398
<string>comment</string>
9499
</dict>
95100
</dict>
96-
<key>name</key>
97-
<string>ipynb.source.output</string>
98101
</dict>
99102
<dict>
100103
<key>match</key>

SublimeIPythonNotebook.tmLanguage.JSON

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
{
1313

14-
"name": "ipynb.source.input.r",
15-
"begin": "\\#Input-R\\[.*\\]",
14+
"contentName": "ipynb.source.input.r",
15+
"begin": "\\#Input-R\\[.*\\]\n",
1616
"end": "\\#\\/Input",
1717
"beginCaptures": {
1818
"0": { "name": "comment"}
@@ -28,8 +28,8 @@
2828
},
2929

3030
{
31-
"name": "ipynb.source.input.python",
32-
"begin": "\\#Input\\[.*\\]",
31+
"contentName": "ipynb.source.input.python",
32+
"begin": "\\#Input\\[.*\\]\n",
3333
"patterns": [
3434
{
3535
"include": "source.python"
@@ -46,8 +46,9 @@
4646
},
4747

4848
{
49-
"name": "ipynb.source.output",
50-
"begin": "\\#Output\\[.*\\]",
49+
"contentName": "ipynb.source.output",
50+
//"name": "storage.type.string.python",
51+
"begin": "\\#Output\\[.*\\]\n",
5152
"end": "\\#\\/Output",
5253
"beginCaptures": {
5354
"0": { "name": "comment"}

ipy_view.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ def set_name(self, new_name):
312312
view.set_name("IPy Notebook - " + self.notebook.name)
313313

314314
def get_cell_separator(self):
315-
return "="*120
315+
return "\n\n"
316316

317317
def on_sel_modified(self):
318318
readonly = True
@@ -368,7 +368,7 @@ def on_modified(self):
368368
def highlight_cell(self, input_region):
369369
reg = self.view.line(input_region.begin()-2)
370370
reg2 = self.view.line(input_region.end()+2)
371-
self.view.add_regions("inb_highlight", [reg, reg2], "comment", "", sublime.DRAW_EMPTY)
371+
self.view.add_regions("inb_highlight", [reg, reg2], "ipynb.source.highlight", "", sublime.DRAW_EMPTY)
372372

373373
def on_backspace(self):
374374
s = self.view.sel()[0]

0 commit comments

Comments
 (0)