Permalink
Browse files

Add a new command which moves to the parent directory’s listfile (on …

…⌥⌘↑)

git-svn-id: http://svn.textmate.org/trunk/Review/Bundles/CMake.tmbundle@11040 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
  • Loading branch information...
ciaran committed Dec 19, 2008
1 parent a1a260c commit ea3ef02c527ac4d5224344da1591dc7e6d2da746
Showing with 52 additions and 0 deletions.
  1. +51 −0 Commands/Move to Parent Listfile.tmCommand
  2. +1 −0 info.plist
@@ -0,0 +1,51 @@
+<?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']
+
+path = File.dirname(File.dirname(ENV['TM_FILEPATH'])) + "/CMakeLists.txt"
+abort "No parent listfile" unless File.exist?(path)
+TextMate.go_to(:file =&gt; path)
+
+# subdir = nil
+#
+# if line =~ /ADD_SUBDIRECTORY\s*\((.+?)\)/i
+# subdir = $1
+# else
+# subdirs = Dir[dir + "/*/CMakeLists.txt"].map { |p| File.basename(File.dirname(p)) }.sort
+# abort "No listfile found in subdirectories" if subdirs.empty?
+# choice = TextMate::UI.menu(subdirs)
+# abort "Cancelled" unless choice
+# subdir = subdirs[choice]
+# end
+#
+# if subdir
+# file = subdir + "/CMakeLists.txt"
+# path = File.join(dir, file)
+# abort "The file at #{file} doesn't exist" unless File.exist?(path)
+# TextMate.go_to(:file =&gt; path)
+# end
+</string>
+ <key>fallbackInput</key>
+ <string>line</string>
+ <key>input</key>
+ <string>none</string>
+ <key>keyEquivalent</key>
+ <string>~@</string>
+ <key>name</key>
+ <string>Move to Parent Listfile</string>
+ <key>output</key>
+ <string>showAsTooltip</string>
+ <key>scope</key>
+ <string>source.cmake</string>
+ <key>uuid</key>
+ <string>48A1D967-E8CF-4C16-A58F-60471E9469E3</string>
+</dict>
+</plist>
View
@@ -41,6 +41,7 @@
<string>E9362AB2-F35B-436F-A042-69135E2F3744</string>
<string>6AA1ED0A-6E0F-48EC-965C-D57AD98A100B</string>
<string>6F326FB4-8DC0-49BE-B74C-7B49CFA5283F</string>
+ <string>48A1D967-E8CF-4C16-A58F-60471E9469E3</string>
<string>6E939107-5C78-455D-A7E6-1107ADC777C2</string>
<string>E60C579C-BEE8-4C0F-8FA3-0F9E1A851154</string>
<string>3C9C38E0-2EC5-4963-9FC1-BD2D04EC62F7</string>

0 comments on commit ea3ef02

Please sign in to comment.