├── changelog.md
├── coffee_script.lang
├── install.sh
├── literate_coffee_script.lang
├── readme.md
├── rubycius-mod.xml
└── test.coffee
/changelog.md:
--------------------------------------------------------------------------------
1 |
2 | 1.0.4 / 2013-02-25
3 | ==================
4 |
5 | * updated; relaxed the strict character requirements for function parameters
6 | * updated; readme to GTK3 as default
7 | * added; right margin property
8 | * added; recognize litcoffee file types #27
9 | * added; IcedCoffeescript keywords
10 |
11 | 1.0.3 / 2012-02-20
12 | ==================
13 |
14 | * fixed; Inline multi-line comments not correct GH #21
15 | * fixed; Regex bug Fixes #17
16 | * added; *.coffee.erb as valid CS file Fixes #20
17 |
18 | 1.0.2 / 2011-11-07
19 | ==================
20 |
21 | * FIXME illegible -> #16
22 | * Add extensionless Cakefile to globs
23 | * Recognize destructuring assignment in function arguments
24 |
25 | 1.0.1 / 2011-08-24
26 | ==================
27 |
28 | * updated fn application to support -> #13
29 |
30 | 1.0.0 / 2011-08-05
31 | ==================
32 |
33 | * big version bump (stable release)
34 | * use new screenshot
35 | * updated to add gtk3 instructions for theme
36 | * bumped up contrast for line numbers #5
37 |
--------------------------------------------------------------------------------
/coffee_script.lang:
--------------------------------------------------------------------------------
1 |
2 |
23 |
24 |
25 | application/coffeescript;text/coffeescript;application/cakefile;text/cakefile;application/icedcoffeescript;text/icedcoffeescript
26 | *.coffee;Cakefile;*.Cakefile;*.coffee.erb;*.iced;*.iced.erb
27 | #
28 | ###
29 | ###
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | await
59 | defer
60 |
61 |
62 |
63 |
70 |
71 |
79 |
80 |
88 |
89 |
90 |
91 | (?<!\d)\s*/(?![\s/*+{}?]).*?[^\\]/[igmy]*
92 |
93 |
94 |
95 | \/\/\/
96 | \/\/\/
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 | '''
106 | '''
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 | """
115 | """
116 |
117 |
118 |
119 |
120 | \#{[^}]+}
121 |
122 |
123 |
124 |
125 |
126 | "
127 | "
128 |
129 |
130 | \#{[^}]+}
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 | '
139 | '
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 | `
148 | `
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 | undefined
166 | null
167 |
168 |
169 |
170 | \b[A-Z0-9_]+\b
171 |
172 |
173 |
174 | false
175 | true
176 | yes
177 | no
178 | on
179 | off
180 |
181 |
182 |
183 | \b(return|break|continue|throw)\b
184 |
185 |
186 |
187 | \b(for(\s+own)?|while|until|loop)\b
188 |
189 |
190 |
191 | \b(if|else|unless|switch|when|then|and|or|in|of|by|is|isnt|
192 | not)\b
193 |
194 |
195 |
196 | \b(instanceof|typeof|delete|new|where|class|extends|super|
197 | try|catch|finally)\b
198 |
199 |
200 |
201 | (-[\-=>]?|\+[+=]?|[*&|\/%=<>^~:!?]+)
202 |
203 |
204 |
205 | \%{statement-keyword}|
206 | \%{loop-keyword}|
207 | \%{conditional-keyword}|
208 | \%{keywords-keyword}
209 |
210 |
211 |
212 | \%{statement-keyword}
213 |
214 |
215 |
216 | \%{loop-keyword}
217 |
218 |
219 |
220 | \%{conditional-keyword}
221 |
222 |
223 |
224 | \%{operator-regex}([ \t]*)
225 |
226 |
227 |
228 |
229 | \%{keywords-keyword}
230 |
231 |
232 |
233 | try
234 | catch
235 | finally
236 |
237 |
238 |
239 | (@([a-zA-Z\$_](\w|\$)*)|this)
240 |
241 |
242 |
243 | \b\w+\b(?=\s*(=|:)\s*(\(.*\))?\s*(-\>|=\>))
244 |
245 |
246 |
247 | \b[A-Z][A-Za-z0-9_]+\b(?!\.)
248 |
249 |
250 |
251 |
252 | \b @? [A-Za-z0-9_]+ (
253 | (?= [(]) |
254 | \s+ (
255 | (?= [=-]>) |
256 | (?=\S)(?!
257 | \%{novalue-keywords} | [\])}=:,#] |
258 | [-+*/]= | \%{operator-regex}\s )
259 | )
260 | )
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
--------------------------------------------------------------------------------
/install.sh:
--------------------------------------------------------------------------------
1 | mkdir -p ~/.local/share/gtksourceview-3.0
2 | mkdir -p ~/.local/share/gtksourceview-3.0/language-specs
3 | mkdir -p ~/.local/share/gtksourceview-3.0/styles
4 | cp rubycius-mod.xml ~/.local/share/gtksourceview-3.0/styles
5 | cp coffee_script.lang ~/.local/share/gtksourceview-3.0/language-specs
6 | cp literate_coffee_script.lang ~/.local/share/gtksourceview-3.0/language-specs
7 | cd ~/.local/share
8 | mkdir -p mime/packages
9 | update-mime-database mime
10 |
--------------------------------------------------------------------------------
/literate_coffee_script.lang:
--------------------------------------------------------------------------------
1 |
2 |
23 |
24 |
25 | application/litcoffeescript;text/litcoffeescript
26 | *.litcoffee;*.coffee.md
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | This project adds [CoffeeScript] syntax highlighting to the gedit text editor. (and any other gtksourceview compliant text editor)
2 |
3 | [CoffeeScript]: http://coffeescript.org
4 |
5 | ### Easy Installation
6 |
7 | Clone and execute `install.sh`.
8 |
9 | ### Installation and Use
10 |
11 | 1. Download and place coffee_script.lang in `~/.local/share/gtksourceview-4/language-specs`
12 |
13 | > Note: if those directories don't exist, make them and gedit will know what to do.
14 | > **Important:** if you are using GTK3 (e.g. old Gnome) use `gtksourceview-3.0/language-specs` folder instead of 4.
15 |
16 | 2. Run gedit and open a CoffeeScript file, Cakefile, or IcedCoffeeScript file.
17 |
18 | Patches and improvements welcome!
19 |
20 | 
21 |
22 | ### Extra: Install the Ruycius-Mod theme
23 |
24 | 1. Download and place rubycius-mod.xml in `~/.local/share/gtksourceview-4/styles`
25 |
26 | > Note: if those directories don't exist, make them and gedit will know what to do.
27 | > **Important:** if you are using GTK3 (e.g. old Gnome) use `gtksourceview-3.0/styles` folder instead of 4.
28 |
29 | 2. Run gedit then Edit > Preferences > Fonts and Colors > Color Scheme > Rubycius-Mod
30 |
31 | 3. I like using Liberation Mono for a base font as well which is available within the standard repo for many Linux distros.
32 |
33 |
--------------------------------------------------------------------------------
/rubycius-mod.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Joselo (mods by @wavded)
4 | <_description>Rubycius-Mod
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/test.coffee:
--------------------------------------------------------------------------------
1 | # Assignment
2 | CONSTANT = 302
3 | number = 42
4 | opposite = true
5 |
6 | # Conditions
7 | number = -42 if opposite
8 |
9 | # Functions
10 | square = (x) -> x * x
11 |
12 | # RegExp
13 | matcher = /mymatch/g
14 | matcher2 = url.match(///^([^?#]*)([^#]*)(.*)$///)
15 |
16 | # Interpolation
17 | html_double = "And the \" number is #{number}"
18 | html_single = 'This is \' not an #{interpolation}'
19 |
20 | # Heredocs
21 |
22 | heredocs_double = """
23 | Hello "world" and 'world' and #{number}
24 | """
25 |
26 | heredocs_single = '''
27 | Hello 'world' and "world" and not an #{interpolation}
28 | '''
29 |
30 | # Arrays
31 | list = [1, 2, 3, 4, 5]
32 |
33 | # Objects
34 | math =
35 | root: Math.sqrt
36 | square: square
37 | cube: (x) -> x * square x
38 |
39 | # Splats
40 | race = (winners, runners...) ->
41 | print winner, runners
42 |
43 | # Existence
44 | alert "I knew it!" if elvis?
45 |
46 | # Array comprehensions
47 | cubes = match.cube num for num in list
48 |
49 | # Class
50 | class Animal
51 | constructor: (@name = '') ->
52 |
53 | move: (meters) ->
54 | alert @name + " moved " + meters + "m."
55 |
56 | bud = new Animal
57 |
58 | ### Block
59 | FIXME
60 | Comments ###
61 |
62 | ### Single Line Comment ###
63 |
64 | # Heregex
65 | OPERATOR = /// ^ (
66 | ?: [-=]> # function
67 | | [-+*/%<>&|^!?=]= # compound assign / compare
68 | | >>>=? # zero-fill right shift
69 | | ([-+:])\1 # doubles
70 | | ([&|<>])\2=? # logic / shift
71 | | \?\. # soak access
72 | | \.{2,3}# # range or splat
73 | ) ///
74 |
75 | $('#id').click (e) ->
76 | $('#id').click ->
77 |
78 | camel_cased_word.gsub /\.hello\/hi/, '/'
79 | a = 'This is some string'
80 |
81 | # Async control from IcedCoffeeScript variation
82 | await someAsyncFunction 'param', defer response
83 |
--------------------------------------------------------------------------------