A TextMate Bundle for Forester
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

initial commit

Liam O'Connor 19dd2bc7

+588
+108
Forester.tmbundle/Commands/Build.tmCommand
··· 1 + <?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"> 3 + <plist version="1.0"> 4 + <dict> 5 + <key>beforeRunningCommand</key> 6 + <string>saveActiveFile</string> 7 + <key>command</key> 8 + <string>#!/usr/bin/env ruby 9 + require 'pathname' 10 + require 'cgi' 11 + 12 + def find_forest_root(path) 13 + return nil if path.nil? 14 + current = Pathname.new(path).parent 15 + while current.to_s != "/" 16 + return current if (current + "forest.toml").exist? 17 + current = current.parent 18 + end 19 + nil 20 + end 21 + 22 + file = ENV['TM_FILEPATH'] 23 + root = find_forest_root(file) 24 + 25 + unless root 26 + puts "&lt;p&gt;No forest.toml found in ancestor directories.&lt;/p&gt;" 27 + exit 1 28 + end 29 + 30 + Dir.chdir(root) do 31 + output = `forester build 2&gt;&amp;1` 32 + 33 + puts "&lt;style&gt; 34 + body { font-family: monospace; padding: 1em; } 35 + .error { color: #cc0000; font-weight: bold; } 36 + .warning { color: #cc7700; font-weight: bold; } 37 + .file a { color: #0066cc; } 38 + pre { margin: 0; } 39 + .block { margin-bottom: 1em; } 40 + &lt;/style&gt;" 41 + 42 + current_level = nil 43 + current_file = nil 44 + current_line = nil 45 + block_lines = [] 46 + 47 + flush = lambda do 48 + unless block_lines.empty? 49 + css_class = current_level == 'error' ? 'error' : 'warning' 50 + puts "&lt;div class='block'&gt;" 51 + block_lines.each_with_index do |l, i| 52 + if i == 0 53 + puts "&lt;span class='#{css_class}'&gt;#{CGI.escapeHTML(l)}&lt;/span&gt;" 54 + elsif current_file &amp;&amp; current_line &amp;&amp; i == 1 55 + url = "txmt://open?url=file://#{CGI.escapeHTML(current_file)}&amp;line=#{current_line}" 56 + puts "&lt;span class='file'&gt;&lt;a href='#{url}'&gt;#{CGI.escapeHTML(l)}&lt;/a&gt;&lt;/span&gt;" 57 + else 58 + puts "&lt;pre&gt;#{CGI.escapeHTML(l)}&lt;/pre&gt;" 59 + end 60 + end 61 + puts "&lt;/div&gt;" 62 + block_lines = [] 63 + current_level = nil 64 + current_file = nil 65 + current_line = nil 66 + end 67 + end 68 + 69 + output.each_line do |line| 70 + line = line.rstrip 71 + if line =~ /→\s*(error|warning)/ 72 + flush.call 73 + current_level = $1 74 + block_lines &lt;&lt; line 75 + elsif line =~ /■\s*(.+)/ 76 + current_file = $1.strip 77 + block_lines &lt;&lt; line 78 + elsif line =~ /^\s*(\d+)\s*\|/ 79 + current_line = $1 80 + block_lines &lt;&lt; line 81 + elsif line.strip.empty? &amp;&amp; !block_lines.empty? 82 + flush.call 83 + else 84 + block_lines &lt;&lt; line 85 + end 86 + end 87 + flush.call 88 + end</string> 89 + <key>input</key> 90 + <string>document</string> 91 + <key>inputFormat</key> 92 + <string>text</string> 93 + <key>keyEquivalent</key> 94 + <string>@b</string> 95 + <key>name</key> 96 + <string>Build</string> 97 + <key>outputCaret</key> 98 + <string>afterOutput</string> 99 + <key>outputFormat</key> 100 + <string>html</string> 101 + <key>outputLocation</key> 102 + <string>newWindow</string> 103 + <key>uuid</key> 104 + <string>19FA73A2-C2FA-4A59-9AE2-E1A347D7B8D6</string> 105 + <key>version</key> 106 + <integer>2</integer> 107 + </dict> 108 + </plist>
+85
Forester.tmbundle/Commands/Complete.tmCommand
··· 1 + <?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"> 3 + <plist version="1.0"> 4 + <dict> 5 + <key>beforeRunningCommand</key> 6 + <string>nop</string> 7 + <key>command</key> 8 + <string>#!/usr/bin/env ruby 9 + # encoding: utf-8 10 + 11 + require "#{ENV['TM_SUPPORT_PATH']}/lib/ui" 12 + require 'pathname' 13 + 14 + file = ENV['TM_FILEPATH'] 15 + query = STDIN.read # ENV['TM_CURRENT_WORD'] || "" 16 + 17 + 18 + def find_forest_root(path) 19 + return nil if path.nil? 20 + current = Pathname.new(path).parent 21 + while current.to_s != "/" 22 + return current if (current + "forest.toml").exist? 23 + current = current.parent 24 + end 25 + nil 26 + end 27 + 28 + root = find_forest_root(file) 29 + 30 + unless root 31 + TextMate::UI.tool_tip "No forest.toml found in ancestor directories." 32 + exit 200 33 + end 34 + 35 + 36 + Dir.chdir(root) do 37 + # Use full path to forester if it's not in your shell PATH 38 + raw_output = `forester complete --title="#{query}"` 39 + if $?.exitstatus != 0 40 + TextMate::UI.tool_tip "forester failed to find completions (try building)." 41 + exit 200 42 + end 43 + if raw_output.nil? || raw_output.strip.empty? 44 + TextMate::UI.tool_tip ("No matches found.") 45 + exit 200 46 + end 47 + 48 + choices = raw_output.split("\n").map do |l| 49 + id, title = l.split(',', 2) 50 + next nil if id.nil? 51 + { 52 + 'display' =&gt; "#{title.strip} (#{id.strip})", 53 + 'insert' =&gt; id.strip, 54 + } 55 + end.compact 56 + 57 + if choices.any? 58 + selected = TextMate::UI.menu(choices.map { |c| c['display'] }) 59 + print choices[selected]['insert'] if selected 60 + else 61 + TextMate::UI.tool_tip "No matches for: #{query}" 62 + end 63 + end</string> 64 + <key>input</key> 65 + <string>scope</string> 66 + <key>inputFormat</key> 67 + <string>text</string> 68 + <key>keyEquivalent</key> 69 + <string>~</string> 70 + <key>name</key> 71 + <string>Complete</string> 72 + <key>outputCaret</key> 73 + <string>afterOutput</string> 74 + <key>outputFormat</key> 75 + <string>text</string> 76 + <key>outputLocation</key> 77 + <string>replaceInput</string> 78 + <key>scope</key> 79 + <string>markup.underline.link</string> 80 + <key>uuid</key> 81 + <string>63B481D1-6AA9-457D-B872-CFC5EE99F8EC</string> 82 + <key>version</key> 83 + <integer>2</integer> 84 + </dict> 85 + </plist>
+28
Forester.tmbundle/Preferences/smart_pairs.tmPreferences
··· 1 + <?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"> 3 + <plist version="1.0"> 4 + <dict> 5 + <key>name</key> 6 + <string>smart_pairs</string> 7 + <key>settings</key> 8 + <dict> 9 + <key>smartTypingPairs</key> 10 + <array> 11 + <array> 12 + <string>(</string> 13 + <string>)</string> 14 + </array> 15 + <array> 16 + <string>{</string> 17 + <string>}</string> 18 + </array> 19 + <array> 20 + <string>[</string> 21 + <string>]</string> 22 + </array> 23 + </array> 24 + </dict> 25 + <key>uuid</key> 26 + <string>34F1D446-4E01-4304-834D-B5AEA9E6E24C</string> 27 + </dict> 28 + </plist>
+351
Forester.tmbundle/Syntaxes/Forester.tmLanguage
··· 1 + <?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"> 3 + <plist version="1.0"> 4 + <dict> 5 + <key>fileTypes</key> 6 + <array> 7 + <string>tree</string> 8 + </array> 9 + <key>name</key> 10 + <string>Forester</string> 11 + <key>patterns</key> 12 + <array> 13 + <dict> 14 + <key>include</key> 15 + <string>#comments</string> 16 + </dict> 17 + <dict> 18 + <key>include</key> 19 + <string>#macro-content</string> 20 + </dict> 21 + </array> 22 + <key>repository</key> 23 + <dict> 24 + <key>bold-macro</key> 25 + <dict> 26 + <key>begin</key> 27 + <string>(\\)(strong)\{</string> 28 + <key>beginCaptures</key> 29 + <dict> 30 + <key>1</key> 31 + <dict> 32 + <key>name</key> 33 + <string>keyword.other.macro.forester</string> 34 + </dict> 35 + <key>2</key> 36 + <dict> 37 + <key>name</key> 38 + <string>keyword.other.macro.forester</string> 39 + </dict> 40 + </dict> 41 + <key>contentName</key> 42 + <string>markup.bold.forester</string> 43 + <key>end</key> 44 + <string>\}</string> 45 + <key>patterns</key> 46 + <array> 47 + <dict> 48 + <key>include</key> 49 + <string>#macro-content</string> 50 + </dict> 51 + </array> 52 + </dict> 53 + <key>braces</key> 54 + <dict> 55 + <key>begin</key> 56 + <string>\{</string> 57 + <key>end</key> 58 + <string>\}</string> 59 + <key>name</key> 60 + <string>meta.brace.curly.forester</string> 61 + <key>patterns</key> 62 + <array> 63 + <dict> 64 + <key>include</key> 65 + <string>#braces</string> 66 + </dict> 67 + <dict> 68 + <key>include</key> 69 + <string>#macros</string> 70 + </dict> 71 + </array> 72 + </dict> 73 + <key>code-macro</key> 74 + <dict> 75 + <key>begin</key> 76 + <string>(\\)(code)\{</string> 77 + <key>beginCaptures</key> 78 + <dict> 79 + <key>1</key> 80 + <dict> 81 + <key>name</key> 82 + <string>keyword.other.macro.forester</string> 83 + </dict> 84 + <key>2</key> 85 + <dict> 86 + <key>name</key> 87 + <string>keyword.other.macro.forester</string> 88 + </dict> 89 + </dict> 90 + <key>contentName</key> 91 + <string>markup.raw.inline.forester</string> 92 + <key>end</key> 93 + <string>\}</string> 94 + <key>patterns</key> 95 + <array> 96 + <dict> 97 + <key>include</key> 98 + <string>#macro-content</string> 99 + </dict> 100 + </array> 101 + </dict> 102 + <key>comments</key> 103 + <dict> 104 + <key>begin</key> 105 + <string>%</string> 106 + <key>end</key> 107 + <string>$</string> 108 + <key>name</key> 109 + <string>comment.line.percentage.forester</string> 110 + </dict> 111 + <key>em-macro</key> 112 + <dict> 113 + <key>begin</key> 114 + <string>(\\)(em)\{</string> 115 + <key>beginCaptures</key> 116 + <dict> 117 + <key>1</key> 118 + <dict> 119 + <key>name</key> 120 + <string>keyword.other.macro.forester</string> 121 + </dict> 122 + <key>2</key> 123 + <dict> 124 + <key>name</key> 125 + <string>keyword.other.macro.forester</string> 126 + </dict> 127 + </dict> 128 + <key>contentName</key> 129 + <string>markup.italic.forester</string> 130 + <key>end</key> 131 + <string>\}</string> 132 + <key>patterns</key> 133 + <array> 134 + <dict> 135 + <key>include</key> 136 + <string>#macro-content</string> 137 + </dict> 138 + </array> 139 + </dict> 140 + <key>macro-content</key> 141 + <dict> 142 + <key>patterns</key> 143 + <array> 144 + <dict> 145 + <key>include</key> 146 + <string>#verbatims</string> 147 + </dict> 148 + <dict> 149 + <key>include</key> 150 + <string>#comments</string> 151 + </dict> 152 + <dict> 153 + <key>include</key> 154 + <string>#wiki-link</string> 155 + </dict> 156 + <dict> 157 + <key>include</key> 158 + <string>#markdown-link</string> 159 + </dict> 160 + <dict> 161 + <key>include</key> 162 + <string>#ref-macro</string> 163 + </dict> 164 + <dict> 165 + <key>include</key> 166 + <string>#bold-macro</string> 167 + </dict> 168 + <dict> 169 + <key>include</key> 170 + <string>#code-macro</string> 171 + </dict> 172 + <dict> 173 + <key>include</key> 174 + <string>#em-macro</string> 175 + </dict> 176 + <dict> 177 + <key>include</key> 178 + <string>#math</string> 179 + </dict> 180 + <dict> 181 + <key>include</key> 182 + <string>#macros</string> 183 + </dict> 184 + </array> 185 + </dict> 186 + <key>macros</key> 187 + <dict> 188 + <key>begin</key> 189 + <string>(\\)([a-zA-Z]+)</string> 190 + <key>beginCaptures</key> 191 + <dict> 192 + <key>1</key> 193 + <dict> 194 + <key>name</key> 195 + <string>keyword.other.macro.forester</string> 196 + </dict> 197 + <key>2</key> 198 + <dict> 199 + <key>name</key> 200 + <string>keyword.other.macro.forester</string> 201 + </dict> 202 + </dict> 203 + <key>end</key> 204 + <string>\}</string> 205 + <key>patterns</key> 206 + <array> 207 + <dict> 208 + <key>include</key> 209 + <string>#macro-content</string> 210 + </dict> 211 + </array> 212 + </dict> 213 + <key>markdown-link</key> 214 + <dict> 215 + <key>captures</key> 216 + <dict> 217 + <key>1</key> 218 + <dict> 219 + <key>name</key> 220 + <string>punctuation.definition.link.begin.forester</string> 221 + </dict> 222 + <key>2</key> 223 + <dict> 224 + <key>name</key> 225 + <string>string.other.link.title.forester</string> 226 + </dict> 227 + <key>3</key> 228 + <dict> 229 + <key>name</key> 230 + <string>punctuation.definition.link.end.forester</string> 231 + </dict> 232 + <key>4</key> 233 + <dict> 234 + <key>name</key> 235 + <string>punctuation.definition.url.begin.forester</string> 236 + </dict> 237 + <key>5</key> 238 + <dict> 239 + <key>name</key> 240 + <string>markup.underline.link.forester</string> 241 + </dict> 242 + <key>6</key> 243 + <dict> 244 + <key>name</key> 245 + <string>punctuation.definition.url.end.forester</string> 246 + </dict> 247 + </dict> 248 + <key>match</key> 249 + <string>(\[)([^\]]+)(\])(\()([^\)]+)(\))</string> 250 + <key>name</key> 251 + <string>meta.link.markdown.forester</string> 252 + </dict> 253 + <key>math</key> 254 + <dict> 255 + <key>begin</key> 256 + <string>(#|##)\{</string> 257 + <key>beginCaptures</key> 258 + <dict> 259 + <key>1</key> 260 + <dict> 261 + <key>name</key> 262 + <string>keyword.other.macro.forester</string> 263 + </dict> 264 + <key>2</key> 265 + <dict> 266 + <key>name</key> 267 + <string>keyword.other.macro.forester</string> 268 + </dict> 269 + </dict> 270 + <key>contentName</key> 271 + <string>markup.other.math.forester</string> 272 + <key>end</key> 273 + <string>\}</string> 274 + <key>patterns</key> 275 + <array> 276 + <dict> 277 + <key>include</key> 278 + <string>#macro-content</string> 279 + </dict> 280 + </array> 281 + </dict> 282 + <key>ref-macro</key> 283 + <dict> 284 + <key>begin</key> 285 + <string>(\\)(ref|import|transclude|author)\{</string> 286 + <key>beginCaptures</key> 287 + <dict> 288 + <key>1</key> 289 + <dict> 290 + <key>name</key> 291 + <string>keyword.control.forester</string> 292 + </dict> 293 + <key>2</key> 294 + <dict> 295 + <key>name</key> 296 + <string>keyword.control.forester</string> 297 + </dict> 298 + </dict> 299 + <key>contentName</key> 300 + <string>markup.underline.link.forester</string> 301 + <key>end</key> 302 + <string>\}</string> 303 + <key>patterns</key> 304 + <array> 305 + <dict> 306 + <key>include</key> 307 + <string>#macro-content</string> 308 + </dict> 309 + </array> 310 + </dict> 311 + <key>verbatims</key> 312 + <dict> 313 + <key>begin</key> 314 + <string>\\startverb</string> 315 + <key>end</key> 316 + <string>\\stopverb</string> 317 + <key>name</key> 318 + <string>string.other.forester</string> 319 + </dict> 320 + <key>wiki-link</key> 321 + <dict> 322 + <key>captures</key> 323 + <dict> 324 + <key>1</key> 325 + <dict> 326 + <key>name</key> 327 + <string>punctuation.definition.wiki.begin.forester</string> 328 + </dict> 329 + <key>2</key> 330 + <dict> 331 + <key>name</key> 332 + <string>markup.underline.link.wiki.forester</string> 333 + </dict> 334 + <key>3</key> 335 + <dict> 336 + <key>name</key> 337 + <string>punctuation.definition.wiki.end.forester</string> 338 + </dict> 339 + </dict> 340 + <key>match</key> 341 + <string>(\[\[)([^\]]+)(\]\])</string> 342 + <key>name</key> 343 + <string>meta.link.wiki.forester</string> 344 + </dict> 345 + </dict> 346 + <key>scopeName</key> 347 + <string>source.forester</string> 348 + <key>uuid</key> 349 + <string>FDCFACB9-08A2-40FC-BBAB-3701D2099027</string> 350 + </dict> 351 + </plist>
+16
Forester.tmbundle/info.plist
··· 1 + <?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"> 3 + <plist version="1.0"> 4 + <dict> 5 + <key>contactEmailRot13</key> 6 + <string>zr@yvnzbp.arg</string> 7 + <key>contactName</key> 8 + <string>Liam O'Connor</string> 9 + <key>description</key> 10 + <string>A bundle for Forester</string> 11 + <key>name</key> 12 + <string>Forester</string> 13 + <key>uuid</key> 14 + <string>A2AF9014-B7C5-43EA-949E-486CB7B06DA1</string> 15 + </dict> 16 + </plist>