Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 77bea33bc8
Fetching contributors…

Cannot retrieve contributors at this time

56 lines (55 sloc) 1.792 kB
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
<string>#!/usr/bin/env ruby
require ENV['TM_SUPPORT_PATH'] + "/lib/exit_codes.rb"
require ENV['TM_SUPPORT_PATH'] + "/lib/escape.rb"
text = STDIN.read
lines = text.split("\n")
row = ENV['TM_LINE_NUMBER'].to_i
col = ENV['TM_LINE_INDEX'].to_i
currentLine = lines[row-1]
found = currentLine.scan(/\[\d+\]/)[0]
if found then
# No need to change the file at all in this case. Just locate the proper
# line and use the txmt scheme to take us there.
txt = text.slice(0..text.rindex(found)+found.length)
lines = txt.split("\n")
line = lines.length
column = lines.last.length + 1
`open "txmt://open?line=#{line}&amp;column=#{column}"`
TextMate.exit_discard
# print text.insert(text.rindex(found)+found.length + 1,"$0")
else
m = text.scan(/\[(\d+)\]/).map{|i| i[0].to_i}.max || 0
before = []
(row-1).times do before &lt;&lt; lines.shift end
# cl = lines.shift
if lines[0] =~ /(?:due|at|from):/ then
before &lt;&lt; lines[0].slice!(/^.*(?=\s(?:due|at|from):)/)
else
before &lt;&lt; lines.shift
lines.unshift("")
end
print e_sn(before.join("\n") + " [#{m+1}]" + lines.join("\n")) + "\n[#{m+1}] $0"
end</string>
<key>fallbackInput</key>
<string>document</string>
<key>input</key>
<string>selection</string>
<key>keyEquivalent</key>
<string>^{</string>
<key>name</key>
<string>Go to Note</string>
<key>output</key>
<string>insertAsSnippet</string>
<key>scope</key>
<string>text.gtdalt - meta.note</string>
<key>uuid</key>
<string>BF20459A-D83B-4821-A68D-06F3D885309C</string>
</dict>
</plist>
Jump to Line
Something went wrong with that request. Please try again.