Permalink
Browse files

Added a new command to open a listfile included by an ADD_SUBDIRECTOR…

…Y command (bound to ⇧⌘D)

git-svn-id: http://svn.textmate.org/trunk/Review/Bundles/CMake.tmbundle@11037 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
  • Loading branch information...
1 parent 934c5cb commit 968e25bb3bbdebce65c0f2e77f05eacea247be60 @ciaran ciaran committed Dec 19, 2008
Showing with 44 additions and 6 deletions.
  1. +37 −0 Commands/Open Included Listfile.tmCommand
  2. +7 −6 info.plist
View
37 Commands/Open Included Listfile.tmCommand
@@ -0,0 +1,37 @@
+<?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>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string>#!/usr/bin/env ruby
+require ENV['TM_SUPPORT_PATH'] + '/lib/textmate'
+
+abort "Unsaved file" unless ENV['TM_FILEPATH']
+
+line = STDIN.read
+
+if line =~ /ADD_SUBDIRECTORY\s*\((.+?)\)/i
+ path = File.join(File.dirname(ENV['TM_FILEPATH']), $1 + "/CMakeLists.txt")
+ abort "The file at #{$1 + "/CMakeLists.txt"} doesn't exist" unless File.exist?(path)
+ TextMate.go_to(:file =&gt; path)
+else
+ abort "No ADD_SUBDIRECTORY command found"
+end</string>
+ <key>fallbackInput</key>
+ <string>line</string>
+ <key>input</key>
+ <string>selection</string>
+ <key>keyEquivalent</key>
+ <string>@D</string>
+ <key>name</key>
+ <string>Open Included Listfile</string>
+ <key>output</key>
+ <string>showAsTooltip</string>
+ <key>scope</key>
+ <string>source.cmake</string>
+ <key>uuid</key>
+ <string>6F326FB4-8DC0-49BE-B74C-7B49CFA5283F</string>
+</dict>
+</plist>
View
13 info.plist
@@ -34,17 +34,18 @@
<string>F7CA148C-C68F-4DDC-A217-2A266D18205A</string>
<string>DA433498-38DE-4E5D-B3DA-64D8F793CECB</string>
<string>4F059A9A-EEAA-49B6-AAE5-0E29A00CFF70</string>
- <string>6AA1ED0A-6E0F-48EC-965C-D57AD98A100B</string>
- <string>6E939107-5C78-455D-A7E6-1107ADC777C2</string>
- <string>E60C579C-BEE8-4C0F-8FA3-0F9E1A851154</string>
- <string>FCA85521-74FC-4A71-9ADE-DC055E63CAEE</string>
<string>56F808A2-C0ED-4EC9-8E9E-6892E51E0661</string>
<string>725B826B-7849-4A52-8F65-FE4D78378FE1</string>
<string>63E216D2-69EF-4ADF-80A4-46D8A6A6F716</string>
<string>C6535099-87C4-4FDF-9359-95C33C23B3FC</string>
- <string>D58FED93-633B-4C26-89C1-53198843416A</string>
- <string>3C9C38E0-2EC5-4963-9FC1-BD2D04EC62F7</string>
<string>E9362AB2-F35B-436F-A042-69135E2F3744</string>
+ <string>6AA1ED0A-6E0F-48EC-965C-D57AD98A100B</string>
+ <string>6F326FB4-8DC0-49BE-B74C-7B49CFA5283F</string>
+ <string>6E939107-5C78-455D-A7E6-1107ADC777C2</string>
+ <string>E60C579C-BEE8-4C0F-8FA3-0F9E1A851154</string>
+ <string>3C9C38E0-2EC5-4963-9FC1-BD2D04EC62F7</string>
+ <string>D58FED93-633B-4C26-89C1-53198843416A</string>
+ <string>FCA85521-74FC-4A71-9ADE-DC055E63CAEE</string>
</array>
<key>uuid</key>
<string>766FC6D3-539E-4992-BB95-654636D5F990</string>

0 comments on commit 968e25b

Please sign in to comment.